Linux Command Cheat Sheet
A simple, searchable quick reference for the most-used Linux & Bash commands. Click any command to copy it.
Navigating the Filesystem
- Print the current working directory
- List files in the current directory
- List all files (incl. hidden) with details
- Change into a directory
- Go up one directory
- Go to your home directory
- Go back to the previous directory
- Show directory structure as a tree
Files & Directories
- Create an empty file
- Create a directory
- Create nested directories
- Copy a file
- Copy a directory recursively
- Move or rename a file
- Delete a file
- Delete a directory and its contents
- Force-delete recursively (be careful)
- Remove an empty directory
- Create a symbolic link
Viewing & Editing Files
- Print the whole file
- Scroll through a file (q to quit)
- Show the first 10 lines
- Show the first 20 lines
- Show the last 10 lines
- Follow a file as it grows (logs)
- Edit a file in the nano editor
- Count the number of lines
- Show differences between two files
Searching
- Search for text in a file
- Search recursively in a directory
- Case-insensitive search
- Show matching line numbers
- Find files by name pattern
- Find directories only
- Find files larger than 10 MB
- Show the path of a command
- Quickly find a file by name (indexed)
Permissions & Ownership
- Make a file executable
- Set rwxr-xr-x permissions
- Set permissions recursively
- Change a file's owner
- Change owner and group
- Run a command as the superuser
- Show the default permission mask
Processes & Jobs
- List all running processes
- Live view of processes & resources
- Interactive process viewer (if installed)
- Terminate a process by ID
- Force-kill a process
- Kill all processes by name
- Run a command in the background
- List background jobs
- Bring a background job to the foreground
- Stop the current foreground process
- Suspend the current process
System Info
- Show kernel and system info
- Show disk space usage
- Show total size of a directory
- Show memory usage
- Show how long the system has run
- Show the current user
- Show the current date and time
- Show your command history
Networking
- Test connectivity to a host
- Fetch a URL from the terminal
- Download a file to the current dir
- Download a file
- Show network interfaces & IP addresses
- List listening ports & sockets
- Connect to a remote machine
- Copy a file over SSH
Archives & Packages
- Create a gzipped archive
- Extract a gzipped archive
- Create a zip archive
- Extract a zip archive
- Install a package (Debian/Ubuntu)
- Refresh the package index
- Install a package (Fedora/RHEL)
- Install a package (macOS Homebrew)
Pipes, Redirection & Shortcuts
- Send output to a file (overwrite)
- Append output to a file
- Redirect errors to a file
- Pipe output of cmd1 into cmd2
- Run cmd2 only if cmd1 succeeds
- Run cmd2 only if cmd1 fails
- Repeat the last command
- Repeat the last command as root
- Search command history
- Clear the terminal screen
The Free Linux & Bash Cheat Sheet for Developers
Whether you are managing a server over SSH, scripting a deployment, or just moving files around faster than any mouse could, the Linux command line is the developer's most reliable tool. This cheat sheet gathers the commands you reach for every day — navigating the filesystem, copying and deleting files, setting permissions, managing processes, searching with grep and find, networking, and working with archives — into one searchable page. Type a keyword like “permissions”, “process” or “tar” to filter instantly, then click any command to copy it.
How the Command Line Works
Almost every Linux command follows the same shape: command [options] [arguments]. Once you recognize the pattern, new commands become easy to read.
Command
The program you run, e.g. ls, cp or grep.
Options (flags)
Modify behavior, usually starting with - or --, e.g. -l or --help.
Arguments
What the command acts on, such as a file name or path.
The 10 Linux Commands Worth Learning First
| Command | What it does |
|---|---|
| pwd | Show which directory you are in |
| ls -la | List everything, with details |
| cd dir | Move into a directory |
| cp / mv / rm | Copy, move/rename, and delete files |
| mkdir -p | Create nested directories |
| cat / less | Read the contents of a file |
| grep "x" file | Search for text inside a file |
| chmod +x file | Make a script executable |
| ps aux / top | See what's running |
| sudo cmd | Run a command as the superuser |
Tips for Working Faster in the Terminal
- Press Tab to auto-complete file names and commands — press it twice to see all matches.
- Use Ctrl + R to search your command history instead of retyping long commands.
- Chain commands with && to run the next one only if the previous succeeds.
- Pipe output with |, e.g. ps aux | grep node to filter running processes.
- Run man command to read the full manual for any command.
- Double-check before rm -rf — there is no undo on the command line.
Frequently Asked Questions
What is the Linux command line?
The Linux command line (also called the terminal or shell) is a text interface where you type commands to control your computer instead of clicking through a graphical interface. The most common shell is Bash. It is fast, scriptable, and available on every Linux distribution as well as macOS and WSL on Windows.
How do I list files in a directory?
Use ls to list files in the current directory. Add flags for more detail: ls -l shows a long listing with permissions and sizes, ls -a includes hidden files (those starting with a dot), and ls -la combines both.
How do I change file permissions in Linux?
Use chmod. For example, chmod +x file.sh makes a script executable, and chmod 755 file gives the owner full access and everyone else read and execute. The three-digit number sets read (4), write (2) and execute (1) for owner, group and others.
What is the difference between rm and rm -rf?
rm deletes individual files. rm -r deletes a directory and everything inside it recursively, and rm -rf forces that deletion without prompting. Be extremely careful with rm -rf — there is no recycle bin on the command line, so deleted files are gone immediately.
How do I search for text inside files?
Use grep. grep "error" log.txt prints every line containing 'error'. Add -r to search a whole directory recursively, -i to ignore case, and -n to show line numbers. To find files by name instead of content, use the find command.
Is this Linux cheat sheet free?
Yes. This cheat sheet is completely free, requires no sign-up, and runs entirely in your browser. Search any command and click it to copy it to your clipboard.