Skip to content

Linux Commands

Common and not so commonly known Linux commands.


🧰 Linux vs Windows 11 Command Equivalents

A practical cheat sheet for developers switching between Linux and Windows 11.

# Linux Command Description Windows 11 Native Equivalent
1 !! Repeat last command PowerShell: Invoke-History or Get-History
2 !$ Use last argument PowerShell: $args[-1] (in scripts)
3 ^old^new Replace typo in last command No direct equivalent; manually edit with arrow keys
4 Alt + . Cycle through last arguments PowerShell: Use arrow keys + tab completion
5 xargs Pass output as arguments PowerShell: ForEach-Object or pipeline (|)
6 tee View and save output PowerShell: Tee-Object -FilePath output.txt
7 grep -R "pattern" . Recursive search in files PowerShell: Select-String -Path * -Pattern "TODO" -Recurse
8 fc Edit and rerun last command PowerShell: Get-History + manual edit
9 !!:n Use specific argument from last command PowerShell: Extract from Get-History manually
10 Ctrl + a / Ctrl + e Jump to start/end of line CMD/PowerShell: Home / End keys
11 Ctrl + w / Ctrl + u Delete word or line CMD: Ctrl + Backspace deletes word; no Ctrl + u
12 !!:gs/old/new/ Replace globally in last command PowerShell: $cmd -replace 'old','new'
13 df -h / du -sh * Disk usage PowerShell: Get-PSDrive, Measure-Object
14 lsof -i :<port> See what's using a port PowerShell: Get-NetTCPConnection -LocalPort 8080
15 nc -zv <host> <port> Test if port is open PowerShell: Test-NetConnection -ComputerName google.com -Port 443
16 cd - Go to previous directory PowerShell: Use $pwd to store and switch manually
17 Ctrl + l Clear screen CMD/PowerShell: cls

🧠 Pro Tips for Windows Power Users

  • 🔁 Command recall: Use F7 in CMD to view command history.
  • 🧩 Aliases: PowerShell supports Set-Alias for custom shortcuts.
  • 📜 Scripting: PowerShell scripts can replicate complex Linux workflows.