Last updated: April 12, 2026
Linux Commands Cheatsheet
Quick Answer
This cheatsheet covers 40 essential Linux/Unix commands for daily development: file navigation, text processing, permissions, process management, and networking.
Files
| Command | Description |
|---|---|
| ls | List directory contents ls -la |
| ls -la | List all files with details (permissions, size, date) |
| cd <dir> | Change directory cd /var/log |
| pwd | Print current working directory |
| mkdir <dir> | Create a directory mkdir -p src/components |
| cp <src> <dest> | Copy files or directories cp -r src/ backup/ |
| mv <src> <dest> | Move or rename files mv old.txt new.txt |
| rm <file> | Remove files rm -rf node_modules/ |
| touch <file> | Create an empty file or update timestamp touch index.ts |
| find <dir> -name <pattern> | Search for files by name find . -name "*.ts" |
Text
| Command | Description |
|---|---|
| cat <file> | Display file contents cat package.json |
| head -n <N> <file> | Show first N lines of a file head -n 20 app.log |
| tail -n <N> <file> | Show last N lines of a file tail -n 50 app.log |
| tail -f <file> | Follow a file in real-time (live logs) tail -f /var/log/syslog |
| grep <pattern> <file> | Search for a pattern in files grep -r "TODO" src/ |
| grep -r <pattern> <dir> | Recursively search for a pattern in a directory |
| wc -l <file> | Count lines in a file wc -l *.ts |
| sort <file> | Sort lines in a file |
| uniq | Remove duplicate adjacent lines (use with sort) sort file.txt | uniq |
| sed 's/old/new/g' <file> | Find and replace text in a file sed -i 's/foo/bar/g' config.txt |
| awk '{print $1}' <file> | Extract and process columns from text awk -F',' '{print $2}' data.csv |
Permissions
| Command | Description |
|---|---|
| chmod <mode> <file> | Change file permissions chmod 755 script.sh |
| chown <user>:<group> <file> | Change file ownership chown www-data:www-data /var/www |
Processes
| Command | Description |
|---|---|
| ps aux | List all running processes |
| kill <pid> | Send SIGTERM to a process kill 1234 |
| kill -9 <pid> | Force kill a process with SIGKILL |
| top | Interactive process viewer (CPU/memory usage) |
| htop | Improved interactive process viewer |
System
| Command | Description |
|---|---|
| df -h | Show disk usage in human-readable format |
| du -sh <dir> | Show directory size du -sh node_modules/ |
| free -h | Show memory usage |
| uname -a | Show system information (kernel, architecture) |
Archives
| Command | Description |
|---|---|
| tar -czf <archive> <files> | Create a gzipped tar archive tar -czf backup.tar.gz src/ |
| tar -xzf <archive> | Extract a gzipped tar archive tar -xzf backup.tar.gz |
Network
| Command | Description |
|---|---|
| curl <url> | Make HTTP requests curl -s https://api.example.com/data |
| wget <url> | Download files from the web wget https://example.com/file.zip |
| ssh <user>@<host> | Connect to a remote server via SSH ssh deploy@production.example.com |
| scp <src> <user>@<host>:<dest> | Copy files to/from a remote server scp app.zip deploy@server:/opt/ |
| ping <host> | Test network connectivity ping google.com |
| netstat -tlnp | Show listening ports and processes |
Frequently Asked Questions
More Cheatsheets
Git Commands Cheatsheet
This cheatsheet covers the 40 most essential Git commands grouped by workflow: setup, staging, branc...
Docker Commands Cheatsheet
This cheatsheet covers 35 essential Docker commands for managing containers, images, volumes, and ne...
HTTP Status Codes Cheatsheet
HTTP status codes are 3-digit numbers returned by servers. 1xx = informational, 2xx = success, 3xx =...
Regex Syntax Cheatsheet
This cheatsheet covers essential regex syntax: character classes, quantifiers, anchors, groups, and ...