Linux / Bash Commands Cheat Sheet

Every terminal command — files, permissions, processes & networking.

A free, searchable Linux & Bash command guide on one long page. Covers navigation, file operations, viewing files, permissions & ownership, environment variables ($PATH, export, .bashrc), process management, search & text processing (grep, pipes, sed), system info & packages, networking (ping, curl, ssh) and archives. Every command has a copy-ready line and a real worked example with terminal output. Includes a quick-reference table for chmod permission codes (what 755 and 644 actually mean). Search “kill process”, “grep” or “chmod” to jump straight to it. Runs fully in your browser, no sign-up, no API.

About Linux / Bash Commands Cheat Sheet

Linux / Bash Commands Cheat Sheet features

Best practices

Terminal habits that save real time

A handful of small habits that add up once they're muscle memory.

Run a command, and if you realise you needed sudo, don't retype it — run sudo !! and Bash re-runs your exact last command with sudo added in front.

Frequently asked questions

How do I see which folder I'm currently in?

Run pwd (print working directory) — it prints the full path of your current location in the terminal.

How do I list files, including hidden ones?

Run ls -la — the -l flag shows a detailed list (permissions, size, date) and -a includes hidden files, which are any file or folder starting with a dot.

What's the difference between rm and rmdir?

rmdir only deletes a folder if it's completely empty. rm -r deletes a folder AND everything inside it, recursively — that's the one you need for a folder with files in it. There is no Recycle Bin, so both are permanent.

How do I make a script file executable?

Run chmod +x filename.sh, then run it with ./filename.sh. The +x flag adds execute permission, which Linux requires before it will run a file as a program.

What does the pipe symbol (|) do in Linux?

It sends the OUTPUT of the command on the left as INPUT into the command on the right — for example ps aux | grep node lists every process, then filters that list for lines containing "node". Chaining commands with pipes is the core idea behind the Linux terminal's power.

How do I search for text inside files?

Use grep — for example grep -rn "TODO" . searches every file from the current folder downward (-r), ignoring case is -i, and shows line numbers with -n.

How do I stop a process that's frozen or stuck?

First find its process ID with ps aux | grep <name>, then run kill <PID> to ask it to stop. If it doesn't respond, force it with kill -9 <PID>.

What is sudo and when do I need it?

sudo (superuser do) runs a single command with administrator privileges. You need it for system-level changes — installing packages, editing protected files, or changing file ownership you don't have permission for.

How do I check how much disk space is free?

Run df -h for overall disk space per drive, or du -sh <folder> to check how much space one specific folder is using. The -h flag shows sizes in human-readable GB/MB instead of raw blocks.

What's the difference between curl and wget?

Both download files from the internet. wget is simpler and better suited to straight file downloads. curl is more flexible — it can send custom headers and POST data, which makes it the standard tool for testing APIs.

How do I extract a .tar.gz file?

Run tar -xzvf archive.tar.gz — x means extract, z means it's gzip-compressed, v shows progress, and f says the filename follows.

How do I connect to a remote Linux server?

Use SSH — ssh username@host-or-ip-address opens an encrypted terminal session on the remote machine, as if you were sitting in front of it.

What does chmod 755 actually mean?

Each digit covers owner, group and others, and is the SUM of read (4), write (2) and execute (1). 7 = 4+2+1 = read+write+execute; 5 = 4+1 = read+execute. So chmod 755 gives the owner full control, and everyone else read + execute only — the standard permission for a script or program others need to run but not edit.

How do I set an environment variable in Linux?

Use export NAME=value — for example export API_KEY=abc123. This lasts for the current terminal session only. To make it permanent, add the same export line to ~/.bashrc (or ~/.zshrc for zsh) and run source ~/.bashrc to load it immediately.

What is the $PATH variable?

$PATH is a colon-separated list of folders the shell searches, in order, whenever you type a command name — it's why running git or ls works without typing their full file location. Add a new folder to it with export PATH=$PATH:/your/folder.

Is this Linux/Bash commands cheat sheet free to use?

Yes — it's 100% free with no sign-up, no login and no limits. Every command, example and the search box work fully in your browser.

Related tools — Guides & Tutorials