Skip to content

LinuxGuide

Linux Commands Cheat Sheet (Free One-Page PDF)

  • Updated
  • 14 min read
  • VPS Lane Engineering
Short answer

Download the free Linux commands cheat sheet PDF in US Letter or A4. One printable page, over 100 commands by task, with risk labels.

How we tested this

Every command with output was run on Ubuntu 24.04.5 LTS (kernel 6.18, x86_64) as root in December 2026 with coreutils 9.4, findutils 4.9.0, grep 3.11, GNU sed 4.9, gawk 5.2.1, tar 1.35, procps 4.0.4, iproute2 6.1.0, bind9 dig 9.18.39, curl 8.5.0 and bash 5.2.21. systemctl and journalctl, the user account commands, and the dnf and pacman lines were not run, because the test container has no systemd and only apt. They follow the man pages under Sources. The versions describe the test system, not minimum requirements.

Linux Commands Cheat Sheet PDF Download

This Linux commands cheat sheet PDF fits the commands you will use most on one printable page, grouped by task and marked by risk.

The sheet is made for Linux beginners and for anyone running a VPS who wants the common terminal commands in one place: files, permissions, processes, networking, packages and troubleshooting.

The full one-page Linux commands cheat sheet PDF with sections for help, navigation, files, search, text processing, pipes, permissions, users, processes, services, disk, network, packages, archives, a danger zone and shell shortcuts
The whole printable sheet. Each command group carries a SAFE, CAUTION or DANGER label, written out in words so it still reads in grayscale.

A Linux command is a program or shell builtin that you run by typing its name in a terminal, followed by options and arguments. The sheet groups more than 100 commands and shortcuts by the job you are trying to do, which is how you look for them when something needs fixing.

What the three labels on the sheet mean
LabelWhat the command doesHabit before you run it
SAFEReads information without intentionally changing files or settingsCheck whether the output shows something sensitive before you share it
CAUTIONChanges files, permissions, packages or servicesCheck the path and keep a way back, such as a copy or a backup
DANGERCan cause serious data loss or system damage with no undoPrint and verify the target, use a prompt option, and have a tested backup

The commands apply to current Linux distributions such as Ubuntu 24.04, Debian 12, Fedora, the RHEL family and Arch Linux. Rows marked with a distribution name only work there. Every output block on this page is real output from an Ubuntu 24.04.5 LTS server, captured in December 2026 in a disposable test folder named site, with risky commands tried only on temporary files.

How to Read a Linux Command

To read a Linux command, split it into the command name, its options that start with a dash, and the arguments it acts on.

bash
ls -lah /var/log

Here ls is the command, -lah combines three options (long list, all files, human sizes) and /var/log is the argument. Begin a path with / and it is absolute, so it points to the same place whatever folder you are in. Leave the slash off, as in site/logs, and it is relative, so it starts from your current folder.

Three ways to get help come with almost every system. man ls opens the manual and q closes it, ls --help prints a short summary, and type tells you whether a name is a program or part of the shell.

bash
type ls cd
command -v tar
Output
ls is hashed (/usr/bin/ls)
cd is a shell builtin
/usr/bin/tar

That difference matters. Builtins such as cd, export, jobs, bg and fg run inside your current shell, which is how cd can change its folder. Programs such as ls, grep and tar run as separate processes and cannot change the shell that started them.

Minimal server images often ship without manual pages. On the tested Ubuntu cloud image man -f ls printed a notice that the system had been minimized, while ls --help still worked. Run unminimize on Ubuntu if you want the manuals back.

Basic Linux Commands for Files and Folders

Basic Linux commands for files and folders let you see where you are, list what is there, and create, copy, move or delete it.

Navigation and file commands
CommandWhat it doesRisk
pwdPrints the folder you are inSafe
ls -lahLists all files with permissions, owner and readable sizesSafe
cd dir and cd ..Moves into a folder or up one level. cd - returns to the last oneSafe
mkdir -p a/b/cCreates a folder and any missing parentsCaution
cp -i src dstCopies and asks before replacing a fileCaution
mv -i src dstMoves or renames and asks before replacingCaution
rm -i fileDeletes and asks for each fileDanger
rmdir dirRemoves a folder only if it is emptyCaution
More everyday commands
CommandWhat it doesRisk
touch fileCreates an empty file or updates its timestampCaution
file nameTells you what kind of file it is from its contentSafe
nano fileOpens a simple text editor in the terminalCaution
clearClears the terminal screenSafe
wget URLDownloads a file into the current folderCaution
historyLists the commands you ran in this shellSafe

This is ls -lah on the small test site with a hidden .env file, which plain ls would not show.

bash
ls -lah site
Output
total 20K
drwxr-xr-x 4 root root 4.0K Dec  3 16:09 .
drwxr-xr-x 3 root root 4.0K Dec  3 16:09 ..
-rw-r--r-- 1 root root   20 Dec  3 16:09 .env
drwxr-xr-x 2 root root 4.0K Dec  3 16:09 logs
drwxr-xr-x 2 root root 4.0K Dec  3 16:09 public

The first column is the type and permissions, then the link count, owner, group, size, date and name. The . and .. lines are the folder itself and its parent. The -v option makes copy and move say what they did.

bash
mkdir -p backup/2026/12
cp -v site/public/index.html backup/2026/12/
mv -v backup/2026/12/index.html backup/2026/12/index.bak
Output
'site/public/index.html' -> 'backup/2026/12/index.html'
renamed 'backup/2026/12/index.html' -> 'backup/2026/12/index.bak'

With -i, a copy onto an existing file stops and asks. Answering n left the target untouched in the test.

bash
cp -i site/public/index.html backup/2026/12/index.bak
Output
cp: overwrite 'backup/2026/12/index.bak'?

Read File Contents

To read file contents, use cat for short files, less for long ones, and head or tail for the start or end.

bash
cat -n site/logs/access.log
wc -l site/logs/access.log
Output
     1	GET /index.html 200
     2	GET /about.html 200
     3	GET /admin 403
     4	GET /index.html 200
     5	POST /login 500
     6	GET /missing 404
6 site/logs/access.log

That is the whole six line test log used in the examples below. cat -n numbers the lines. head -n 3 prints the first three and tail -n 2 the last two.

nano file opens a simple editor in the terminal, where Ctrl+O saves and Ctrl+X quits. tail -f keeps printing new lines as a log grows, and Ctrl+C stops it. wc -l counts lines only. Some printed sheets say wc -w counts lines and bytes too, but it counts words alone.

Linux Commands to Find Files and Search Text

Linux commands to find files and search text are find, which matches names, sizes and dates, and grep, which matches text inside files.

By name, both logs match.

bash
find site -name '*.log'
Output
site/logs/old.log
site/logs/access.log

By size, only the 3 MiB old.log is larger than 1 MiB.

bash
find site -type f -size +1M
Output
site/logs/old.log

By age, three files changed in the last 60 minutes.

bash
find site -type f -mmin -60
Output
site/logs/access.log
site/.env
site/public/index.html

Only old.log, dated two days back, is old enough for -mtime +1.

bash
find site -type f -mtime +1
Output
site/logs/old.log

The sign in front of the number decides the meaning. In GNU find, -mmin -60 means less than 60 minutes ago, +60 means more, and a bare 60 means exactly 60 after rounding. Several popular cheat sheets get this wrong, so a bare number is a common reason a search returns nothing. -mtime also rounds down to whole days, so -mtime +1 means at least two days old. To match files older than a full day, pass -mmin +1440.

bash
grep -rn ' 500' site/logs/access.log
grep -c 'GET' site/logs/access.log
grep -rl --include='*.html' 'Hi' site
Output
site/logs/access.log:5:POST /login 500
5
site/public/index.html

-n adds the line number, so the 500 error is on line 5 of the log. -c counts matching lines, five of the six here and -l lists only the file names. Use grep -E for extended patterns and grep -F for fixed text. GNU grep calls direct use of egrep and fgrep deprecated, so older sheets that teach them are out of date.

Which search command to use
You want to findUseExample
Files by name, size, age or ownerfindfind /var/log -name '*.gz' -mtime +30
Text inside filesgrepgrep -rn 'error' /etc/nginx
Files by name, very fastlocate, if installedlocate nginx.conf, from a database that can be out of date
Where a program iscommand -vcommand -v python3

Text Processing and Pipes in Linux

Text processing and pipes in Linux chain small commands with |, so the output of one becomes the input of the next.

This pipeline counts HTTP status codes in the test log. awk takes the third column, sort groups equal lines, uniq -c counts them and sort -rn puts the biggest count first.

bash
awk '{print $3}' site/logs/access.log | sort | uniq -c | sort -rn
Output
      3 200
      1 500
      1 404
      1 403

uniq only merges lines that sit next to each other, which is why sort comes first. cut -d' ' -f2 takes a field by separator, and sed -n '2,3p' prints a line range.

bash
cut -d' ' -f2 site/logs/access.log | sort -u
sed -n '2,3p' site/logs/access.log
Output
/about.html
/admin
/index.html
/login
/missing
GET /about.html 200
GET /admin 403

Redirection Operators

Redirection operators send output to files instead of the screen, and one of them silently replaces what was there.

Redirection operators
OperatorWhat it doesWatch out for
> fileWrites output to a fileEmpties an existing file first
>> fileAppends to a fileCreates the file if it is missing
2> fileWrites only errors to a fileNormal output still goes to the screen
> file 2>&1Writes output and errors to one fileOrder matters. 2>&1 > file sends errors to the screen
| tee fileShows output and saves itAdd -a to append
$(command)Puts the output of a command into another onePreferred over backticks

To stop > from replacing a file by accident, turn on the noclobber shell option. The test shell refused the overwrite and left the log intact.

bash
set -o noclobber
echo test > site/logs/access.log
Output
bash: line 1: site/logs/access.log: cannot overwrite existing file

Add set -o noclobber to ~/.bashrc to keep it. When you really mean to replace a file, >| overrides the option for that one command.

Linux File Permissions Commands

Linux file permissions commands are chmod to set read, write and execute rights and chown to change the owner and group.

Permission numbers
NumberRightsTypical use
644Owner reads and writes, everyone else readsNormal files
640Owner reads and writes, group reads, others nothingConfig files a service group must read
600Owner reads and writes, nobody elseSecrets, .env files, private keys
755Owner full, everyone else reads and entersFolders and scripts
777Everyone can read, write and executeAlmost never the right fix

Every digit is a sum where read counts 4, write counts 2 and execute counts 1, and the three digits cover the owner, then the group, then all other users. stat shows the result in both forms.

bash
chmod 600 site/.env
stat -c '%A %a %U:%G %n' site/.env site/public/index.html
Output
-rw------- 600 root:root site/.env
-rw-r--r-- 644 root:root site/public/index.html

Letters work too and are easier to read. chmod u=rw,g=r,o= file gives the same result as 640, and chmod u+x script.sh makes a script executable without touching other rights.

bash
chmod u=rw,g=r,o= site/public/index.html
ls -l site/public/index.html
Output
-rw-r----- 1 root root 12 Dec  3 16:09 site/public/index.html

User and sudo Commands in Linux

User and sudo commands in Linux show who you are, run single commands as root, and add or change accounts.

bash
id
whoami
groups root
Output
uid=0(root) gid=0(root) groups=0(root)
root
root : root

id shows the user ID, the primary group and every supplementary group. groups name lists the groups of any user, which is how you check that a usermod -aG change took effect after the user logs in again.

User account commands
CommandWhat it doesNote
sudo commandRuns one command with elevated privileges, usually as rootUses your own account rights. Logging depends on the sudo configuration
sudo -iOpens a root shellType exit to leave it
adduser nameAdds a user interactivelyDebian and Ubuntu
useradd -m nameAdds a user with a home folderEvery distribution, no prompts
usermod -aG group nameAdds a user to a groupWithout -a the user is removed from every other supplementary group
passwd nameSets or changes a passwordpasswd -l locks it instead
userdel -r nameDeletes a user and the home folderDanger, files are gone

The account commands above were not run on the test server, so no output is shown for them. They follow the standard shadow utilities and the Debian adduser tool.

Linux Process and Service Commands

Linux process and service commands find running programs, stop them with signals and manage background services through systemd.

This test starts a sleep process, finds it by an exact pattern, shows its details and stops it. pgrep -a prints the process ID and the full command line.

bash
sleep 4242 &
pid=$!
pgrep -af '^sleep 4242$'
ps -o pid,stat,etime,cmd -p "$pid"
kill "$pid"
pgrep -af '^sleep 4242$' || echo "no match, process gone"
Output
25569 sleep 4242
  PID STAT     ELAPSED CMD
25569 S          00:00 sleep 4242
no match, process gone

$! holds the process ID of the last background job, so the commands work with whatever ID your system assigns. ps aux lists the processes visible in the current process namespace, including those owned by other users, with CPU and memory use, and top updates the same view live until you press q. A loose pattern such as pgrep -f sleep can also match other programs and your own shell, so anchor the pattern before you pass the result to kill.

Signals you will use
SignalNumberWhat it asks
TERM15Stop cleanly. The default for kill
INT2Interrupt, the same as Ctrl+C
HUP1Hang up. Many services reload their config on it
KILL9Stop at once. The program cannot clean up, so use it last

jobs shows what this shell has running in the background. Ctrl+Z freezes whatever is in the foreground, bg lets that frozen job carry on in the background, and fg pulls it to the front again. Several printed sheets say bg lists jobs, which it does not.

nohup command & keeps a job running after you log out, and a terminal multiplexer such as tmux does the same for a whole session.

Services and Logs With systemd

Services and logs on systemd distributions are handled by systemctl and journalctl.

bash
sudo systemctl status nginx
sudo systemctl restart nginx
sudo systemctl enable --now nginx
sudo journalctl -u nginx -n 50 --no-pager

The test container does not run systemd as its first process, so these four lines have no output here and were not tested. They are the standard forms on Ubuntu, Debian, Fedora, RHEL and Arch. service nginx restart still works on many systems through a compatibility wrapper, but systemctl is the native tool.

Disk and Memory Commands in Linux

Disk and memory commands in Linux report free space, folder sizes, RAM use, load and the hardware the system sees.

bash
df -h /
free -h
uptime
nproc
Output
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda        252G   22G   21G  51% /
               total        used        free      shared  buff/cache   available
Mem:           7.8Gi       2.5Gi       3.4Gi       493Mi       2.7Gi       5.3Gi
Swap:             0B          0B          0B
 16:09:59 up  1:29,  0 user,  load average: 2.11, 1.94, 1.43
2

In df, Use% is worked out from Used and Avail, not directly from Size. The figures can differ because of filesystem accounting, reserved space or storage limits. The test disk is not typical. Its mount options set a large pool of reserved blocks for another user ID, so Used plus Avail is far below Size.

bash
findmnt -o TARGET,FSTYPE,OPTIONS /
Output
TARGET FSTYPE OPTIONS
/      ext4   rw,relatime,discard,no_prefetch_block_bitmaps,resv_strict,resuid=65534,resgid=65534

resuid=65534 only names the user ID allowed to use reserved blocks. It does not show how big the pool is. tune2fs -l was not permitted inside the test container, so the block counts came from stat -f instead.

bash
stat -f -c 'blocks=%b free=%f avail=%a bsize=%S' /
Output
blocks=66053021 free=59579173 avail=4516047 bsize=4096

Free blocks are what the filesystem has unused. Available blocks are what an ordinary user may write. The filesystem reports about 55 million free 4 KiB blocks that ordinary users cannot use, roughly 210 GiB. That accounts for the gap between Size and Avail in df. The mount options point to reserved block handling, but stat -f does not report the size of the reserved pool itself. On a typical ext4 VPS disk the gap is small. Check Avail, not Size, before you plan a big download or backup.

In free, read available. In procps the used column is total minus available, and available estimates the memory that can be given to programs without swapping. Only part of buff/cache can be reclaimed, so the columns do not add up to total. The three load average numbers cover 1, 5 and 15 minutes. Compare them with the CPU count from nproc.

bash
du -ah site | sort -rh | head -4
Output
3.1M	site/logs
3.1M	site
3.0M	site/logs/old.log
8.0K	site/public

That one line lists the biggest items in a folder, which is usually the first question when a disk fills up. The full method, including deleted files that still hold space, is in the guide on how to check disk space usage in Linux.

uname -a shows the kernel, cat /etc/os-release shows the distribution and version, hostnamectl, when installed, shows the hostname and OS on systemd systems, and lsblk lists disks and partitions.

Linux Networking Commands

Linux networking commands from iproute2, mainly ip and ss, replace the older ifconfig, route and netstat tools.

bash
ip -br addr
ip route
Output
lo               UNKNOWN        127.0.0.1/8
eth0             UP             203.0.113.10/24
default via 203.0.113.1 dev eth0
203.0.113.0/24 dev eth0 proto kernel scope link src 203.0.113.10

The addresses in this guide, such as 203.0.113.10, are documentation examples that replaced the real ones in the output. Two unused virtual interfaces were also left out. ip -6 addr shows IPv6 addresses separately, and a fixed address on Ubuntu is set as shown in the guide to set a static IP on Ubuntu Server.

ss shows sockets. With -t for TCP, -u for UDP, -l for listening, -n for numbers and -p for the process, it answers which program holds a port. The test started a small web server on port 18451 and filtered for that port only.

bash
ss -tlnp 'sport = :18451'
Output
State  Recv-Q Send-Q Local Address:Port  Peer Address:PortProcess
LISTEN 0      5          127.0.0.1:18451      0.0.0.0:*    users:(("python3",pid=20033,fd=3))

Use sudo ss -tulpn to list every listening TCP and UDP port on IPv4 and IPv6 at once. Without root, the process column can be empty for programs owned by other users. A port that listens on 127.0.0.1 only accepts connections from the same machine, which is not the same as being reachable from outside. A firewall can still block a port that ss shows as listening.

Legacy network commands and what replaces them
Old commandModern commandNotes
ifconfigip addr and ip linknet-tools was not installed on the tested Ubuntu image
netstat -tulpnss -tulpnThe netstat manual calls netstat mostly obsolete
route -nip routeShows the default gateway
arp -nip neighNeighbour table for IPv4 and IPv6
nslookupdig or getent hostsgetent uses the same resolver path as most programs

Test Reachability With ping

To test reachability with ping, send a fixed number of probes with -c so it stops on its own.

bash
ping -c 4 -W 2 example.com | tail -2
Output
--- example.com ping statistics ---
4 packets transmitted, 0 received, +4 errors, 100% packet loss, time 3044ms

The test network blocks outgoing ICMP, so every probe failed even though the same site answered on HTTP a moment later. No reply to ping is not evidence that the host is offline. Many servers and firewalls drop ICMP on purpose, so confirm with a TCP check such as curl or nc -zv host 443.

Check DNS and HTTP

To check DNS and HTTP, dig asks for the records of a name and curl makes a real web request.

bash
dig +short A example.com
curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:18451/
Output
104.20.23.154
172.66.147.243
200

dig +short printed the A records of example.com at test time, and they can change. curl printed only the HTTP status code from the local test server. wget URL downloads a file to the current folder. For remote shells, ssh user@host logs in, and the guides on how to generate an SSH key and change the SSH port cover the setup. rsync -avn src/ dst/ previews a copy before you run it for real.

Package Manager Commands by Distribution

Package manager commands differ by distribution, which is the main place where one Linux cheat sheet does not fit every system.

The same job on three package managers
JobDebian and UbuntuFedora and RHEL familyArch Linux
Refresh and upgrade everythingsudo apt update && sudo apt upgradesudo dnf upgradesudo pacman -Syu
Install a packagesudo apt install nginxsudo dnf install nginxsudo pacman -S nginx
Remove a packagesudo apt remove nginxsudo dnf remove nginxsudo pacman -R nginx
Searchapt search nginxdnf search nginxpacman -Ss nginx
List installedapt list --installeddnf list --installedpacman -Q
Remove a package and its unused dependenciessudo apt remove nginx && sudo apt autoremovesudo dnf remove nginx && sudo dnf autoremovesudo pacman -Rns nginx
Show detailsapt-cache policy nginxdnf info nginxpacman -Qi nginx

On current Fedora and RHEL releases dnf is the package manager, and a yum command, where present, points to it. Only the apt lines were run here.

bash
apt-cache policy tar
Output
tar:
  Installed: 1.35+dfsg-3ubuntu0.4
  Candidate: 1.35+dfsg-3ubuntu0.4

Installed and Candidate match, so no newer tar was waiting. Before a large upgrade on a server, take a snapshot or backup so you can roll back if a service fails to start afterwards.

Linux Archive Commands With tar

Linux archive commands with tar pack a folder into one compressed file, list it, and extract it into a chosen place.

bash
tar -czf site-backup.tar.gz site
tar -tzf site-backup.tar.gz | head -5
mkdir -p restore && tar -xzf site-backup.tar.gz -C restore
ls -A restore/site
Output
site/
site/.env
site/public/
site/public/index.html
site/logs/
.env
logs
public

c creates, t lists, x extracts, z uses gzip and f names the file. Listing the archive first shows whether it contains a top level folder or loose files. The -C restore option sets the destination, which keeps the extracted files out of your current folder.

For archives that must open on Windows or macOS, use zip. Many minimal images ship without it, so install zip and unzip with the package manager first.

bash
zip -r site.zip site
unzip site.zip -d restore

These two lines were not run for this page. The options, including passwords and split archives, are tested in the guide on the Linux zip command.

Safe and Dangerous Linux Commands

Safe Linux commands only read and report, while dangerous Linux commands delete, overwrite or open up data with no undo.

Commands that need care
CommandWhat can go wrongSafer habit
rm -rf pathDeletes everything under the path with no prompt and no recycle binCheck the target and any variable in it first, as shown below, then prefer rm -rI
dd if=x of=/dev/sdXOverwrites a whole disk if the device name is wrongCheck lsblk twice and keep a backup
mkfs.ext4 /dev/sdXCreates a new empty filesystem over existing dataConfirm the device is the new empty one
chmod -R or chown -RChanges every file below the path, often system filesTest on one file, then run on the exact folder
> fileEmpties the file before the command even runsUse set -o noclobber
curl url | sudo shRuns a script you have not read as rootDownload it, read it, then run it
kill -9 pidStops the program before it saves its stateSend TERM first and wait

An unset or wrongly expanded variable can point a delete at a different folder than you meant. Check the variable and stop if it is empty or not a folder. These lines belong in a script, where exit 1 stops it before rm runs. In the test DIR was deliberately left empty and the guard refused.

bash
printf 'DIR=<%s>\n' "$DIR"
test -n "$DIR" && test -d "$DIR" || { echo "refusing: DIR is empty or not a folder"; exit 1; }
rm -rI -- "$DIR"
Output
DIR=<>
refusing: DIR is empty or not a folder

GNU rm refuses to remove / recursively by default through --preserve-root, but that does not protect /home, /var or any other folder.

rm -I prompts a single time when you remove over three files or delete recursively. In the test it asked, the answer was no, and all four files stayed.

bash
rm -I junk/a junk/b junk/c junk/d
Output
rm: remove 4 arguments?

A file whose name starts with a dash looks like an option. Put -- before it so rm treats it as a name.

bash
touch -- -rf
rm -- -rf

Common Mistakes in Linux Cheat Sheets

Common mistakes in Linux cheat sheets copied between sites include wrong descriptions and tools that have been replaced.

Fixes for errors found in popular sheets
What some sheets sayWhat is correct
bg lists jobsjobs lists them. bg resumes a paused job in the background
find -mmin 10 finds files changed in the last 10 minutesThat needs -mmin -10. A bare 10 means exactly 10
wc -w counts lines, words and bytes-w counts words only. Plain wc prints all three
rmdir deletes filesIt removes empty folders only
ping -c traces the routeping tests reachability. traceroute or tracepath shows the route
1>2& sends output to errorsThe operator is 1>&2
egrep and fgrepUse grep -E and grep -F
ifconfig, netstat, service, yumip, ss, systemctl and dnf on current releases

Troubleshooting Linux Command Errors

Troubleshooting Linux command errors starts with the message itself, which usually names the cause in plain words.

Error messages and what to do
MessageLikely causeFix
command not foundThe program is not installed or not in PATHInstall the package or use the full path
Permission deniedYour user lacks rights to the file or actionCheck with ls -l, then use sudo only if it should be allowed
No such file or directoryWrong path or a typo, often relative vs absoluteRun pwd and ls, then use Tab completion
cannot overwrite existing filenoclobber is onUse >> or >| if you mean it
Operation not permitted as rootAn immutable flag, a read only mount or a container limitCheck lsattr and mount
A command hangsIt is waiting for input or a network replyPress Ctrl+C, then check the arguments

This is how a missing file reads, with the error going to a file and the screen staying clean.

bash
ls nosuch 2> err.txt
cat err.txt
Output
ls: cannot access 'nosuch': No such file or directory

Practise these commands on a server you can rebuild. A Linux VPS with full root access gives you a real shell for that, and a snapshot before risky changes gives you a way back.

Questions people ask

Where can I download a free Linux commands cheat sheet PDF?

You can download it at the top of this page, in US Letter or A4. It is one page with selectable text and free to print and share.

What are the basic Linux commands for beginners?

Start with pwd, ls, cd, mkdir, cp, mv, rm, cat, less, grep, find, man and sudo. They cover moving around, handling files and getting help.

Are Linux commands the same on every distribution?

Most are, because they come from the same GNU and util-linux tools. Package managers differ: apt on Debian and Ubuntu, dnf on Fedora and RHEL, pacman on Arch.

What is the difference between sudo and su?

sudo lets a single command run with raised rights, normally as root, if your account has been allowed to do that. Whether commands are logged depends on the sudo configuration. su switches to another account and generally needs that account password.

What is the difference between find grep and locate?

find searches the file tree live by name, size or date. grep searches text inside files. locate searches a saved list of names, which is fast but can be out of date.

Which Linux commands are dangerous?

rm -rf, dd, mkfs, recursive chmod or chown, > file and piping a downloaded script into sudo sh can destroy data or open it up. Check the target first.

What replaced ifconfig and netstat?

ip replaced ifconfig and route, and ss replaced netstat. Both come from iproute2, which most current distributions install by default.

Do I need root access to use Linux commands?

No. Commands such as pwd, ls, df, free, ps and grep work as a normal user. Installing packages, managing services and editing protected system files need sudo or root.

Sources

  1. GNU Coreutils manual, rm invocation
  2. GNU Bash manual, Redirections
  3. GNU Findutils manual, find
  4. GNU Grep manual
  5. ss(8) Linux manual page
  6. netstat(8) Linux manual page
  7. DNF command reference
  8. pacman(8) manual page
  9. Ubuntu CLI cheat sheet 2025, Canonical

Written and tested by VPS Lane EngineeringWe run every step on real servers before publishing and update the guide when the software changes.