Introduction
Linux is one of the most widely used operating system technologies in the world. Whether you are a beginner learning Linux, a developer managing applications, or a system administrator working with servers, understanding Linux terminal commands can make your daily work easier.
The Linux command-line interface (CLI) allows users to manage files, install software, monitor system performance, troubleshoot networks, and automate repetitive tasks.
In this comprehensive Linux Commands Cheat Sheet 2026, you will discover more than 100 useful Linux commands and command examples, organized into easy-to-understand categories.
Most examples work with common Linux distributions such as Ubuntu, Debian, Fedora, and Linux Mint. Some commands require additional packages or administrator privileges.
1. Basic Linux Commands
These commands help you navigate and interact with the Linux terminal.
| Command | Description |
|---|---|
pwd | Display current working directory |
ls | List files and directories |
ls -l | Show detailed file information |
ls -a | Show hidden files |
ls -lh | Show readable file sizes |
cd /home | Navigate to the /home directory |
cd .. | Move to parent directory |
cd ~ | Go to home directory |
cd - | Return to previous directory |
clear | Clear the terminal |
history | Display command history |
whoami | Display current username |
date | Display system date and time |
hostname | Display hostname |
man ls | Open the manual for ls |
Practical example:
pwd
ls -la
cd ~/DocumentsThese commands display your current location, list files including hidden files, and navigate to your Documents folder.
2. Linux File and Directory Management Commands
File management is one of the most important skills for anyone using Linux.
| Command | Description |
|---|---|
mkdir project | Create a new directory |
mkdir -p a/b/c | Create nested directories |
touch file.txt | Create an empty file |
cp file1 file2 | Copy a file |
cp -r dir1 dir2 | Copy directory recursively |
mv old.txt new.txt | Rename a file |
mv file.txt /tmp/ | Move a file |
rm file.txt | Delete a file |
rm -i file.txt | Ask before deleting a file |
rmdir emptydir | Remove an empty directory |
ln -s target shortcut | Create a symbolic link |
file image.png | Identify file type |
stat file.txt | Display file metadata |
basename /tmp/test.txt | Show filename component |
dirname /tmp/test.txt | Show directory component |
Practical example:
mkdir linux-practice
cd linux-practice
touch notes.txt
cp notes.txt backup.txt
ls -lThis example creates a working directory, adds an empty file, creates a backup copy, and displays the results.
Be cautious with rm, especially when working with entire directories. Deleted files may not be recoverable.
3. Linux File Viewing and Text Processing Commands
Linux provides powerful tools for reading, searching, and processing text files.
| Command | Description |
|---|---|
cat file.txt | Display file contents |
less file.txt | Read a file page by page |
head file.txt | Show first 10 lines |
tail file.txt | Show last 10 lines |
tail -f app.log | Follow log updates |
wc -l file.txt | Count lines |
wc -w file.txt | Count words |
sort file.txt | Sort lines |
uniq file.txt | Remove adjacent duplicate lines |
cut -d: -f1 file.txt | Extract first colon-separated field |
grep "error" app.log | Search matching text |
grep -i "error" app.log | Search case-insensitively |
sed 's/old/new/g' file.txt | Replace text in output |
awk '{print $1}' file.txt | Print first whitespace-separated field |
diff file1 file2 | Compare two files |
Practical example:
grep -i "error" app.log
tail -n 20 app.log
wc -l app.logThese commands help you find errors, examine recent log entries, and count the number of lines in a log file.
4. Linux User and Permission Commands
Linux uses ownership and file permissions to control access to system resources.
| Command | Description |
|---|---|
id | Display user and group IDs |
who | Show logged-in users |
users | List logged-in usernames |
groups | Display user group memberships |
passwd | Change your password |
sudo command | Run command with elevated privileges |
chmod 755 script.sh | Set file permissions |
chmod +x script.sh | Add executable permission |
chmod 644 file.txt | Set common file permissions |
chown user file.txt | Change file owner |
chgrp developers file.txt | Change group ownership |
umask | Show permission creation mask |
Understanding Linux Permissions
Linux permissions use three main access types:
- Read (r): View file contents.
- Write (w): Modify file contents.
- Execute (x): Execute a file or access a directory appropriately.
For example:
chmod 755 script.shThis grants read, write, and execute permissions to the owner, while allowing the group and other users to read and execute the file.
5. Linux System Information Commands
System information commands help monitor hardware, operating system details, and resource usage.
| Command | Description |
|---|---|
uname -a | Display kernel and system information |
uname -r | Show kernel release |
uptime | Show uptime and load averages |
free -h | Display memory usage |
df -h | Display filesystem space |
du -sh folder/ | Show directory size |
lsblk | List block devices |
lscpu | Display CPU information |
lspci | List PCI devices |
lsusb | List USB devices |
hostnamectl | Show hostname and system information |
timedatectl | Display time settings |
Practical example:
free -h
df -h
uptimeThese commands provide a quick overview of your computer's memory, storage space, and operating time.
6. Linux Process Management Commands
Linux processes are running instances of applications or system services.
| Command | Description |
|---|---|
ps | Show processes for current terminal |
ps aux | List system processes |
top | Monitor active processes |
htop | Interactive process monitor, if installed |
pgrep nginx | Find process IDs by name |
pidof nginx | Display process IDs |
kill PID | Request process termination |
kill -9 PID | Force termination |
pkill nginx | Signal matching processes |
jobs | Display current shell jobs |
bg | Resume a stopped job in background |
fg | Bring a shell job to foreground |
nice -n 10 command | Run process with adjusted priority |
Use kill -9 only when normal termination does not work, because forced termination prevents a process from cleaning up normally.
7. Linux Networking Commands
Networking commands are especially useful for developers, IT support teams, and server administrators.
| Command | Description |
|---|---|
ip addr | Display network interfaces and IP addresses |
ip route | Show routing table |
ping example.com | Test network connectivity |
ss -tuln | List listening TCP/UDP sockets |
curl -I https://example.com | Fetch HTTP response headers |
wget https://example.com/file.zip | Download a file |
hostname -I | Display assigned IP addresses |
dig example.com | Query DNS records |
traceroute example.com | Trace network route |
ssh user@server | Connect to remote server |
scp file.txt user@server:/tmp/ | Copy file to remote host |
rsync -av source/ destination/ | Synchronize files |
nmcli device status | Show NetworkManager device status |
Some tools, including dig, traceroute, and nmcli, may need installation or may not be available on every distribution.
8. Linux Package Management Commands
Package managers simplify installing, upgrading, and removing software.
The following commands apply to Ubuntu, Debian, and other APT-based distributions.
| Command | Description |
|---|---|
sudo apt update | Refresh repository package indexes |
sudo apt upgrade | Upgrade installed packages |
sudo apt install git | Install Git |
sudo apt remove git | Remove Git |
sudo apt purge git | Remove Git and package configuration |
apt search nginx | Search for packages |
apt show nginx | Display package details |
apt list --installed | List installed packages |
sudo apt autoremove | Remove unused dependencies |
apt-cache policy nginx | Show available package versions |
Practical example:
sudo apt update
sudo apt install git
git --versionThis refreshes package information, installs Git, and checks its installed version.
The Ubuntu documentation recommends updating package indexes before performing upgrades or installing software when fresh repository information is required.
9. Linux Compression and Archive Commands
Compression utilities make it easier to store, transfer, and back up files.
| Command | Description |
|---|---|
tar -cf files.tar folder/ | Create TAR archive |
tar -xf files.tar | Extract TAR archive |
tar -czf files.tar.gz folder/ | Create compressed TAR archive |
tar -xzf files.tar.gz | Extract compressed TAR archive |
gzip file.txt | Compress file with gzip |
gunzip file.txt.gz | Decompress gzip file |
zip -r files.zip folder/ | Create ZIP archive |
unzip files.zip | Extract ZIP archive |
Practical example:
tar -czf project-backup.tar.gz project/This creates a compressed archive of the project directory.
10. Linux Service and Log Management Commands
Most modern Linux distributions use systemd to manage system services.
| Command | Description |
|---|---|
systemctl status nginx | Check Nginx service status |
sudo systemctl start nginx | Start Nginx |
sudo systemctl stop nginx | Stop Nginx |
sudo systemctl restart nginx | Restart Nginx |
sudo systemctl enable nginx | Enable Nginx at startup |
sudo systemctl disable nginx | Disable automatic startup |
systemctl list-units --type=service | List loaded service units |
journalctl -b | View logs from current boot |
journalctl -u nginx | View Nginx service logs |
journalctl -f | Follow new journal entries |
These commands are particularly useful when maintaining websites, APIs, or Linux servers.
11. Linux Terminal Keyboard Shortcuts
Knowing keyboard shortcuts can improve your productivity significantly.
| Shortcut | Action |
|---|---|
Ctrl + C | Interrupt running command |
Ctrl + Z | Suspend foreground process |
Ctrl + L | Clear terminal display |
Ctrl + A | Move to beginning of command |
Ctrl + E | Move to end of command |
Ctrl + U | Delete from cursor to line start |
Ctrl + K | Delete from cursor to line end |
Ctrl + W | Delete previous word |
Ctrl + R | Search command history |
Ctrl + D | Send EOF or exit shell |
Tab | Complete commands and filenames |
Alt + . | Insert last argument from history |
These shortcuts are common in Bash with typical readline settings, but behavior can vary depending on your shell and terminal configuration.
12. Five Practical Linux Command Examples
Example 1: Find Large Files
find ~/Downloads -type f -size +100MFind files larger than 100 MiB in your Downloads folder.
Example 2: Find Recently Modified Files
find ~/Documents -type f -mtime -7Find files modified within approximately the last seven days.
Example 3: Check Server Storage
df -h
du -sh /var/logExamine filesystem space and the total size of system logs.
Example 4: Monitor Application Logs
sudo journalctl -u nginx -fFollow new log entries for the Nginx service.
Example 5: Create a Project Backup
cp -a project/ project-backup/Create a copy of the project directory, preserving many file attributes.
13. Best Practices for Using Linux Commands
Following good habits helps you avoid mistakes and maintain system security.
- Read command documentation using
manor--help. - Check file paths carefully before removing or overwriting anything.
- Avoid using
sudounless administrator access is necessary. - Regularly update your system with your distribution's package manager.
- Create backups before modifying important files.
- Practice potentially destructive commands in a test environment.
- Avoid running shell scripts from untrusted websites.
- Learn how Linux file permissions work.

