Member-only story
100 Cybersecurity One-Liners (PowerShell, Bash, CMD)
Welcome to the dark arts of the cyber command line!
Below is a curated arsenal of 100 cybersecurity one-liners that are perfect for incident response, threat hunting, enumeration, privilege escalation, or just flexing at your next CTF.
Each one-liner is like a mini-hack spell — quick, precise, and battle-tested.
PowerShell One-Liners
Get-LocalUser | Where-Object {$_.Enabled -eq $true}— List all enabled local users.Get-EventLog -LogName Security -Newest 10— Show the last 10 Security events.Get-Service | Where-Object {$_.Status -eq 'Running'}— List running services.Get-ChildItem -Recurse -Force C:\Users | Where-Object {$_.Attributes -match 'Hidden'}— Find hidden files.Get-Process | Sort CPU -Descending | Select -First 5— Top 5 CPU hogging processes.Get-NetTCPConnection -State Listen— List all listening TCP ports.Test-Connection google.com -Count 3— Quick ping test.Get-WmiObject -Class Win32_Product | Select-Object Name— List installed programs.Get-Command *password*— Find commands related to 'password'.whoami /priv— List current privileges.
Bash One-Liners
whoami && id— Show user and UID info.