You don’t need to be a sysadmin to work comfortably in Linux. But as a developer, knowing the right 20% of commands will save you hours of clicking and debugging.
Let’s cut the fluff. Here are the essential Linux commands I use daily.
Navigation & Inspection
bash
pwd # Where am I?
ls -la # List all files (including hidden) with details
cd project/ # Move into directory
cd .. # Go back one level
cd ~ # Go home
Dev tip: Use ls -la | grep keyword to filter files.File Operations (You’ll use these constantly)
bash
touch index.js # Create empty file
cat file.txt # Print entire file to terminal
head -20 app.log # First 20 lines of log
tail -f app.log # Follow live log output (critical for debugging)
cp -r src/ backup/ # Copy folder recursively
mv oldname.js newname.js # Rename or move
rm file.txt # Delete file (careful!)
rm -rf node_modules/ # Delete folder (double careful!)Process Management
bash
ps aux # List all running processes
ps aux | grep node # Find Node processes
kill -9 1234 # Force kill process with PID 1234
kill -15 1234 # Graceful termination
top # Live system monitor (press q to exit)Permissions (Deployers & DevOps)
bash
chmod +x script.sh # Make script executable
chmod 644 file.txt # rw-r--r-- (owner read/write, others read)
sudo command # Run as superuser (careful!)Finding Stuff
bash
grep "error" app.log # Search inside file
grep -r "TODO" ./src # Search recursively in folder
find . -name "*.js" # Find all JS files
find . -type d -name "models" # Find directory named "models"System Info & Disk
bash
df -h # Disk free (human readable)
du -sh folder/ # Size of folder
free -h # RAM usage
uname -a # Kernel versionNetwork for API Testing
bash
curl https://api.example.com/users # GET request
curl -X POST -d '{"name":"John"}' -H "Content-Type: application/json" \
https://api.example.com/users
ping google.com # Check connectivity
netstat -tulpn # Which ports are listening?The Magic Pipe |
Pipes send output from one command as input to another. This is where Linux becomes powerful.
bash
ls -la | sort -rk5 # Sort files by size (largest first)
ps aux | grep node | wc -l # Count Node processes
history | grep docker # Find a command you ran earlier
One-Liners That Save Hours
bash
Find and delete all node_modules folders (frees tons of space)
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
Find largest files in current directory
du -sh * | sort -h | tail -10
Replace text in all files
find . -name "*.txt" -exec sed -i 's/old/new/g' {} \;
Bonus: Aliases (Your Best Friend)
Create shortcuts by adding to ~/.bashrc or ~/.zshrc:
bash
alias gs="git status"
alias ll="ls -la"
alias please="sudo"
alias ..="cd .."
Then run source ~/.bashrc.
The Golden Rule
Always run ls before rm -rf.
Accidentally deleting the wrong directory is a rite of passage — but an avoidable one.
You don’t need to memorize all flags. Use command --help or man command (e.g., man ls). Knowing 80% of these 20 commands will handle 95% of your terminal work.
What’s your most-used Linux command? Drop it in the comments 👇
Top comments (0)