The most important Linux commands: cheat sheet
In short: An overview of the commands needed most in daily use. With man command or command --help you get the instructions at any time. To try them: Trying out Linux or the “Linux in the browser” tool on the tools page.
Navigation and files
| Command | Purpose |
|---|---|
pwd | show current folder |
ls -la | contents with details and hidden files |
cd folder, cd .., cd ~ | change, up, home |
mkdir -p a/b | create folder |
cp a b, cp -r folder target | copy |
mv a b | move/rename |
rm file, rm -r folder | delete (no recycle bin!) |
touch file | empty file/timestamp |
find . -name "*.txt" | search files |
du -sh folder, df -h | size, free space |
Reading files
cat, less (scroll, q quits), head -n 5, tail -f log (read live), wc -l (count lines), sort, uniq. Searching and replacing: grep, sed and awk.
Permissions and users
chmod +x file, chown user file, sudo command, whoami, id. Background: Users, groups and file permissions.
System and processes
uname -a, uptime, free -h, top, ps aux, kill PID, systemctl status service, journalctl -u service. See Processes and signals and systemd.
Packages
Debian/Ubuntu: sudo apt update && sudo apt upgrade, apt install package. Fedora: dnf install. Arch: pacman -S. See Package management on Linux.
Network
ip a, ping host, ss -tulpn, curl url, ssh user@host, scp file user@host:. See Networking on Linux.
Terminal shortcuts
Tab completes, ↑ last command, Ctrl+R search history, Ctrl+C cancel, Ctrl+L clear, Ctrl+D exit.
Careful
rm -rf and commands with sudo act immediately and without asking. Better to read twice, especially for commands from the internet.
See also: Writing shell scripts, Bash