Linux Cheatsheet

The 30 commands you'll use every day. Press Ctrl+P to print this page.

Navigation

pwdwhere am I
cd dirchange into dir
cd ..up one level
cd ~go home
lslist files
ls -ladetailed list with hidden
treevisual directory tree

File Operations

touch fcreate empty file
mkdir dcreate directory
rm fdelete file (careful)
rm -r ddelete directory tree
mv a bmove or rename
cp a bcopy file
cp -r a bcopy directory

Viewing Files

cat fprint file
less fscrollable pager
head ffirst 10 lines
tail flast 10 lines
tail -f ffollow new lines
wc -l fcount lines

Searching

grep x ffind x in file f
grep -r x .recursive search
find . -name "*.py"find by name
which cmdpath to a command

Permissions

chmod +x fmake executable
chmod 755 frwx r-x r-x
chmod 644 frw- r-- r--

Shell Tricks

cmd > fsave output to file
cmd >> fappend output
cmd1 | cmd2pipe output to next
historycommand history
clearclear screen
man cmdmanual page

System & Network

whoamicurrent user
uname -akernel info
ps auxall processes
toplive process view
kill pidstop a process
df -hdisk free
free -hmemory usage
ping hosttest connectivity

More detailed explanations on the Commands reference page, or try every one live in LinuxSim.

🐧 Open LinuxSim