Linux Commands Cheat Sheet
Common Linux commands: file/dir, process, network, permission and monitoring commands with notes, for quick lookup while working.
| Command | Description |
|---|---|
| ls | List directory contents (-l long, -a include hidden) |
| cd | Change directory (cd ~ home) |
| pwd | Print working directory (absolute path) |
| cp | Copy file/dir (-r recursive) |
| mv | Move or rename |
| rm | Remove (-r recursive, -f force) |
| mkdir | Make directory (-p recursive) |
| rmdir | Remove empty directory |
| cat | Print entire file |
| less | Paginated view (scroll up/down) |
| head | Show first lines (-n count) |
| tail | Show last lines (-f follow) |
| grep | Text search (-r recursive, -i ignore case) |
| find | Find files by criteria |
| chmod | Change file permissions (rwx) |
| chown | Change file owner/group |
| ps | List processes (aux full format) |
| top | Real-time process/resource monitor |
| kill | Terminate process (kill -9 force) |
| df | Disk space usage (-h human) |
| du | Directory/file size (-sh summary) |
| free | Memory usage (-h human) |
| uname | Kernel info (-a all) |
| uptime | Uptime and load average |
| tar | Archive/extract (-czf compress, -xzf extract) |
| ssh | Secure remote login |
| scp | Secure remote copy |
| rsync | Incremental file sync |
| curl | Send HTTP request / download |
| wget | Command-line download |
| ss | Show network connections (-tlnp) |
| ping | Test network connectivity |
| ip | Show/configure network interfaces |
| systemctl | Manage system services |
| crontab | Manage scheduled jobs (-e edit) |
| history | Show command history |
Frequently Asked Questions
How do I recursively find a file type?
Use `find . -name "*.log"` to search the current dir and subdirs; add -type f for files only, -mtime -1 for files changed within a day.
How do I watch a log file in real time?
Use `tail -f app.log` to stream new lines; pipe to grep to filter: `tail -f app.log | grep ERROR`.
How do I make a script executable?
Use `chmod +x script.sh` to grant owner execute; for others too use `chmod 755 script.sh`.
How do I keep a process running in the background?
Use `nohup cmd &` to survive hangup, or register a systemd service managed by `systemctl` that auto-restarts on reboot.