
Linux Commands Cheat Sheet for Beginners
A Linux commands cheat sheet for beginners with tested examples, a Windows comparison and a free two-page PDF to download.

Linux commands are short instructions you type into a terminal to work with files, programs, networks and the system itself.
A small set of them covers most daily work. This guide lists the ones to learn first, with examples that were run in a real shell.
It also covers the Linux commands list by task, a Windows-to-Linux comparison and a free PDF cheat sheet to keep. Command descriptions follow the Debian manual pages, and I last checked the sources on October 22, 2026.
The short answer
Start with about a dozen commands: pwd, ls, cd, mkdir, cp, mv, rm, cat, grep, find, chmod and man. They let you move around, manage files, search and read documentation.
Learn pipes and redirection next. They let you chain commands, which is where the terminal becomes powerful.
Commands here are for Debian and Ubuntu style systems. Package commands differ on other families, but file and text commands are the same almost everywhere.
Download the cheat sheet
A two-page PDF version of this guide is ready to download. It covers the same commands in compact tables, so you can print it or keep it beside your terminal.
Download the Linux commands cheat sheet PDF. It is free, and it follows the tables below.
How to read a command
Every command follows the same pattern: the command name, then options, then the thing it acts on. Options usually start with a dash.
command [options] [arguments]
ls -l notes
Here ls is the command, -l is an option that asks for a long listing, and notes is the folder to list.
Getting help
You do not need to memorize every option. The manual pages describe each command, and most commands print a short summary with –help.
| Command | What it does |
|---|---|
| man ls | Opens the manual page for ls |
| ls –help | Prints a short usage summary |
| history | Lists the commands you typed earlier |
The manual's own description of man is an interface to the system reference manuals. Press q to leave a manual page.
A practice folder
You can try every command safely in a folder you create. The example below was run in a real shell. Your folder name and prompt will differ.
$ mkdir notes logs
$ ls
logs
notes
$ echo 'buy milk' > notes/todo.txt
$ printf 'pears\napples\nbananas\napples\n' > notes/fruit.txt
$ cat notes/fruit.txt
pears
apples
bananas
apples
The echo and printf commands write text, and the greater-than sign sends it to a file. That sign is redirection, which is covered below.
Linux commands for beginners: moving around
These commands show where you are and let you move. Descriptions follow the manual pages.
| Command | What it does | Example |
|---|---|---|
| pwd | Prints the full name of the current directory | pwd |
| ls | Lists directory contents | ls -l |
| cd | Changes the current directory | cd notes |
| cd .. | Moves up one level | cd .. |
| cd | With no argument, returns to your home directory | cd |
Files and folders
These commands create, copy, move and remove files and folders.
| Command | What it does | Example |
|---|---|---|
| mkdir | Makes directories | mkdir logs |
| touch | Updates file timestamps and creates an empty file if it does not exist | touch new.txt |
| cp | Copies files and directories | cp a.txt b.txt |
| mv | Moves or renames files | mv a.txt logs/ |
| rm | Removes files or directories | rm old.txt |
| rmdir | Removes empty directories | rmdir logs |
| ln | Makes links between files | ln -s target link |
Copying and moving in practice
This session continues the practice folder. The copy is moved into logs, then both folders are listed.
$ cp notes/todo.txt notes/todo-copy.txt
$ mv notes/todo-copy.txt logs/todo-old.txt
$ ls notes logs
logs:
todo-old.txt
notes:
fruit.txt
todo.txt
Be careful with rm
The rm command removes files, and the shell has no recycle bin to restore them from. Check the name before you press Enter, and keep it away from wildcards until you are confident.
Adding -r makes rm remove directories and everything inside them, so avoid it, and avoid sudo rm, until you are comfortable.
Do not run a command copied from the internet until you understand it. This is our advice, and it matters most for rm and anything that begins with sudo.
Viewing files
These commands show what is inside a file.
| Command | What it does | Example |
|---|---|---|
| cat | Prints files to the standard output | cat notes/todo.txt |
| less | Lets you scroll a file one screen at a time | less long.log |
| head | Prints the first lines of a file, 10 by default | head -n 2 file.txt |
| tail | Prints the last lines, 10 by default | tail -n 1 file.txt |
| wc | Counts lines, words and bytes | wc -l file.txt |
$ head -n 2 notes/fruit.txt
pears
apples
$ tail -n 1 notes/fruit.txt
apples
$ wc -l notes/fruit.txt
4 notes/fruit.txt
Searching
The two commands to learn are grep for text inside files and find for files themselves.
| Command | What it does | Example |
|---|---|---|
| grep | Prints lines that match a pattern | grep -n apples file.txt |
| find | Searches for files in a directory tree | find . -name '*.txt' |
$ grep -n apples notes/fruit.txt
2:apples
4:apples
$ grep -c apples notes/fruit.txt
2
$ find . -name '*.txt'
./logs/todo-old.txt
./notes/fruit.txt
./notes/todo.txt
The order find prints results in can differ between systems. Put the pattern in quotes, as shown, so the shell leaves it alone until find receives it.
Sorting and counting
These commands change how text is arranged. They are most useful with pipes.
| Command | What it does | Example |
|---|---|---|
| sort | Sorts lines of text | sort file.txt |
| uniq | Reports or omits repeated lines | sort file.txt | uniq |
| cut | Prints selected parts of each line | cut -d' ' -f1 file.txt |
Pipes and redirection
The Bash manual describes a pipeline as commands separated by a vertical bar, where each command reads the previous command's output. Redirection sends input or output to or from files.
| Symbol | What it does | Example |
|---|---|---|
| | | Sends one command's output into the next | sort file.txt | uniq |
| > | Writes output to a file, replacing it | echo hi > a.txt |
| >> | Adds output to the end of a file | echo more >> a.txt |
$ sort notes/fruit.txt
apples
apples
bananas
pears
$ sort notes/fruit.txt | uniq
apples
bananas
pears
Be careful with the single greater-than sign. An existing file with that name is overwritten. Use the double sign to add to the end instead.
A pipe passes the first command's output to the second command. This one lists the folder and keeps only the lines that match.
$ ls notes | grep fruit
fruit.txt
Permissions
Every file has its own set of permissions for the owner, the group and everyone else. The chmod command changes them, and chown changes the owner and group.
| Command | What it does | Example |
|---|---|---|
| chmod | Changes file mode bits | chmod 600 file.txt |
| chown | Changes file owner and group | chown user:group file.txt |
| ls -l | Shows permissions in the first column | ls -l file.txt |
The GNU manual says a numeric mode is an octal number with one digit each for the owner, the group and others.
Read is worth 4, write is worth 2 and execute is worth 1, and you add the values together.
| Number | Permissions |
|---|---|
| 6 | Read and write |
| 7 | Read, write and execute |
| 5 | Read and execute |
| 4 | Read only |
$ chmod 600 notes/todo.txt
$ ls -l notes/todo.txt | cut -d' ' -f1
-rw-------
$ chmod u+x notes/todo.txt
$ ls -l notes/todo.txt | cut -d' ' -f1
-rwx------
The letter form works too: u for the owner, plus to add, and x for execute. Normally the file's owner can change its permissions, and a process with administrative privileges can too.
Processes
These commands show what is running and stop things that are stuck.
| Command | What it does | Example |
|---|---|---|
| ps | Reports a snapshot of current processes | ps aux |
| top | Shows a live view of the running system | top |
| kill | Sends a signal to a process, TERM by default | kill 1234 |
Use ps to find the process number, then kill with that number. The default signal is TERM, which asks the program to stop cleanly. It does not force the program, so try it first.
Disk and memory
These commands show space and memory use.
| Command | What it does | Example |
|---|---|---|
| df | Reports file system space usage | df -h |
| du | Estimates file space usage | du -sh folder |
| free | Displays free and used memory | free -h |
| uname | Prints system information | uname -a |
The -h option prints sizes in readable units. It is supported by these commands, but check the manual page on your system if it behaves differently.
Archives
An archive bundles files into one, and compression makes it smaller. The tar command is the usual tool, and gzip compresses.
| Command | What it does | Example |
|---|---|---|
| tar | Creates and extracts archives | tar -czf backup.tar.gz notes |
| gzip | Compresses and expands files | gzip file.txt |
$ tar -czf notes.tar.gz notes
$ tar -tzf notes.tar.gz
notes/
notes/todo.txt
notes/fruit.txt
The letters in tar -czf mean create, compress with gzip and name the file. The -t option lists an archive's contents without extracting, which is a safe way to check it first.
Network and remote access
These commands check connections and work on other machines.
| Command | What it does | Example |
|---|---|---|
| ping | Sends echo requests to network hosts | ping -c 4 example.com |
| ip | Shows and manipulates routing, devices and interfaces | ip addr |
| curl | Transfers data from or to a server | curl -I https://example.com |
| ssh | Logs in to a remote machine | ssh user@host |
| scp | Copies files over ssh | scp file.txt user@host: |
The -c option makes ping stop after that many requests. Without it, ping on Linux keeps going until you press Ctrl and C together.
Packages and services
These commands depend on your distribution. The apt command is for Debian and Ubuntu style systems, and the Debian manual describes it as a command-line interface to package management.
| Command | What it does | Example |
|---|---|---|
| sudo | Runs one command with administrator rights | sudo apt update |
| apt | Installs and manages packages on Debian and Ubuntu | sudo apt install htop |
| systemctl | Controls the systemd system and service manager | systemctl status ssh |
| journalctl | Queries the systemd journal | journalctl -n 20 |
Use sudo only when you need it and only for one command at a time. Reading the command twice before pressing Enter is a good habit.
Linux commands for Windows
If you use Windows, you have two routes. You can learn the equivalents, or you can run Linux itself. This table pairs common Windows commands with Linux ones. The Windows descriptions come from Microsoft Learn.
| Windows command | Linux command | Notes |
|---|---|---|
| dir | ls | Lists a directory's files and subdirectories |
| type | cat | Displays a text file's contents |
| copy | cp | Copies files from one location to another |
| move | mv | Moves files from one place to another |
| del | rm | Deletes files |
| cls | clear | Clears the screen |
| findstr | grep | Searches for text patterns in files |
| tasklist | ps | Lists running processes |
| taskkill | kill | Ends processes |
| ipconfig | ip addr | Shows network configuration |
| where | which | Locates a command or file |
These pairs are rough equivalents, not exact translations. For example, dir and ls both list a directory, and in PowerShell both are aliases for Get-ChildItem, but their options and output differ.
A PowerShell warning
Microsoft says PowerShell has built-in aliases, including ls and dir for the Get-ChildItem cmdlet on Windows. So typing ls in PowerShell works, but it runs a PowerShell command, not the Linux program.
The options will not match. For real Linux commands, use Linux itself.
Running real Linux on Windows
Microsoft says the Windows Subsystem for Linux, or WSL, lets you run a Linux environment on Windows without a separate virtual machine or dual booting. You can install distributions such as Ubuntu and Debian.
Microsoft's install guide says that running wsl –install in PowerShell as administrator installs the features WSL needs and the Ubuntu distribution by default. Restart your machine afterward.
Our WSL guides cover the steps after installation. Read how to reclaim WSL disk space and every wslconfig setting explained.
How to practice Linux commands
Practice beats reading. These ideas are our advice, and they cost nothing.
Use a practice folder
Create one like the example above and break things only there.
Repeat the same tasks
Create, copy, move, search and delete files until it feels natural.
Read one manual page a day
Open man for a command you already use.
Rebuild a small task
For example, count the lines in a file, find the unique ones and sort them.
Use a safe environment
WSL, a virtual machine or a spare computer is better than a machine that holds your only copy of your work.
Linux commands to know first
If you only learn a handful, learn these. Each one appears in the tables above.
ls and cd
See and change where you are.
cat and less
Read files.
cp and mv
Copy and rename.
mkdir and rm
Create and delete.
grep and find
Search text and files.
chmod
Fix permissions.
man
Read the manual.
Chaining commands and exit status
Every command ends with an exit status, a number that says whether it worked. Zero means success, and anything else means a problem.
You can use that to chain commands. Two ampersands run the next command only if the first succeeded.
$ ls plain.txt && echo "found it"
plain.txt
found it
$ ls missing.txt && echo "found it"
ls: cannot access 'missing.txt': No such file or directory
The second command printed nothing after the error, because the first one failed. Two vertical bars do the opposite: they run the next command only if the first failed. A semicolon runs the next command no matter what.
$ ls missing.txt || echo "not there, carrying on"
not there, carrying on
$ ls missing.txt; echo "exit status of the last command: $?"
exit status of the last command: 2
The special variable with a dollar sign and a question mark holds the exit status of the last command.
The commands true and false do nothing except return 0 and 1, which makes them handy for testing. Our Bash scripting tutorial builds on this idea.
Wildcards and quotes
The shell expands wildcards before the command runs. A star matches any characters, so a pattern that ends in dot txt becomes the list of matching files. Quotes switch that off.
$ echo *.txt
my notes.txt plain.txt report 2024.txt
$ echo "*.txt"
*.txt
Quotes also keep a name with spaces together. In my practice folder, one file is called my notes.txt, and another is called report 2024.txt. Quote the name, or put a backslash before each space.
$ ls "my notes.txt" report\ 2024.txt
my notes.txt
report 2024.txt
Without quotes, the shell sees two names, and the command fails to find either. That one habit prevents many errors.
Files with spaces: find and xargs
The command find lists files, and xargs turns a list into arguments for another command. They are a powerful pair, with one trap. Names with spaces break the simple version.
$ find . -name "*.txt" | xargs ls -l
ls: cannot access './my': No such file or directory
ls: cannot access 'notes.txt': No such file or directory
ls: cannot access './report': No such file or directory
ls: cannot access '2024.txt': No such file or directory
The pipe sent names separated by spaces and newlines, so xargs split my notes.txt into two words. The safe version separates names with a null character, which cannot appear in a file name.
$ find . -name "*.txt" -print0 | xargs -0 ls
./my notes.txt
./plain.txt
./report 2024.txt
Use the print0 option in find with the dash zero option in xargs whenever you pipe file names into another command, especially before a delete.
Three habits that prevent accidents
These habits are our advice, and they cost nothing.
List before you delete
Run ls with the same pattern first. If the list looks right, replace ls with rm.
Quote names
Put quotes around any name that might contain a space or special character.
Read the error
The first line of an error usually names the problem. Do not run the command again with a guess.
Common mistakes
Typing in the wrong folder
Check with pwd before deleting.
Forgetting that case matters
File names and commands are case sensitive.
Using sudo as a habit
Use it only for tasks that need it.
Overwriting with a single arrow
One greater-than sign replaces the file.
Pasting commands blindly
Read each part before pressing Enter.
Before you practice, make sure your terminal itself is set up well. Our terminal and shell setup guide covers Windows, macOS and Linux.
When you are ready to automate tasks, our Bash scripting tutorial shows how to turn commands into scripts.
Frequently asked questions
Which Linux commands matter most?
Begin with pwd, ls, cd, mkdir, cp, mv, rm, cat, grep, find, chmod and man. They cover moving, managing files, searching and reading help.
Is there a Linux commands cheat sheet PDF?
Yes. Download our two-page PDF from this guide. It follows the same tables.
How do I learn Linux commands as a beginner?
Practice in a safe folder, repeat small tasks and read manual pages. Run one command at a time and read what it prints.
Can I use Linux commands on Windows?
Yes, through WSL. PowerShell also has aliases such as ls, but they run PowerShell commands.
How do grep and find differ?
grep looks for text inside files. find locates files by name and other properties.
How can I get help with a command?
Enter man followed by the command name, or put –help after the command.
A quick checklist
From circuittimes.com/cloud-dev/linux-commands/
Was this guide helpful?
What went wrong?
Read nextComparison 13 min readGit Merge vs Rebase: When to Use Each, With Real ExamplesGit merge, rebase, fast-forward and squash compared with real command output, conflicts, force pushing and pull settings.
Comparison 11 min readJest vs Vitest: Which Test Runner to Use in 2026
Comparison 10 min readPlaywright vs Cypress: Which Testing Tool in 2026
Comparison 12 min readGitHub vs GitLab vs Bitbucket: Which to Choose in 2026
The briefing, without the noise.
The stories that matter in technology, every weekday morning.
Free. Unsubscribe in one click.







