Home Tools Blog About

Linux Commands Cheat Sheet (Bash)

These are the Linux and Bash commands you use most at the terminal, grouped by task. They work on Linux and macOS, and on Windows through WSL or Git Bash.

Files & folders

Command What it does
ls -la List files, including hidden, with details
cd <dir> Change directory
pwd Print the current folder
cp a b Copy a to b
mv a b Move or rename
rm <file> Delete a file (rm -r for folders)
mkdir <dir> Make a folder
touch <file> Create an empty file

View & search

Command What it does
cat <file> Print a file
less <file> Scroll through a file
head / tail <file> First / last lines (tail -f to follow)
grep "x" <file> Find lines matching x
find . -name "*.js" Find files by name
wc -l <file> Count lines

Permissions

Command What it does
chmod 755 <file> Set read/write/execute permissions
chmod +x <file> Make a file executable
chown user:group <file> Change the owner
sudo <cmd> Run a command as administrator

Processes

Command What it does
ps aux List running processes
top / htop Live view of processes
kill <pid> Stop a process by id
kill -9 <pid> Force stop a process
jobs / bg / fg Manage background jobs

System & network

Command What it does
df -h Disk space, human readable
du -sh <dir> Size of a folder
free -h Memory usage
uname -a System information
ping <host> Test a connection
curl <url> Fetch a URL
ssh user@host Connect to a remote server
tar -czf a.tgz <dir> Create a compressed archive

Frequently Asked Questions

What is the difference between Linux and Bash?

Linux is the operating system. Bash is the most common shell, the program that reads and runs the commands you type in the terminal.

How do I make a file executable?

Use chmod with the execute flag, then run it with ./ before the file name.

What does sudo do?

It runs a single command with administrator privileges, which is needed for system-wide changes like installing software.

How do I stop a stuck process?

Find its process id with ps, then use kill. If it ignores that, use kill with the -9 option to force it.

Need to schedule a command to run automatically? See our Crontab Generator.

ATV

Written by Nick (ATV Team)

We build and maintain the 600+ free, client-side tools on this site, and every guide is written against the tools themselves: each figure is computed and checked before it is published, and every linked tool is tested in the browser. More about how we work on the about page, and the full library of guides lives on the blog.