Menu

Linux Commands Cheat Sheet

Last updated

Move around and see where you are.

CommandWhat it does
pwdPrint the current directory path
lsList files in the current directory
ls -laList all files (incl. hidden) with details
cd /path/to/dirChange to a directory
cd ..Go up one directory
cd ~Go to your home directory
cd -Go back to the previous directory

File management

Create, copy, move, and delete files and folders.

CommandWhat it does
touch file.txtCreate an empty file
mkdir mydirCreate a directory
mkdir -p a/b/cCreate nested directories
cp src.txt dest.txtCopy a file
cp -r src/ dest/Copy a directory recursively
mv old.txt new.txtMove or rename
rm file.txtDelete a file
rm -rf mydirDelete a directory and its contents

Viewing files

Read file contents in the terminal.

CommandWhat it does
cat file.txtPrint the whole file
less file.txtScroll through a file page by page
head file.txtShow the first 10 lines
head -n 20 file.txtShow the first 20 lines
tail file.txtShow the last 10 lines
tail -f log.txtFollow a file as it grows
wc -l file.txtCount lines in a file

Searching (grep & find)

Search inside files and find files by name.

CommandWhat it does
grep "text" file.txtFind lines matching a pattern
grep -r "text" .Search recursively in a folder
grep -i "text" file.txtCase-insensitive search
grep -n "text" file.txtShow matching line numbers
find . -name "*.js"Find files by name pattern
find . -type dFind directories only
find . -mtime -1Files modified in the last day

Permissions (chmod & chown)

Control who can read, write, and execute.

CommandWhat it does
chmod +x script.shMake a file executable
chmod 755 script.shOwner rwx, group/others rx
chmod 644 file.txtOwner rw, group/others read-only
chmod -R 755 mydirApply recursively to a folder
chown user file.txtChange the owner
chown user:group file.txtChange owner and group
ls -l file.txtView a file's permissions

Process management

See and control running programs.

CommandWhat it does
ps auxList all running processes
topLive view of processes and resources
htopInteractive process viewer
kill <pid>Stop a process by its ID
kill -9 <pid>Force-stop a process
pkill firefoxStop processes by name
jobsList background jobs in the shell
command &Run a command in the background

Networking (curl, wget, ssh, ping)

Make requests and connect to other machines.

CommandWhat it does
curl https://api.example.comFetch a URL and print the response
curl -O <url>Download a file keeping its name
wget <url>Download a file from a URL
ssh user@hostConnect to a remote machine
scp file.txt user@host:/pathCopy a file to a remote host
ping example.comTest connectivity to a host
ip addrShow network interfaces and IPs

Archives & packages (tar & apt)

Bundle files and install software.

CommandWhat it does
tar -czf out.tar.gz mydirCreate a gzipped archive
tar -xzf out.tar.gzExtract a gzipped archive
tar -tzf out.tar.gzList archive contents
zip -r out.zip mydirCreate a zip archive
unzip out.zipExtract a zip archive
sudo apt updateRefresh package lists (Debian/Ubuntu)
sudo apt install pkgInstall a package

The Linux commands you reach for most, on one page. This Linux commands cheat sheet is a quick reference for working in the terminal - navigating the filesystem, managing files, searching, setting permissions, controlling processes, and basic networking.

These commands are standard on bash and zsh, so they work the same on Linux and macOS. Copy what you need, or try them live in the terminal playground - a real shell in your browser, nothing to install.

Linux commands cheat sheet FAQ

Is this Linux commands cheat sheet free?
Yes. This Linux commands cheat sheet is completely free, with no sign-up required. Bookmark it and come back whenever you need to look up a command for files, permissions, or processes.
What does chmod 755 mean?
The three digits set permissions for the owner, the group, and everyone else, using read (4), write (2), and execute (1) added together. 755 means the owner gets read + write + execute (4+2+1=7), while the group and others get read + execute (4+1=5). It is the typical mode for scripts and directories that everyone should be able to run or enter but only the owner should change.
What is sudo and when do I need it?
sudo runs a single command as the superuser (root), which is required for actions that affect the whole system - installing packages, editing system files, or changing ownership outside your home directory. It will usually prompt for your password. Use it only when a command fails with a permission error, and avoid running everything as root.
Can I practice Linux commands online?
Yes. Open the terminal playground to run any command from this cheat sheet in a real shell in your browser - nothing to install. When you want structure, Coddy's free interactive terminal course walks you from navigation to pipes and process control step by step.
Is this cheat sheet good for beginners?
Yes. It is organized from navigation and file management (what you use every day) down to networking and package management, so you can use the top sections immediately and grow into the rest.
Coddy programming languages illustration

Learn Linux Commands with Coddy

GET STARTED