This is a practical Linux command cheat sheet: the commands you actually use day to day, grouped by what you are trying to do. Every command here is taught - and can be run - in our free Learn Linux course. Want to try one right now? Open the free online Linux terminal (a real Linux machine in your browser) and type along.
Navigating the file system
pwd- print the directory you are inls -la- list files, including hidden ones, in long formatcd /path- change directory;cd ..goes up,cd ~goes homefind . -name "*.log"- find files by nametree- show the directory tree
Learn these properly in Where am I? pwd and ls and Finding files with find.
Working with files
cat file/less file- show a file;head/tailshow the start/endcp a b,mv a b,rm file- copy, move/rename, deletemkdir dir,touch file- make a directory or an empty filenano file/vim file- edit a file in the terminal
Permissions and ownership
chmod 755 script.sh- set permissions by number (what 644/755/600 mean)chmod +x script.sh- make a file executablechown user:group file- change owner and groupls -l file- read a file's permissions
Text and logs
grep "error" file- find lines matching a pattern (grep lesson)cut,sort,uniq- pull out columns, sort, de-duplicatesed 's/old/new/g' file- find and replaceawk '{print $1}' file- print a column (awk lesson)cmd1 | cmd2- pipe one command's output into another
Processes and the system
ps aux,pgrep name- list / find processestop- watch processes livekill PID,kill -9 PID- stop a processdf -h,du -sh *- disk space free / usedsystemctl status name- check a service
Packages and networking
apt update && apt install pkg- install software (Debian/Ubuntu)ip a,ss -tln- show addresses / listening portscurl -I http://host- fetch HTTP headersping host,dig name- test connectivity / resolve a name
The fastest way to learn these
Reading a cheat sheet is a start, but Linux sticks when you type the commands. Open the online Linux terminal and try them, or follow the free, step-by-step Learn Linux course where every lesson has a hands-on lab on a real Linux machine in your browser.