Back to Cheat Sheets
Linux Shortcuts & Commands
Handy Linux commands and keyboard shortcuts for everyday system management and navigation.
| Action | Command | Details |
|---|---|---|
| List files | ls -la |
List all files including hidden ones with detailed info. |
| Change directory | cd <path> |
Navigate to the specified directory. |
| Current directory | pwd |
Print current working directory path. |
| Create directory | mkdir <name> |
Create a new directory. |
| Remove file | rm <file> |
Delete a file. |
| Remove directory | rm -rf <dir> |
Recursively delete directory and contents. Use cautiously. |
| Copy file | cp src dest |
Copy files or directories. |
| Move file | mv src dest |
Move or rename files and directories. |
| Search text | grep 'text' <file> |
Search for 'text' inside a file. |
| Find file | find . -name <pattern> |
Search files matching a pattern in current directory. |
| System info | uname -a |
Print detailed system info including kernel version. |
| Disk usage | df -h |
Show disk space usage in human-readable format. |
| Memory usage | free -m |
Show RAM and swap usage in megabytes. |
| Process list | ps aux |
List all running processes with details. |
| Kill process | kill -9 <pid> |
Force kill a process by process ID. |
| Network interfaces | ifconfig |
Display network interface info (deprecated, use ip addr). |
| Show open ports | netstat -tuln |
List listening TCP/UDP ports. |
| Change permissions | chmod 755 <file> |
Set file permissions; 755 = owner rwx, others rx. |
| Change ownership | chown user:group <file> |
Change file owner and group. |
| View logs | tail -f /var/log/syslog |
Continuously display new log entries. |
| Edit files | vim <file> |
Open a file in Vim text editor. |
| Command history | history |
Show previously run commands. |
| Repeat last command | !! |
Run the last executed command again. |
| Background job | command & |
Run a command in the background. |
| Bring job to foreground | fg |
Bring background job to foreground. |
| Exit terminal | exit |
Close the terminal session. |