Windows CMD — Command Prompt
File & Directory
dir /s /b *.logrecursive file list
dir /od /qsort by date, show owner
dir /ahshow hidden files
cd /d D:\pathchange drive + dir
md "C:\new\path"create nested dirs
rd /s /q "C:\folder"DANGERdelete dir silently
copy src dst /ycopy, no prompt
move src dstmove / rename
del /f /q *.tmpforce delete no prompt
attrib -r -h -s fileremove r/h/s attrs
tree /f /adir tree with files
where nodefind exe on PATH
findstr /s /i "ERROR" *.loggrep in files
type file.txt | morepage through file
fc /b file1 file2binary file compare
Process & System
tasklist /fi "imagename eq java*"filter by name
tasklist /svcshow hosted services
taskkill /pid 1234 /fforce kill by PID
taskkill /im notepad.exe /fkill by name
wmic process get name,pid,commandlinefull process info
wmic process where "name='java.exe'" get pid,commandlinejava procs
wmic cpu get loadpercentageCPU %
wmic memorychip get capacityRAM size
wmic logicaldisk get size,freespace,captiondisk space
wmic os get lastbootuptimelast reboot time
systeminfo | findstr /i "boot time\|OS\|memory"system summary
hostnamemachine name
whoami /alluser + groups + SID
setall env vars
echo %JAVA_HOME%check env var
setx PATH "%PATH%;C:\new" /mADMINset system PATH
Networking (CMD)
ipconfig /allall adapters + DNS
ipconfig /flushdnsflush DNS cache
ipconfig /release && /renewrelease/renew DHCP
netstat -anoall connections + PID
netstat -ano | findstr :8080who uses port 8080
netstat -b 5refresh every 5s
ping -n 10 -l 1024 host10 pings 1KB packets
tracert -d 8.8.8.8trace no DNS resolve
nslookup hostname 8.8.8.8DNS via Google
telnet host 1433test port open
arp -aARP cache table
route printrouting table
netsh wlan show profilessaved WiFi networks
netsh int ip reset resetlog.txtreset TCP/IP stack
net use Z: \\server\share /user:dom\usermap network drive
Firewall & Ports
netsh advfirewall show allprofilesfirewall status
netsh advfirewall set allprofiles state off!disable all FW
netsh advfirewall firewall add rule name="SQL" protocol=TCP dir=in localport=1433 action=allowopen port
netsh advfirewall firewall del rule name="SQL"remove rule
netsh advfirewall firewall show rule name=alllist all rules
netsh advfirewall export "C:\fw.wfw"backup FW policy
Users & Permissions
net userlist local users
net user admin P@ss123 /addadd user
net user admin /active:nodisable account
net localgroup administrators admin /addadd to admins
net localgroup "Remote Desktop Users" user /addallow RDP
icacls "C:\path" /grant user:Fgrant full control
icacls "C:\path" /inheritance:ddisable inheritance
icacls "C:\path" /reset /treset to inherited
runas /user:domain\admin "cmd"run as another user
Useful Shortcuts
clsclear screen
doskey /historycommand history
cmd /k "command"run & keep window
start "" "file.exe"start detached
call batch.bat && echo donechain on success
for /f "tokens=*" %i in ('cmd') do echo %ifor loop
certutil -hashfile file.zip SHA256checksum file
clip < file.txtcopy file to clipboard
shutdown /r /t 60 /c "Patching"reboot in 60s
shutdown /aabort pending shutdown
mstsc /v:server /adminRDP to server
wmic product get name,versioninstalled software
PowerShell
File & Directory
Get-ChildItem -Recurse -Filter *.logfind files
Get-ChildItem -Path C:\ -Recurse -ErrorAction SilentlyContinue | Where-Object {$_.Length -gt 100MB}large files
Get-Item -Path C:\file | Select-Object *file metadata
Copy-Item -Path src -Destination dst -Recurse -Forcerecursive copy
Remove-Item -Recurse -Force -Path C:\old!delete
Move-Item src dstmove/rename
New-Item -ItemType Directory -Path C:\new\path -Forcecreate dirs
Get-Content -Path file.log -Tail 100 -Waittail -f equivalent
Select-String -Path *.log -Pattern "ERROR" -Context 2grep with context
Get-ChildItem | Sort-Object LastWriteTime -Descending | Select-Object -First 1010 newest
Compress-Archive -Path C:\logs -DestinationPath logs.zipzip folder
Expand-Archive -Path file.zip -DestinationPath C:\outunzip
Services & Processes
Get-Service | Where-Object {$_.Status -eq 'Stopped'}stopped services
Get-Service -Name *sql*find SQL services
Start-Service -Name "MSSQLSERVER"start service
Stop-Service -Name "MSSQLSERVER" -Forcestop service
Restart-Service -Name "W3SVC"restart IIS
Set-Service -Name svc -StartupType Automaticset auto-start
Get-Process | Sort-Object CPU -Descending | Select-Object -First 15top CPU procs
Get-Process | Sort-Object WorkingSet -Desc | Select -First 10top RAM procs
Stop-Process -Name notepad -Forcekill by name
Stop-Process -Id 1234 -Forcekill by PID
Get-Process java | Select Id,CPU,WorkingSet,Pathjava proc details
Get-WmiObject Win32_Service | Where-Object {$_.PathName -like '*jboss*'}find JBoss service
System & Health
Get-ComputerInfo | Select-Object CsName,OsVersion,OsFreePhysicalMemorysystem info
[math]::Round((Get-CimInstance Win32_OperatingSystem).FreePhysicalMemory/1MB,2)free RAM GB
Get-PSDrive | Where-Object {$_.Used} | Select Name,Used,Freedisk usage
(Get-Date) - (gcim Win32_OperatingSystem).LastBootUpTimeuptime
Get-HotFix | Sort-Object InstalledOn -Desc | Select -First 5recent patches
Get-WinEvent -LogName System -MaxEvents 50 | Where-Object {$_.LevelDisplayName -eq 'Error'}system errors
Get-WinEvent -LogName Application -MaxEvents 100 | Where-Object {$_.Message -like '*java*'}java app events
Get-Counter '\Processor(_Total)\% Processor Time' -SampleInterval 2 -MaxSamples 5CPU samples
Test-Path -Path "C:\folder"check path exists
Measure-Command { Invoke-Expression $cmd }time a command
Networking (PS)
Test-NetConnection -ComputerName server -Port 8080test TCP port
Test-Connection server -Count 4ping
Resolve-DnsName hostnameDNS lookup
Get-NetTCPConnection -State Listenlistening ports
Get-NetTCPConnection -LocalPort 8080who owns port
Get-NetIPAddress | Where-Object {$_.AddressFamily -eq 'IPv4'}IPv4 addresses
Get-NetAdapter | Select Name,Status,LinkSpeedadapters
Invoke-WebRequest -Uri "http://host:8080/health" -UseBasicParsingHTTP check
(Invoke-WebRequest -Uri $url -UseBasicParsing).StatusCodeget HTTP status code
Invoke-RestMethod -Uri "http://api/data" -Method GetREST API call
Remote & Automation
Enter-PSSession -ComputerName server -Credential domain\userinteractive remote
Invoke-Command -ComputerName srv -ScriptBlock { Get-Service }run remote cmd
Invoke-Command -ComputerName srv -FilePath C:\script.ps1run script remotely
$s = New-PSSession -ComputerName srv; Copy-Item file -ToSession $s -Destination C:\copy to remote
Enable-PSRemoting -ForceADMINenable WinRM
Set-ExecutionPolicy RemoteSigned -Scope CurrentUserallow scripts
$cred = Get-Credential; Invoke-Command -Credential $cred ...use credentials
Useful One-Liners
Get-Clipboardread clipboard
Set-Clipboard -Value "text"write clipboard
Start-Sleep -Seconds 5sleep/delay
$env:JAVA_HOMEread env var
[System.Environment]::SetEnvironmentVariable("VAR","val","Machine")set system env
Get-Command -Name *zip* -CommandType Allfind cmdlet
Get-Help Get-Process -Examplesbuilt-in help
1..10 | ForEach-Object { Write-Host "Item $_" }loop 1 to 10
Import-Csv data.csv | Export-Csv out.csv -NoTypeInformationprocess CSV
ConvertTo-Json $obj | Out-File data.jsonobject to JSON file
$json = Get-Content file.json | ConvertFrom-Jsonparse JSON
Get-Date -Format "yyyy-MM-dd HH:mm:ss"timestamp string
Git
Daily Workflow
git statusworking tree status
git pull --rebase origin mainpull with rebase
git fetch --all --prunefetch all, remove stale
git add -pinteractive stage chunks
git commit -m "feat: message"commit
git commit --amend --no-editadd to last commit
git push origin HEADpush current branch
git push -u origin feature/xpush + set upstream
git push --force-with-leasesafe force push
git log --oneline --graph --all -20compact visual log
git log --author="name" --since="1 week ago"filtered log
git show HEAD~2:src/Main.javaview file at commit
git diff HEAD~1 HEAD -- file.txtdiff one file
Branching
git branch -aall branches incl remote
git checkout -b feature/newcreate + switch
git switch -c feature/newmodern create + switch
git switch mainswitch branch
git merge --no-ff feature/xmerge with merge commit
git rebase mainrebase onto main
git rebase -i HEAD~3interactive rebase 3
git branch -d feature/xdelete local branch
git push origin --delete feature/xdelete remote branch
git branch -m old newrename branch
git cherry-pick abc1234apply single commit
git cherry-pick A..Bapply commit range
git branch --merged mainbranches merged to main
Stash
git stash push -m "WIP: login fix"stash with message
git stash push --include-untrackedstash untracked too
git stash listlist all stashes
git stash popapply latest + drop
git stash apply stash@{2}apply specific stash
git stash drop stash@{0}delete a stash
git stash show -p stash@{0}see stash diff
git stash branch feature/x stash@{0}stash to new branch
Undo & Fix
git restore file.txtdiscard working changes
git restore --staged file.txtunstage file
git reset HEAD~1 --softundo commit, keep staged
git reset HEAD~1 --mixedundo commit, keep files
git reset HEAD~1 --hard!undo commit + discard
git revert HEADsafe undo (new commit)
git revert A..Brevert commit range
git reflogfull history incl resets
git checkout reflog-sha -- .recover lost commit
git clean -fdx!delete untracked+ignored
git bisect start; git bisect bad; git bisect good v1.0find bad commit
Config & Remote
git config --global user.email "you@x.com"set email
git config --global core.autocrlf inputLF endings
git config --list --show-originall config + source
git remote -vshow remotes
git remote add upstream URLadd upstream
git remote set-url origin NEW_URLchange remote URL
git clone --depth 1 URLshallow clone
git submodule update --init --recursiveinit submodules
git tag v1.2.0 -m "Release"create annotated tag
git push origin --tagspush all tags
git ls-files --others --exclude-standarduntracked files
git shortlog -sncommit count by author
git blame -L 10,20 file.javawho changed lines 10-20
MSSQL Admin Queries
Server & DB Info
SELECT @@VERSION, @@SERVERNAME, @@SERVICENAMEversion info
SELECT name,state_desc,recovery_model_desc FROM sys.databases ORDER BY nameall databases
SELECT * FROM sys.dm_server_servicesSQL services status
EXEC sp_configure 'show advanced options',1;RECONFIGURE;EXEC sp_configureall config
SELECT physical_memory_in_use_kb/1024 AS MemMB FROM sys.dm_os_process_memorySQL RAM use
SELECT * FROM sys.dm_os_sys_infoCPU, RAM, scheduler
Active Sessions & Blocking
SELECT session_id,status,login_name,host_name,program_name,cpu_time,logical_reads FROM sys.dm_exec_sessions WHERE is_user_process=1active sessions
SELECT r.session_id,r.wait_type,r.wait_time/1000 WaitSec,SUBSTRING(t.text,r.statement_start_offset/2+1,120) SQL FROM sys.dm_exec_requests r OUTER APPLY sys.dm_exec_sql_text(r.sql_handle) trunning queries
SELECT blocking_session_id,session_id,wait_type,wait_time FROM sys.dm_exec_requests WHERE blocking_session_id>0blocked queries
KILL 55!kill session 55
SELECT TOP 10 wait_type,wait_time_ms FROM sys.dm_os_wait_stats WHERE wait_type NOT LIKE 'SLEEP%' ORDER BY wait_time_ms DESCtop waits
Table & Schema Info
SELECT TABLE_NAME,TABLE_TYPE FROM INFORMATION_SCHEMA.TABLES ORDER BY TABLE_NAMEall tables/views
EXEC sp_help 'dbo.Orders'table details
EXEC sp_columns 'Orders'column info
SELECT COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH,IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Orders'column types
SELECT * FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTSall FK constraints
SELECT i.name,i.type_desc,c.name AS col FROM sys.indexes i JOIN sys.index_columns ic ON i.object_id=ic.object_id JOIN sys.columns c ON ic.object_id=c.object_id AND ic.column_id=c.column_id WHERE OBJECT_NAME(i.object_id)='Orders'table indexes
SELECT OBJECT_NAME(object_id),definition FROM sys.sql_modules WHERE OBJECT_NAME(object_id) IS NOT NULLall sproc/view defs
Backup & Restore
BACKUP DATABASE MyDB TO DISK='C:\bak\db.bak' WITH COMPRESSION,STATS=10full backup
BACKUP LOG MyDB TO DISK='C:\bak\db_log.bak' WITH COMPRESSIONlog backup
RESTORE DATABASE MyDB FROM DISK='C:\bak\db.bak' WITH REPLACE,RECOVERY,STATS=10restore
RESTORE VERIFYONLY FROM DISK='C:\bak\db.bak'verify backup
SELECT database_name,backup_start_date,type,compressed_backup_size/1048576 AS SizeMB FROM msdb.dbo.backupset ORDER BY backup_start_date DESCbackup history
DBCC CHECKDB('MyDB') WITH NO_INFOMSGSintegrity check
Performance & Index
SELECT TOP 10 qs.total_elapsed_time/qs.execution_count avg_ms,SUBSTRING(qt.text,1,100) sql_text FROM sys.dm_exec_query_stats qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) qt ORDER BY avg_ms DESCslow queries
SELECT OBJECT_NAME(i.object_id) tbl,i.name,ips.avg_fragmentation_in_percent frag FROM sys.dm_db_index_physical_stats(DB_ID(),NULL,NULL,NULL,'LIMITED') ips JOIN sys.indexes i ON ips.object_id=i.object_id ORDER BY frag DESCfragmented indexes
ALTER INDEX ALL ON dbo.Orders REBUILDrebuild all indexes
ALTER INDEX IX_Orders ON dbo.Orders REORGANIZEreorganize index
UPDATE STATISTICS dbo.Orders WITH FULLSCANupdate stats
SELECT * FROM sys.dm_db_missing_index_details ORDER BY equality_columnsmissing indexes
Users & Security
SELECT name,type_desc,is_disabled FROM sys.server_principals ORDER BY type_descall logins
SELECT dp.name,dp.type_desc,o.name obj FROM sys.database_permissions p JOIN sys.database_principals dp ON p.grantee_principal_id=dp.principal_id LEFT JOIN sys.objects o ON p.major_id=o.object_idpermissions
EXEC sp_helprolememberrole members
CREATE LOGIN appuser WITH PASSWORD='P@ss!'add login
ALTER LOGIN sa WITH PASSWORD='New!Pass'; ALTER LOGIN sa ENABLEfix sa
EXEC sp_addrolemember 'db_datareader','appuser'grant read role
MSSQL — BA & Support Queries
Data Exploration
SELECT COUNT(*) FROM Ordersrow count
SELECT TOP 100 * FROM Orders ORDER BY created_date DESClatest 100 rows
SELECT MIN(created_date),MAX(created_date),COUNT(*) FROM Ordersdate range + count
SELECT COLUMN_NAME,DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='Orders'schema of table
SELECT * FROM Orders WHERE created_date >= DATEADD(DAY,-7,GETDATE())last 7 days
SELECT * FROM Orders WHERE order_id IN (101,102,103)specific IDs
SELECT DISTINCT status FROM Ordersdistinct values
SELECT status,COUNT(*) cnt FROM Orders GROUP BY status ORDER BY cnt DESCcounts by status
Aggregates & Trends
SELECT CAST(created_date AS DATE) dt,COUNT(*) cnt,SUM(amount) total FROM Orders GROUP BY CAST(created_date AS DATE) ORDER BY dt DESCdaily totals
SELECT YEAR(created_date) yr,MONTH(created_date) mo,COUNT(*) cnt FROM Orders GROUP BY YEAR(created_date),MONTH(created_date) ORDER BY yr,momonthly trend
SELECT TOP 10 customer_id,COUNT(*) orders,SUM(amount) revenue FROM Orders GROUP BY customer_id ORDER BY revenue DESCtop customers
SELECT AVG(amount) avg,STDEV(amount) stdev,MIN(amount) min,MAX(amount) max FROM Orders WHERE status='COMPLETE'stats
SELECT status,COUNT(*)*100.0/SUM(COUNT(*)) OVER() pct FROM Orders GROUP BY status% breakdown
Joins & Lookups
SELECT o.*,c.name,c.email FROM Orders o JOIN Customers c ON o.customer_id=c.id WHERE o.status='FAILED'failed orders+customer
SELECT o.order_id,p.name product,oi.qty,oi.price FROM Orders o JOIN OrderItems oi ON o.id=oi.order_id JOIN Products p ON oi.product_id=p.id WHERE o.order_id=12345order detail
SELECT c.name,c.email FROM Customers c WHERE NOT EXISTS (SELECT 1 FROM Orders o WHERE o.customer_id=c.id)never ordered
SELECT * FROM Orders o LEFT JOIN Payments p ON o.id=p.order_id WHERE p.id IS NULLunpaid orders
SELECT a.*,b.* FROM Orders a JOIN Orders b ON a.customer_id=b.customer_id AND a.id<b.id AND DATEDIFF(MINUTE,a.created_date,b.created_date)<5duplicate orders
Audit & Troubleshoot
SELECT * FROM Orders WHERE updated_date >= DATEADD(MINUTE,-30,GETDATE()) ORDER BY updated_date DESCchanged last 30 min
SELECT * FROM AuditLog WHERE entity_id=12345 ORDER BY created_date DESCaudit trail
SELECT * FROM Orders WHERE amount != expected_amountamount mismatch
SELECT COUNT(*),status FROM Orders WHERE created_date = CAST(GETDATE() AS DATE) GROUP BY statustoday by status
SELECT * FROM ErrorLog WHERE created_date >= DATEADD(HOUR,-1,GETDATE()) ORDER BY created_date DESCrecent errors
SELECT a.id,a.status old_status,b.status new_status,b.updated_date FROM Orders a JOIN OrderHistory b ON a.id=b.order_id WHERE b.updated_date >= DATEADD(DAY,-1,GETDATE())status changes
SELECT @@ROWCOUNTrows affected last stmt
DBCC INPUTBUFFER(55)last stmt of session 55
Window Functions (BA)
SELECT *,ROW_NUMBER() OVER(PARTITION BY customer_id ORDER BY created_date) rn FROM Ordersrank per customer
SELECT *,LAG(amount) OVER(ORDER BY created_date) prev_amt FROM Ordersprevious row value
SELECT *,SUM(amount) OVER(ORDER BY created_date ROWS UNBOUNDED PRECEDING) running_total FROM Ordersrunning total
SELECT customer_id,amount,NTILE(4) OVER(ORDER BY amount) quartile FROM Ordersquartile bucketing
SELECT *,FIRST_VALUE(amount) OVER(PARTITION BY customer_id ORDER BY created_date) first_order FROM Ordersfirst order amount
JBoss / WildFly
Start / Stop / Status
bin\standalone.bat -c standalone.xmlstart standalone
bin\standalone.bat -c standalone-full.xml -b 0.0.0.0bind all interfaces
bin\domain.batstart domain mode
bin\jboss-cli.bat --connect :shutdowngraceful stop
bin\jboss-cli.bat --connect :shutdown(restart=true)restart server
net stop "JBoss AS" && net start "JBoss AS"Windows service restart
bin\jboss-cli.bat --connect :read-attribute(name=server-state)check state
JBoss CLI — Deploy
bin\jboss-cli.bat --connectopen CLI shell
deploy C:\apps\myapp.wardeploy WAR
deploy C:\apps\myapp.war --forceredeploy (hot)
undeploy myapp.warundeploy app
undeploy myapp.war --keep-contentundeploy, keep file
deployment-infolist all deployments
ls deploymentdeployments list
deploy --url=http://nexus/app.wardeploy from URL
CLI — Datasources & Config
ls /subsystem=datasources/data-sourcelist datasources
/subsystem=datasources/data-source=MyDS:test-connection-in-pooltest DB conn
/subsystem=datasources/data-source=MyDS:read-resourceDS config
/subsystem=datasources/data-source=MyDS:write-attribute(name=max-pool-size,value=30)set pool size
/subsystem=logging/root-logger=ROOT:read-attribute(name=level)get log level
/subsystem=logging/root-logger=ROOT:write-attribute(name=level,value=DEBUG)set DEBUG live
/subsystem=logging/logger=com.myapp:add(level=TRACE)add logger
:read-attribute(name=release-version)WildFly version
Logs & Monitoring
tail -f standalone\log\server.logtail log (WSL)
Get-Content standalone\log\server.log -Tail 200 -Waittail log (PS)
findstr /i "ERROR WARN FATAL" standalone\log\server.logerrors in log
/core-service=management/access=identity:read-resourcemanagement identity
/subsystem=undertow/server=default-server:read-resource(recursive=true)web config
:read-operation-description(name=shutdown)help on operation
JVM & Thread Dump
jps -lv | findstr jbossfind JBoss PID
jstack PID > C:\thread-dump.txtthread dump
jmap -heap PIDheap summary
jmap -histo:live PID | head -30object histogram
jcmd PID GC.runtrigger GC
jcmd PID VM.flagsJVM flags in use
set JAVA_OPTS=-Xms512m -Xmx2g -XX:+HeapDumpOnOutOfMemoryErrorset JVM opts
AWS CLI
Setup & Auth
aws configureset key/secret/region
aws configure listshow current config
aws configure --profile prodnamed profile
aws sts get-caller-identitywho am I
export AWS_PROFILE=produse profile
aws sso login --profile prodSSO login
EC2
aws ec2 describe-instances --query "Reservations[*].Instances[*].[InstanceId,State.Name,PublicIpAddress,Tags[?Key=='Name'].Value|[0]]" --output tableall instances
aws ec2 start-instances --instance-ids i-0abc123start instance
aws ec2 stop-instances --instance-ids i-0abc123stop instance
aws ec2 reboot-instances --instance-ids i-0abc123reboot
aws ec2 describe-instance-status --instance-ids i-0abc123health check
aws ec2 get-console-output --instance-id i-0abc123console log
aws ec2 describe-security-groups --group-ids sg-0abcSG rules
aws ec2 create-tags --resources i-0abc --tags Key=Env,Value=prodadd tag
S3
aws s3 ls s3://my-bucket/list bucket
aws s3 ls s3://my-bucket/ --recursive --human-readable --summarizesize summary
aws s3 cp file.zip s3://my-bucket/folder/upload file
aws s3 cp s3://my-bucket/file.zip ./download file
aws s3 sync ./local s3://my-bucket/dest --deletesync folder
aws s3 rm s3://my-bucket/file.txt!delete file
aws s3 presign s3://my-bucket/file.zip --expires-in 3600signed URL 1hr
aws s3api get-bucket-policy --bucket my-bucketbucket policy
ECS / ECR
aws ecs list-clusterslist clusters
aws ecs list-services --cluster my-clusterlist services
aws ecs describe-services --cluster c --services sservice status
aws ecs update-service --cluster c --service s --force-new-deploymentforce redeploy
aws ecs list-tasks --cluster c --service-name srunning tasks
aws ecs describe-tasks --cluster c --tasks TASK_ARNtask details
aws ecr get-login-password | docker login --username AWS --password-stdin ACCOUNT.dkr.ecr.REGION.amazonaws.comECR login
aws ecr list-images --repository-name my-repolist ECR images
CloudWatch & Logs
aws logs describe-log-groupslist log groups
aws logs tail /ecs/my-app --followlive tail logs
aws logs filter-log-events --log-group-name /ecs/my-app --filter-pattern "ERROR"filter logs
aws cloudwatch get-metric-statistics --namespace AWS/EC2 --metric-name CPUUtilization --dimensions Name=InstanceId,Value=i-0abc --start-time 2026-01-01T00:00:00 --end-time 2026-01-01T01:00:00 --period 300 --statistics AverageCPU metric
aws cloudwatch describe-alarms --alarm-names "MyAlarm"check alarm
aws cloudwatch set-alarm-state --alarm-name x --state-value OK --state-reason "manual reset"reset alarm
SSM & Misc
aws ssm start-session --target i-0abc123SSH-less shell
aws ssm get-parameter --name "/app/db_password" --with-decryptionget secret param
aws ssm put-parameter --name "/app/key" --value "val" --type SecureString --overwriteset param
aws elb describe-load-balancerslist ELBs
aws rds describe-db-instances --query 'DBInstances[*].[DBInstanceIdentifier,DBInstanceStatus,Endpoint.Address]' --output tableRDS list
aws rds reboot-db-instance --db-instance-identifier mydbreboot RDS
aws lambda list-functions --query 'Functions[*].[FunctionName,Runtime,LastModified]' --output tablelambdas
aws lambda invoke --function-name MyFn --payload '{}' out.jsoninvoke lambda
TeamCity
REST API — Builds
GET /app/rest/builds?locator=project:MyProj,count:10last 10 builds
GET /app/rest/builds/id:12345build details
GET /app/rest/builds/id:12345/artifacts/childrenbuild artifacts
GET /app/rest/buildTypes?locator=project:MyProjlist build configs
POST /app/rest/buildQueue -d '{"buildType":{"id":"MyProj_Build"}}'trigger build
GET /app/rest/buildQueuequeued builds
DELETE /app/rest/builds/id:12345!delete build
REST API — Agents & Projects
GET /app/rest/agents?locator=authorized:trueauthorized agents
GET /app/rest/agents/id:1agent details
PUT /app/rest/agents/id:1/enabled -d 'true'enable agent
GET /app/rest/projectsall projects
GET /app/rest/projects/id:MyProj/parametersproject params
PowerShell — TeamCity
$headers = @{Authorization="Bearer TOKEN"; Accept="application/json"}auth header
Invoke-RestMethod -Uri "$tc/app/rest/builds?locator=buildType:$btId,count:1" -Headers $headerslatest build
Invoke-RestMethod -Uri "$tc/app/rest/buildQueue" -Method POST -Headers $headers -Body '{"buildType":{"id":"X"}}' -ContentType "application/json"trigger build
$b = Invoke-RestMethod "$tc/app/rest/builds/id:$id" -Headers $headers; $b.statuscheck status
Build Log & Agent Cmds
GET /app/rest/builds/id:12345/logdownload build log
GET /app/rest/builds?locator=status:FAILURE,count:20recent failures
GET /app/rest/testOccurrences?locator=build:id:12345,status:FAILUREfailed tests
echo ##teamcity[buildStatus status='FAILURE' text='Deploy failed']fail build from script
echo ##teamcity[setParameter name='env.VERSION' value='1.2.3']set TC param
echo ##teamcity[publishArtifacts 'dist/** => artifacts.zip']publish artifact
IIS
appcmd — Sites & Apps
%windir%\system32\inetsrv\appcmd list sitelist all sites
appcmd list applist all apps
appcmd list apppoollist app pools
appcmd start site /site.name:"MyApp"start site
appcmd stop site /site.name:"MyApp"stop site
appcmd start apppool /apppool.name:"MyPool"start pool
appcmd stop apppool /apppool.name:"MyPool"stop pool
appcmd recycle apppool /apppool.name:"MyPool"recycle pool
PowerShell — IIS (WebAdministration)
Import-Module WebAdministrationload IIS module
Get-Websiteall websites
Get-WebAppPoolState -Name "MyPool"pool state
Start-WebAppPool -Name "MyPool"start pool
Stop-WebAppPool -Name "MyPool"stop pool
Restart-WebAppPool -Name "MyPool"recycle pool
Get-WebConfiguration "system.webServer/defaultDocument/files/*" -PSPath "IIS:\Sites\MyApp"default docs
Set-ItemProperty "IIS:\AppPools\MyPool" managedRuntimeVersion ""set no managed code
New-Website -Name "NewSite" -PhysicalPath "C:\www\newsite" -Port 8090create site
Remove-Website -Name "OldSite"delete site
IIS Logs & Misc
Get-Content C:\inetpub\logs\LogFiles\W3SVC1\*.log -Tail 100recent IIS log
Select-String -Path "C:\inetpub\logs\**\*.log" -Pattern "500\|404"find errors
iisreset /noforcerestart IIS gracefully
iisreset /stop && iisreset /startfull IIS restart
appcmd list config "MyApp/" /section:requestFilteringrequest filtering
netsh http show servicestateHTTP.sys sessions
netsh http show urlaclURL reservations
Networking
Diagnostics
ping -t hostcontinuous ping
ping -n 5 -l 1500 host5 pings, 1500B
tracert -d hosttraceroute no DNS
pathping -n hosttracert + packet loss
nslookup host 8.8.8.8DNS via Google
nslookup -type=MX domain.comMX records
Resolve-DnsName -Name host -Type ADNS (PS)
Test-NetConnection host -Port 443test HTTPS port
netstat -ano | findstr :443who uses 443
netstat -rnrouting table
Port & Connection
netstat -ano | findstr ESTABLISHEDactive connections
netstat -ano | findstr LISTENINGlistening ports
Get-NetTCPConnection -State Listen | Sort LocalPortlistening (PS)
Get-Process -Id (Get-NetTCPConnection -LocalPort 8080).OwningProcessprocess on port 8080
netsh int tcp show globalTCP global settings
netsh int tcp set global chimney=disableddisable chimney
netsh http add urlacl url=http://+:8080/ user=Everyonereserve URL
curl -I --max-time 5 http://host:8080/healthHTTP headers
curl -v --cacert cert.pem https://host/apiHTTPS with cert
curl -u user:pass -X POST -d @body.json -H "Content-Type: application/json" http://apiPOST with auth
Proxy & DNS
netsh winhttp show proxysystem proxy
netsh winhttp set proxy proxy-server:8080 bypass-list="*.local"set proxy
netsh winhttp reset proxyclear proxy
ipconfig /displaydnsDNS cache
ipconfig /flushdnsflush DNS cache
Get-DnsClientCacheDNS cache (PS)
notepad C:\Windows\System32\drivers\etc\hostsedit hosts file
Docker
Images
docker imageslist images
docker pull nginx:latestpull image
docker build -t myapp:1.0 .build image
docker build --no-cache -t myapp:1.0 .build no cache
docker tag myapp:1.0 registry/myapp:1.0tag image
docker push registry/myapp:1.0push image
docker rmi myapp:1.0remove image
docker image prune -a!remove all unused
docker save myapp:1.0 | gzip > myapp.tar.gzexport image
docker load < myapp.tar.gzimport image
Containers
docker psrunning containers
docker ps -aall containers
docker run -d -p 8080:8080 --name myapp myapp:1.0run detached
docker run -it --rm -e ENV=prod myapp:1.0 bashinteractive, auto-rm
docker run -v C:\data:/data myapp:1.0volume mount
docker stop myapp && docker rm myappstop + remove
docker restart myapprestart container
docker exec -it myapp bashshell inside
docker exec myapp cat /app/config.ymlread file inside
docker inspect myappfull container info
docker stats --no-streamCPU/RAM snapshot
docker logs -f --tail 100 myapptail logs
docker cp myapp:/app/log.txt ./copy from container
Docker Compose
docker compose up -dstart all services
docker compose up -d --buildrebuild + start
docker compose downstop + remove
docker compose down -v!stop + remove + volumes
docker compose psservice status
docker compose logs -f apptail service logs
docker compose restart apprestart one service
docker compose exec app bashshell in service
docker compose pullpull latest images
docker compose configvalidate compose file
Cleanup & Network
docker system prune -fremove stopped/dangling
docker system dfdisk usage
docker network lslist networks
docker network inspect bridgeinspect network
docker network create mynetcreate network
docker volume lslist volumes
docker volume inspect myvolvolume details
Java / JVM
JVM Diagnostics
jps -lvlist java processes
jstack PID > dump.txtthread dump to file
jstack -l PID | findstr "BLOCKED\|WAITING"find blocked threads
jmap -heap PIDheap summary
jmap -histo:live PID | moreobject histogram
jmap -dump:format=b,file=heap.hprof PIDheap dump
jcmd PID VM.flagsactive JVM flags
jcmd PID GC.heap_infoheap info
jcmd PID GC.runtrigger GC
jcmd PID Thread.printthread dump via jcmd
java -XX:+PrintFlagsFinal -version | findstr HeapSizedefault heap size
JVM Options (JAVA_OPTS)
-Xms512m -Xmx4gmin/max heap
-XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512mmetaspace
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\dumpsauto heap dump OOM
-XX:+UseG1GCuse G1 GC
-XX:+UseZGCuse ZGC (Java 15+)
-verbose:gc -Xlog:gc*:file=gc.logGC logging
-Dspring.profiles.active=prodSpring profile
-Dfile.encoding=UTF-8encoding
-Djava.io.tmpdir=C:\tmptemp dir
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005remote debug
Maven / Gradle
mvn clean package -DskipTestsbuild skip tests
mvn clean install -Pproductionbuild profile
mvn dependency:treedep tree
mvn versions:display-dependency-updatesoutdated deps
mvn -pl module -am installbuild module+deps
./gradlew clean buildgradle build
./gradlew dependenciesdep report
./gradlew bootRunrun Spring Boot
./gradlew test --tests "com.app.MyTest"run one test
SSL / Certificates
certutil (Windows)
certutil -store Mypersonal cert store
certutil -viewstore -enterprise Roottrusted root store
certutil -addstore "Root" cert.cerADMINinstall root cert
certutil -delstore "My" "Thumbprint"remove cert
certutil -p password -importpfx cert.pfximport PFX
certutil -exportPFX -p "pass" My "thumbprint" out.pfxexport PFX
certutil -decode in.cer out.derPEM to DER
certutil -hashfile file.zip SHA256file hash
OpenSSL
openssl s_client -connect host:443 -servername hostinspect cert
openssl x509 -in cert.pem -noout -textdecode cert
openssl x509 -in cert.pem -noout -datesexpiry dates
openssl verify -CAfile ca.pem cert.pemverify cert chain
openssl pkcs12 -in cert.pfx -out cert.pem -nodesPFX to PEM
openssl req -newkey rsa:2048 -keyout key.pem -out csr.pem -nodesgen CSR
openssl rsa -in key.pem -checkvalidate private key
echo | openssl s_client -connect host:443 2>&1 | openssl x509 -noout -enddatecert expiry 1-liner
Java Keystore (keytool)
keytool -list -v -keystore keystore.jks -storepass changeitlist certs
keytool -import -alias myca -file ca.cer -keystore cacerts -storepass changeittrust cert
keytool -delete -alias myca -keystore cacerts -storepass changeitremove cert
keytool -exportcert -alias myalias -file out.cer -keystore keystore.jks -storepass changeitexport cert
keytool -importkeystore -srckeystore cert.pfx -srcstoretype pkcs12 -destkeystore ks.jksPFX to JKS
Windows Services
sc.exe
sc query type= all state= allall services
sc query ServiceNameservice status
sc start ServiceNamestart
sc stop ServiceNamestop
sc config ServiceName start= autoset auto-start
sc config ServiceName start= disableddisable
sc create "MySvc" binPath= "C:\app\svc.exe" start= autocreate service
sc delete "MySvc"!delete service
sc failure ServiceName reset= 86400 actions= restart/5000auto-restart on fail
sc qfailure ServiceNamequery failure actions
net / PS
net start ServiceNamestart service
net stop ServiceNamestop service
Get-Service -Name *sql* | Format-Table Name,Status,StartTypefind SQL services
Get-Service | Where-Object {$_.Status -eq 'Stopped' -and $_.StartType -eq 'Automatic'}stopped auto-services
Set-Service -Name Svc -StartupType Automatic -Status Runningstart + auto
New-Service -Name "MySvc" -BinaryPathName "C:\svc.exe" -StartupType Automaticcreate service
Event Logs
wevtutil
wevtutil ellist all log names
wevtutil qe Application /c:50 /f:textlast 50 app events
wevtutil qe System /q:"*[System[Level=2]]" /c:20 /f:textsystem errors
wevtutil qe Security /q:"*[System[EventID=4625]]" /c:10 /f:textfailed logins
wevtutil cl Application!clear app log
wevtutil epl Application C:\backup\app.evtxexport to file
Get-WinEvent (PS)
Get-WinEvent -LogName Application -MaxEvents 100 | Where-Object {$_.Level -le 2}errors + critical
Get-WinEvent -LogName System | Where-Object {$_.Id -eq 7034}service crash events
Get-WinEvent -FilterHashtable @{LogName='Application';Level=2;StartTime=(Get-Date).AddHours(-1)}errors last hour
Get-WinEvent -LogName Application | Where-Object {$_.Message -like '*OutOfMemory*'} | Select -First 5OOM events
Get-WinEvent -ListLog * | Where-Object {$_.IsEnabled -and $_.RecordCount -gt 0} | Sort RecordCount -Desc | Select -First 10busiest logs
Disk / File Operations
Robocopy
robocopy src dst /MIR /LOG:rob.log /NP /R:3 /W:5mirror (sync)
robocopy src dst /E /XO /LOG+:rob.logcopy, skip older
robocopy src dst /E /MT:88 threads parallel
robocopy src dst /Ldry-run (list only)
robocopy src dst *.log /MOVEmove log files
robocopy src dst /XF *.tmp /XD .gitexclude files/dirs
robocopy src dst /MINAGE:7files older than 7 days
Disk & Space
wmic logicaldisk get caption,size,freespacedisk space all drives
Get-PSDrive -PSProvider FileSystem | Select Name,Used,Free | Format-Table -AutoSizedisk (PS)
Get-ChildItem -Path C:\ -Recurse -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum | Select -ExpandProperty Sumfolder size
diskpartinteractive disk mgr
chkdsk C: /f /r /xcheck + fix disk
fsutil volume diskfree C:disk free space
compact /c /s /i C:\folderNTFS compress folder
Registry
reg commands
reg query HKLM\SOFTWARE\Javaquery key
reg query HKLM\SOFTWARE\Java /srecursive query
reg query HKLM /f "jboss" /t REG_SZ /ssearch value
reg add HKLM\SOFTWARE\App /v Setting /t REG_SZ /d "value" /fadd/set value
reg add HKLM\SOFTWARE\App /v Count /t REG_DWORD /d 10 /fadd DWORD
reg delete HKLM\SOFTWARE\App /v Setting /f!delete value
reg delete HKLM\SOFTWARE\OldApp /f!delete key
reg export HKLM\SOFTWARE\App C:\backup.regexport key
reg import C:\backup.regrestore from backup
reg compare HKLM\App1 HKLM\App2 /scompare keys
Task Scheduler
schtasks
schtasks /query /fo table /vlist all tasks verbose
schtasks /query /tn "\MyApp\Cleanup"specific task
schtasks /run /tn "\MyApp\Cleanup"run now
schtasks /end /tn "\MyApp\Cleanup"stop running task
schtasks /create /tn "DailyBackup" /tr "C:\bak.bat" /sc daily /st 02:00 /ru SYSTEMdaily 2am
schtasks /create /tn "OnBoot" /tr "C:\start.bat" /sc onstart /ru SYSTEM /rl HIGHESTon system start
schtasks /delete /tn "\MyApp\Cleanup" /f!delete task
schtasks /change /tn "\MyApp\Cleanup" /enableenable task
schtasks /change /tn "\MyApp\Cleanup" /disabledisable task
Get-ScheduledTask | Where-Object {$_.State -eq 'Running'}running tasks (PS)
WSL / Linux Essentials
WSL Management
wsl --list --verboselist distros + state
wsl --set-default Ubuntu-22.04set default distro
wsl --shutdownstop all WSL
wsl -d Ubuntu-22.04open specific distro
wsl --export Ubuntu-22.04 C:\backup.tarbackup WSL
wsl --import Ubuntu-Restore C:\wsl C:\backup.tarrestore WSL
wsl --updateupdate WSL kernel
Linux Commands
ls -lah --sort=time | head -2020 newest files
find / -name "*.log" -newer /tmp/ref -type f 2>/dev/nullrecently changed logs
grep -r --include="*.java" "NullPointer" /opt/appgrep in code
tail -f /opt/jboss/standalone/log/server.log | grep -E "ERROR|WARN"filtered log tail
ps aux --sort=-%cpu | head -10top CPU processes
ps aux --sort=-%mem | head -10top RAM processes
kill -9 PIDforce kill
df -hdisk space
du -sh /opt/jboss/*folder sizes
free -hmemory usage
top -bn1 | head -20snapshot CPU/RAM
netstat -tlnplistening ports + PIDs
ss -tlnplistening ports (modern)
curl -s http://localhost:8080/health | python3 -m json.toolpretty JSON
chmod +x script.sh && ./script.shmake executable + run
crontab -llist cron jobs
journalctl -u myservice -fservice logs live
systemctl status myserviceservice status
systemctl restart myservicerestart service
tar -czvf archive.tar.gz /opt/appcompress folder
tar -xzvf archive.tar.gz -C /opt/extract