The Linux command line is a powerful tool for developers, system administrators, and power users. This cheat sheet provides a quick reference to the most essential Linux commands, organized by category.
Related: Master Git Commands for version control and Docker Commands for containerization.
Commands for managing files and directories.
| Command | Description | Example |
|---|---|---|
ls | Lists files and directories in the current directory. | ls -l |
pwd | Displays the present working directory. | pwd |
cd | Changes the current directory. | cd /home/user/documents |
mkdir | Creates a new directory. | mkdir new_folder |
rmdir | Removes an empty directory. | rmdir old_folder |
rm | Removes files or directories. | rm file.txt or rm -r directory |
cp | Copies files or directories. | cp source.txt destination.txt |
mv | Moves or renames files or directories. | mv old_name.txt new_name.txt |
touch | Creates an empty file or updates the timestamp of an existing file. | touch new_file.txt |
file | Determines the file type. | file document.pdf |
ln | Creates a link to a file. | ln -s /path/to/original.txt /path/to/link.txt |
Commands for archiving and compressing files.
| Command | Description | Example |
|---|---|---|
zip | Compresses files into a zip archive. | zip archive.zip file1.txt file2.txt |
unzip | Extracts files from a zip archive. | unzip archive.zip |
tar | Creates or extracts tar archives. | tar -czvf archive.tar.gz /path/to/directory |
Commands for viewing and editing files.
| Command | Description | Example |
|---|---|---|
nano | A simple, modeless text editor. | nano filename.txt |
vi / vim | A powerful, modal text editor. | vim filename.txt |
cat | Concatenates and displays the content of files. | cat file.txt |
head | Displays the beginning of a file. | head -n 10 file.txt |
tail | Displays the end of a file. | tail -f /var/log/syslog |
Commands for processing and searching text.
| Command | Description | Example |
|---|---|---|
grep | Searches for a pattern in a file. | grep "error" /var/log/syslog |
sed | A stream editor for filtering and transforming text. | sed 's/old/new/g' file.txt |
awk | A powerful pattern scanning and processing language. | awk '{print $1}' file.txt |
sort | Sorts lines of text files. | sort names.txt |
cut | Removes sections from each line of files. | cut -d',' -f1 data.csv |
diff | Compares two files line by line. | diff file1.txt file2.txt |
tee | Reads from standard input and writes to standard output and files. | `ls -l |
locate | Finds files by name using a pre-built database. | locate httpd.conf |
find | Searches for files in a directory hierarchy. | find /home -name "*.txt" |
Commands for managing users and file permissions.
| Command | Description | Example |
|---|---|---|
sudo | Executes a command as another user (usually the superuser). | sudo apt-get update |
su | Switches to another user account. | su - username |
whoami | Displays the current username. | whoami |
chmod | Changes the permissions of a file or directory. | chmod 755 script.sh |
chown | Changes the owner of a file or directory. | chown user:group file.txt |
useradd | Creates a new user. | useradd newuser |
passwd | Changes a user's password. | passwd newuser |
userdel | Deletes a user account. | userdel olduser |
Commands for monitoring system information.
| Command | Description | Example |
|---|---|---|
df | Displays the amount of disk space available on the file system. | df -h |
du | Estimates file and directory space usage. | du -sh /var/log |
top | Displays Linux processes. | top |
htop | An interactive process viewer. | htop |
ps | Reports a snapshot of the current processes. | ps aux |
uname | Prints system information. | uname -a |
hostname | Shows or sets the system's host name. | hostname |
history | Displays the command history. | history |
man | Displays the on-line manual pages. | man ls |
Commands for managing processes and services.
| Command | Description | Example |
|---|---|---|
time | Measures the execution time of a program. | time ls |
systemctl | Controls the systemd system and service manager. | systemctl start apache2 |
watch | Executes a program periodically, showing output fullscreen. | watch -n 5 df -h |
jobs | Lists active jobs. | jobs |
kill | Sends a signal to a process. | kill 12345 |
shutdown | Shuts down or reboots the system. | shutdown -h now |
Commands for networking.
| Command | Description | Example |
|---|---|---|
ping | Sends ICMP ECHO_REQUEST to network hosts. | ping google.com |
wget | A non-interactive network downloader. | wget https://example.com/file.zip |
curl | A tool to transfer data from or to a server. | curl -O https://example.com/file.zip |
scp | Securely copies files between hosts on a network. | scp user@remote:/file.txt . |
rsync | A fast, versatile, remote (and local) file-copying tool. | rsync -avz /local/dir user@remote:/remote/dir |
ip | Shows or manipulates routing, devices, policy routing and tunnels. | ip addr show |
netstat | Prints network connections, routing tables, interface statistics, etc. | netstat -tuln |
traceroute | Prints the route packets trace to network host. | traceroute google.com |
nslookup | Queries Internet name servers interactively. | nslookup google.com |
dig | A DNS lookup utility. | dig google.com |
Commands for managing software packages.
| Command | Description | Example |
|---|---|---|
apt / apt-get | Package handler for Debian/Ubuntu based systems. | sudo apt-get install nginx |
dnf / yum | Package manager for Fedora/RHEL based systems. | sudo dnf install httpd |
This cheat sheet covers a wide range of essential Linux commands. Mastering these commands will significantly improve your efficiency and effectiveness when working with Linux systems.
Complete Git commands cheat sheet for developers. Quick reference for setup, branching, merging, and repository management.
A comprehensive cheat sheet for Docker commands. Learn how to manage Docker images, containers, networks, volumes, and Docker Compose with this handy reference guide.

Get instant AI-powered summaries of YouTube videos and websites. Save time while enhancing your learning experience.