← All free guides
FREE GUIDE · 150 COMMANDS · 12 CATEGORIES

100+ Linux
Commands

A practical cheat sheet for beginners and semi-pros. Organized by use case, with explanations, common flags, and an example for every command.

150
Commands
12
Categories
8
Pages
Free
No sign-up

Inside the guide: all 150 commands

1File Management & Navigation17 commands

1.1 ls List files and directories

Common flags: -l (long listing), -a (show hidden files), -h (human-readable sizes), -t (sort by time), -R (recursive)

Example: ls -lah — detailed listing with hidden files and readable sizes; ls -lt — newest files first

1.2 cd Change directory

Example: cd ~ — go to your home directory; cd - — go back to the previous directory; cd .. — go up one level

1.3 pwd Show the current directory (print working directory)

Example: pwd

  • 1.4 mkdir Create a directory
  • 1.5 rmdir Remove an empty directory
  • 1.6 rm Remove files/directories
  • 1.7 cp Copy files/directories
  • 1.8 mv Move or rename files
  • 1.9 touch Create an empty file / update its timestamp
  • 1.10 find Search a directory tree for files
  • 1.11 locate Fast file search using a prebuilt index
  • 1.12 tree Show the directory structure graphically
  • 1.13 ln Create links
  • 1.14 stat Detailed file information
  • 1.15 file Identify a file's type
  • 1.16 du Show disk usage for files/directories
  • 1.17 df Show disk space for filesystems
2View & Edit Files17 commands

2.1 cat Show file contents / concatenate files

Example: cat file1.txt file2.txt > merged.txt

2.2 less Page through files one screen at a time

Example: less big_log.txt (page with space, search with /)

2.3 more Simpler predecessor to less

Example: more file.txt

  • 2.4 head Show the first lines of a file
  • 2.5 tail Show the last lines of a file
  • 2.6 nano Simple terminal text editor
  • 2.7 vim Powerful terminal text editor
  • 2.8 tee Write output to both the screen and a file
  • 2.9 wc Count lines, words, bytes, and characters
  • 2.10 diff Compare two files
  • 2.11 cmp Compare files byte by byte
  • 2.12 sort Sort lines
  • 2.13 uniq Remove duplicate lines (requires sorted input)
  • 2.14 cut Cut out columns/fields from text
  • 2.15 paste Merge lines from multiple files side by side
  • 2.16 tr Replace or delete characters
  • 2.17 split Split a large file into smaller pieces
3Text Processing & Search12 commands

3.1 grep Search for text patterns in files

Common flags: -i (case-insensitive), -r (recursive), -n (show line numbers), -v (invert, show non-matching lines)

Example: grep -rn "TODO" src/ — find all TODO comments with line numbers; grep -i "error" log.txt

3.2 egrep / grep -E Search using extended regular expressions

Example: egrep "error|warning" log.txt

3.3 fgrep / grep -F Search for an exact text string (no regex)

Example: fgrep "192.168.1.1" access.log

  • 3.4 sed Stream editor for text (search & replace, etc.)
  • 3.5 awk Powerful column-based text-processing tool
  • 3.6 xargs Build and run commands from input
  • 3.7 echo Print text
  • 3.8 printf Formatted text output
  • 3.9 rev Reverse the characters in each line
  • 3.10 fold Wrap long text at a given width
  • 3.11 column Format text into neat columns
  • 3.12 jq Powerful tool for processing JSON
4File Permissions & Ownership9 commands

4.1 chmod Change file permissions

Common flags: symbolic (u+x, g-w) or numeric (755, 644)

Example: chmod +x script.sh — make the file executable; chmod 644 file.txt — read/write for the owner, read-only for others

4.2 chown Change a file's owner

Example: chown anna:developers file.txt

4.3 chgrp Change a file's group

Example: chgrp developers file.txt

  • 4.4 umask Default permissions for new files
  • 4.5 sudo Run a command as another user (usually root)
  • 4.6 su Switch user in the current shell
  • 4.7 id Show user/group IDs
  • 4.8 whoami Show the current username
  • 4.9 groups Show which groups a user belongs to
5Process Management15 commands

5.1 ps Show running processes

Common flags: aux (all processes, detailed)

Example: ps aux | grep nginx

5.2 top Live monitoring of processes and resource usage

Example: top (press q to quit)

5.3 htop An improved, interactive version of top

Example: htop

  • 5.4 kill Terminate a process by PID
  • 5.5 killall Terminate processes by name
  • 5.6 pkill Terminate processes matching a pattern
  • 5.7 pgrep Find the PID of processes by name
  • 5.8 bg Send a paused process to the background
  • 5.9 fg Bring a background process to the foreground
  • 5.10 jobs List active background jobs
  • 5.11 nice Start a process with a given priority
  • 5.12 renice Change the priority of a running process
  • 5.13 nohup Run a command that keeps running after you log out
  • 5.14 wait Wait for background processes to finish
  • 5.15 time Measure how long a command takes
6System Info & Monitoring15 commands

6.1 uname Show system information

Common flags: -a (all)

Example: uname -a

6.2 uptime Show how long the system has been running plus load

Example: uptime

6.3 free Show memory usage

Common flags: -h (readable)

Example: free -h

  • 6.4 vmstat Statistics on memory, processes, and I/O
  • 6.5 iostat Disk I/O statistics
  • 6.6 lscpu Show CPU information
  • 6.7 lsblk List block devices (disks/partitions)
  • 6.8 dmesg Show the kernel's message buffer (e.g. hardware errors)
  • 6.9 journalctl Read systemd logs
  • 6.10 who Show logged-in users
  • 6.11 w Show logged-in users and what they're doing
  • 6.12 last Show login history
  • 6.13 date Show or set the date/time
  • 6.14 cal Show a calendar
  • 6.15 hostnamectl Show/change the hostname (systemd)
7Networking17 commands

7.1 ping Test whether a host is reachable

Example: ping -c 4 google.com

7.2 curl Fetch/send data via URLs

Common flags: -I (headers only), -o (save to file), -X (HTTP method)

Example: curl -X POST -d "name=Anna" https://api.example.com/users

7.3 wget Download files from the web

Example: wget https://example.com/file.zip

  • 7.4 ssh Securely connect to another computer remotely
  • 7.5 scp Copy files securely over SSH
  • 7.6 rsync Efficient file/directory synchronization
  • 7.7 netstat Show network connections (older tool)
  • 7.8 ss Modern replacement for netstat
  • 7.9 ip Manage network interfaces and routing (modern Linux)
  • 7.10 ifconfig Show/configure network interfaces (older tool)
  • 7.11 traceroute Show the path packets take to a host
  • 7.12 dig Look up DNS information
  • 7.13 nslookup Simpler DNS lookup
  • 7.14 whois Look up domain/IP ownership information
  • 7.15 nc (netcat) Read/write raw data over the network, port troubleshooting
  • 7.16 iptables Manage firewall rules (older, but still common)
  • 7.17 hostname Show or set the computer's hostname
8Package Management6 commands

8.1 apt / apt-get Package management on Debian/Ubuntu

Example: sudo apt update && sudo apt upgrade — refresh package lists and upgrade installed packages; sudo apt install htop; sudo apt remove htop

8.2 dpkg Low-level package management on Debian-based systems

Example: dpkg -l | grep nginx

8.3 yum Package management on older RHEL/CentOS

Example: sudo yum install htop

  • 8.4 dnf Modern successor to yum (Fedora/RHEL)
  • 8.5 pacman Package management on Arch Linux
  • 8.6 snap Universal packages (Snapcraft)
9Disk & Storage6 commands

9.1 mount Mount a filesystem

Example: sudo mount /dev/sdb1 /mnt/usb

9.2 umount Unmount a filesystem

Example: sudo umount /mnt/usb

9.3 fdisk Partition hard drives

Example: sudo fdisk -l — list partitions

  • 9.4 mkfs Create a filesystem on a partition
  • 9.5 fsck Check and repair a filesystem
  • 9.6 blkid Show UUID and filesystem type for block devices
10Archiving & Compression7 commands

10.1 tar Archive (and optionally compress) files

Common flags: -c (create), -x (extract), -v (verbose), -z (gzip), -f (filename)

Example: tar -czvf archive.tar.gz folder/ — create a compressed archive; tar -xzvf archive.tar.gz — unpack it

10.2 zip Create a zip archive

Example: zip -r archive.zip folder/

10.3 unzip Unpack a zip archive

Example: unzip archive.zip

  • 10.4 gzip / gunzip Compress/decompress individual files
  • 10.5 bzip2 Alternative compression method, often a better ratio
  • 10.6 xz Modern compression with a high compression ratio
  • 10.7 7z 7-Zip archiving (requires p7zip)
11User Management7 commands

11.1 useradd Create a new user

Example: sudo useradd -m anna (-m creates a home directory)

11.2 userdel Remove a user

Example: sudo userdel -r anna (-r also removes the home directory)

11.3 usermod Modify an existing user

Example: sudo usermod -aG sudo anna — add anna to the sudo group

  • 11.4 passwd Change a password
  • 11.5 adduser An interactive, user-friendly alternative to useradd
  • 11.6 groupadd Create a new group
  • 11.7 chpasswd Bulk-update passwords from a file/script
12Scripting, Environment & Misc22 commands

12.1 export Set an environment variable

Example: export PATH=$PATH:/opt/my-tool/bin

12.2 alias Create a shortcut for a command

Example: alias ll='ls -lah'

12.3 unalias Remove an alias

Example: unalias ll

  • 12.4 history Show command history
  • 12.5 source Run a script file in the current shell (e.g. to load variables)
  • 12.6 env Show environment variables / run a command in a clean environment
  • 12.7 which Show the path to a command's executable
  • 12.8 whereis Find the binary, source, and man pages for a command
  • 12.9 type Show how a command would be interpreted (alias, function, binary)
  • 12.10 man Read manual pages
  • 12.11 chsh Change your default shell
  • 12.12 crontab Schedule recurring jobs
  • 12.13 bash / sh Run a shell script
  • 12.14 xdg-open Open a file/URL with the default program (Linux desktop)
  • 12.15 watch Run a command repeatedly and show the result live
  • 12.16 sleep Pause for a given number of seconds (handy in scripts)
  • 12.17 clear Clear the terminal window
  • 12.18 exit End the terminal session
  • 12.19 reboot Restart the system
  • 12.20 shutdown Shut down the system
  • 12.21 systemctl Manage systemd services
  • 12.22 service Older way to manage services (works via a systemd wrapper)
The full guide, as a PDFEvery command above is written up in full. Free, no email needed.

Related guides: 100+ Bash Scripting Tricks, 100 Unusual & Obscure Linux Commands. From the books: The Linux Testament for the whole of Linux. All free guides are in the library.