linux commands cheat sheet

Linux Commands Cheat Sheet (101+ Linux Commands)

April 4th, 2026
9224
05:00 Minutes

Linux is one of the most widely used operating systems for developers, system administrators, DevOps engineers, and cybersecurity professionals. While the Linux terminal may seem intimidating at first, learning a few essential commands can dramatically improve your productivity, troubleshooting skills, and system management capabilities.

This Linux Commands Cheat Sheet is designed to help beginners and professionals quickly understand the most useful Linux terminal commands with practical examples, troubleshooting tips, workflows, and real-world use cases. Instead of just listing commands, this guide focuses on how Linux commands are actually used in day-to-day tasks.

What Are Linux Commands?

Linux commands are text-based instructions used in the Linux terminal to perform tasks like file management, software installation, networking, process monitoring, troubleshooting, and system administration. These commands help users interact directly with the operating system efficiently without relying on a graphical interface.

Why and for Whom Does This Linux Commands Cheat Sheet Matter?

This Linux command cheat sheet is useful for anyone who wants to improve productivity and confidently work with Linux systems. Whether you are learning Linux for the first time or managing production servers, these commands will help simplify your workflow.

  • Beginners and students learning Linux basics
  • Developers working with Ubuntu or Linux servers
  • System administrators managing infrastructure
  • DevOps Engineers handling deployments and automation
  • Cybersecurity professionals analyzing systems and logs
  • Cloud engineers working with AWS, Azure, or Kubernetes
  • IT professionals troubleshooting Linux environments

Also Explore: How to Install Kubernetes?

Most Used Linux Commands for Daily Tasks

If you are just starting with Linux, these are the commands you’ll use most frequently for navigation, troubleshooting, networking, and system management.

Command Purpose Example
lsList files and foldersls -la
cdChange directorycd /var/log
pwdShow current directorypwd
grepSearch text inside filesgrep "ERROR" app.log
findSearch files and foldersfind /home -name "*.txt"
chmodChange permissionschmod +x script.sh
topMonitor system processestop
sshConnect to the remote serverssh user@server-ip
systemctlManage servicessystemctl restart nginx
df -hCheck disk spacedf -h

1. Linux File Management Commands Every Beginner Should Know

Managing files and directories is one of the first skills every Linux user should learn. These Linux file management commands help you navigate folders, organize files, search data, and work efficiently inside the terminal.

Command Description Real Example
lsList files and directoriesls -la /var/log
pwdShow current directorypwd
cdChange directorycd /etc/nginx
mkdirCreate a new directorymkdir project-backup
touchCreate an empty filetouch notes.txt
cpCopy files and folderscp config.conf backup.conf
mvMove or rename filesmv old.log archive.log
rmDelete filesrm unwanted.txt
treeShow directory structuretree /var/www
findSearch filesfind /home -name "*.pdf"
locateSearch indexed fileslocate nginx.conf
statShow file metadatastat access.log
basenameExtract filenamebasename /etc/nginx/nginx.conf
dirnameShow parent directorydirname /var/www/html/index.html
fileIdentify file typefile backup.tar.gz
lnCreate linksln -s app.log latest.log
realpathDisplay absolute pathrealpath script.sh
shredSecurely delete filesshred -u confidential.txt

Practical Example: Find Large Files Consuming Disk Space

find / -type f -size +500M

This command helps system administrators locate files larger than 500 MB that may be consuming unnecessary disk space.

Useful Linux File Management Workflow

# Navigate to logs
cd /var/log

# List files by size
ls -lh

# Find old log files
find . -name "*.log" -mtime +30

# Delete unnecessary files
rm old.log

Also Explore: How to Install Java?

2. Linux File Viewing and Editing Commands

Linux provides powerful terminal-based tools for viewing logs, editing configuration files, and analyzing text quickly. These commands are extremely useful while troubleshooting servers or working remotely through SSH.

Command Purpose Real Example
catView file contentcat config.yml
tacReverse-view filetac logs.txt
headShow first lineshead -20 app.log
tailShow last linestail -f /var/log/syslog
lessOpen large filesless nginx.log
moreBasic file viewermore hosts
grepSearch text patternsgrep "ERROR" nginx.log
sedEdit text streamssed 's/http/https/g' file.txt
awkPattern scanningawk '{print $1}' access.log
sortSort linessort users.txt
uniqRemove duplicate linesuniq names.txt
diffCompare filesdiff old.conf new.conf
vimAdvanced text editorvim docker-compose.yml
nanoSimple editornano hosts
wcCount lines and wordswc -l access.log
cutExtract columnscut -d: -f1 /etc/passwd
pasteMerge files line-wisepaste file1.txt file2.txt
columnFormat columns neatlycolumn -t users.txt

Real-Time Log Monitoring Example

tail -f /var/log/nginx/error.log

This command continuously displays new log entries in real time and is commonly used while debugging websites or APIs.

Command Chaining Example

cat access.log | grep 404

This command helps identify all “404 Not Found” errors inside a web server log file.

Another Useful Linux Log Analysis Example

grep "Failed password" /var/log/auth.log

This command helps identify failed SSH login attempts on Linux servers.

Also Explore: How to Install Golang?

3. Linux User and Permission Commands

Linux follows a strong permission-based security model. These commands help manage users, groups, and access rights securely across Linux systems and servers. Understanding permissions is essential for developers, Linux administrators, and DevOps engineers working with shared environments.

Command Description Real Example
chmodChange file permissionschmod 755 deploy.sh
chownChange ownershipchown ubuntu:ubuntu app.log
chgrpChange group ownershipchgrp developers script.sh
idDisplay user informationid ubuntu
sudoRun the command as administratorsudo apt update
suSwitch usersu root
useraddCreate a new useruseradd devops
userdelDelete useruserdel testuser
passwdChange passwordpasswd ubuntu
groupsShow user groupsgroups devops
visudoEdit sudo configurationvisudo

Fix “Permission Denied” Error in Linux

chmod +x deploy.sh

This command adds executable permission to a shell script and fixes one of the most common Linux permission errors.

Check File Permissions

ls -l script.sh

This command displays file ownership and permission details in Linux.

Linux Permission Workflow Example

# Create user
sudo useradd developer

# Set password
sudo passwd developer

# Give sudo access
sudo usermod -aG sudo developer

# Verify groups
groups developer

Also Explore: How to Install Docker?

4. Linux System Monitoring and Troubleshooting Commands

System monitoring commands help administrators analyze CPU usage, RAM consumption, running services, system uptime, and hardware information. These Linux troubleshooting commands are extremely useful while maintaining production servers and cloud environments.

Command Purpose Example
topMonitor running processestop
htopInteractive process viewerhtop
unameDisplay Linux system informationuname -a
hostnameDisplay hostnamehostnamectl
uptimeCheck server uptimeuptime
lscpuDisplay CPU informationlscpu
lsblkDisplay disk partitionslsblk -f
dfCheck disk usagedf -h
duCheck folder sizedu -sh /var/log
freeCheck memory usagefree -h
dmidecodeDisplay hardware metadatasudo dmidecode
psShow running processesps aux
envDisplay environment variablesenv
printenvPrint environment variableprintenv PATH
journalctlView system logsjournalctl -xe
dmesgView kernel logsdmesg | tail

Find High CPU Usage Processes

ps aux --sort=-%cpu | head

This command displays the processes consuming the highest CPU resources.

Find High Memory Usage Processes

ps aux --sort=-%mem | head

This Linux command helps identify memory-intensive applications running on a server.

Check Linux Disk Usage Quickly

df -h

This command displays human-readable disk usage statistics for all mounted drives.

Linux Troubleshooting Workflow Example

# Check uptime
uptime

# Check memory usage
free -h

# Check disk usage
df -h

# Check top processes
top

# Review logs
journalctl -xe

Also Explore: How to Install Splunk?

5. Essential Linux Networking Commands for Troubleshooting

Linux networking commands are used to troubleshoot internet connectivity, verify DNS resolution, analyze active ports, transfer files securely, and connect to remote Linux servers. These commands are commonly used by network engineers, cloud administrators, and DevOps professionals.

Command Description Real Example
pingTest network connectivityping google.com
ifconfigDisplay network interfacesifconfig eth0
ipModern networking utilityip addr
netstatShow active connectionsnetstat -tulpn
ssSocket statisticsss -lntu
curlSend HTTP requestscurl https://api.github.com
wgetDownload fileswget backup.zip
tracerouteTrace packet routetraceroute google.com
digDNS lookupdig gmail.com
hostDNS utilityhost yahoo.com
arpDisplay ARP tablearp -a
nmcliManage network connectionsnmcli connection show
sshRemote server loginssh ubuntu@server-ip
scpSecure file transferscp app.zip user@server:/home

Check Open Ports in Linux

ss -tulpn

This command shows listening ports and active network services running on a Linux system.

Test API or Website Availability

curl -I https://example.com

This command checks HTTP response headers and verifies whether a website or API endpoint is accessible.

Copy Files Securely Between Servers

scp backup.tar.gz ubuntu@192.168.1.10:/home/ubuntu

This Linux command securely transfers files between local and remote systems using SSH.

Linux Networking Troubleshooting Workflow

# Test internet connectivity
ping google.com

# Check IP address
ip addr

# Check DNS resolution
dig google.com

# Verify open ports
ss -tulpn

# Test API connectivity
curl -I https://example.com

Also Explore: How to Install Kubernetes?

6. Linux Package Management Commands

Package management commands help Linux users install, update, upgrade, and remove software packages efficiently. Different Linux distributions use different package managers such as apt, yum, dnf, rpm, and snap.

Command Purpose Real Example
aptUbuntu/Debian package managersudo apt install nginx
apt-getAdvanced package utilitysudo apt-get clean
dpkgInstall .deb packagesdpkg -i app.deb
snapUniversal Linux packagessnap install postman
yumRHEL/CentOS package manageryum install git
dnfFedora package managerdnf install docker
rpmInstall RPM packagesrpm -ivh package.rpm
flatpakInstall Flatpak applicationsflatpak install app

Update Linux Packages

sudo apt update && sudo apt upgrade -y

This command refreshes package indexes and upgrades installed packages on Ubuntu or Debian systems.

Fix Broken Packages in Ubuntu

sudo apt --fix-broken install

This Linux command resolves dependency and package installation issues.

Difference Between apt and yum

The apt package manager is used mainly in Ubuntu and Debian-based Linux distributions, while yum is used in CentOS and Red Hat Enterprise Linux systems.

Also Explore: How to Use ChatGPT Atlas?

7. Linux Compression and Archiving Commands

Compression and archiving commands help Linux users reduce file sizes, transfer backups efficiently, and organize project files. These commands are commonly used in server management, cloud deployments, and backup automation workflows.

Command Description Real Example
tarCreate or extract archivestar -czf backup.tar.gz project/
zipCreate ZIP archivezip project.zip src/
unzipExtract the ZIP archiveunzip project.zip
gzipCompress filesgzip server.log
gunzipDecompress GZIP filesgunzip backup.gz
7zCreate 7zip archive7z a files.7z data/
rarCreate RAR archiverar a archive.rar files/

Create a Compressed Backup in Linux

tar -czf website-backup.tar.gz /var/www/html

This command creates a compressed backup archive of a website directory.

Extract a Tar.gz Archive

tar -xvf backup.tar.gz

This Linux command extracts compressed archive files into the current directory.

Compression Workflow Example

# Compress logs
tar -czf logs.tar.gz /var/log

# Transfer backup
scp logs.tar.gz user@server:/backup

# Extract backup
tar -xvf logs.tar.gz

Also Explore: How to Install MongoDB?

8. Linux Process and Service Management Commands

Linux gives administrators deep control over running applications, services, and background jobs. These commands help monitor processes, stop unresponsive applications, manage priorities, and restart Linux services efficiently.

Command Purpose Real Example
psView running processesps aux
killTerminate the process using PIDkill 1234
killallKill process by namekillall firefox
bgMove the process to the backgroundbg
fgBring the process to the foregroundfg
jobsView background jobsjobs
niceSet process prioritynice -n 10 python app.py
reniceModify process priorityrenice 10 1234
systemctlManage Linux servicessystemctl restart nginx
serviceOlder Linux service managerservice apache2 restart

Restart a Failed Linux Service

systemctl restart nginx

This command restarts the Nginx service after configuration changes or server failures.

Find a Running Process

ps aux | grep nginx

This command searches for active Nginx processes on a Linux server.

Kill an Unresponsive Process

kill -9 1234

This command forcefully terminates a frozen process using its process ID.

Linux Process Monitoring Workflow

# View running processes
ps aux

# Monitor live processes
top

# Search process
ps aux | grep apache

# Restart service
systemctl restart apache2

# Check service status
systemctl status apache2

Daily Linux Admin Workflow Commands

Linux administrators often repeat the same troubleshooting and monitoring tasks every day. These commands form a practical Linux workflow for checking system health, server availability, and service status quickly.

# Check uptime
uptime

# Check memory usage
free -h

# Check disk space
df -h

# Monitor CPU processes
top

# Review logs
journalctl -xe

# Check open ports
ss -tulpn

# Verify services
systemctl status nginx

Useful Linux Command Chaining Examples

Linux command chaining allows users to combine multiple commands together for filtering, automation, and faster troubleshooting. These examples are widely used in DevOps, Linux administration, and server management.

Find Running Processes

ps aux | grep docker

Search Error Logs

cat /var/log/nginx/error.log | grep "500"

Delete Old Log Files

find /var/log -name "*.log" -mtime +30 -delete

Display Top Memory-Consuming Processes

ps aux --sort=-%mem | head

Monitor Real-Time Logs

tail -f /var/log/syslog

Common Linux Errors and Their Solutions

While learning Linux commands, beginners and professionals often encounter errors related to permissions, missing packages, networking issues, or incorrect file paths. Understanding these common Linux problems helps improve troubleshooting skills significantly.

Error Cause Solution
Permission deniedMissing execute permissionchmod +x script.sh
Command not foundPackage not installedInstall package or verify PATH variable
No such file or directoryIncorrect pathVerify file path using pwd and ls
Connection refusedService not runningRestart service using systemctl
Disk fullStorage exhaustedCheck usage with df -h
Broken packageDependency conflictsudo apt --fix-broken install
Host unreachableNetwork issueVerify connectivity using ping
Port already in useService conflictCheck active ports using ss -tulpn

Dangerous Linux Commands Beginners Should Avoid

Some Linux commands can permanently delete files or damage operating system configurations if used incorrectly. Beginners should understand these commands carefully before executing them on production systems.

Command Risk Safer Alternative
rm -rf /Deletes the entire systemAlways verify path before deletion
chmod -R 777Creates security vulnerabilitiesUse permissions like 755 or 644
dd if=/dev/zeroCan overwrite storage devicesVerify target disk carefully
:(){ :|:& };:Fork bomb that crashes systemAvoid running unknown scripts

If you are learning Linux for the first time, following a structured roadmap can help you master Linux commands faster and avoid confusion.

  1. Learn Linux navigation commands
  2. Understand file and directory management
  3. Practice file viewing and editing commands
  4. Learn permissions and user management
  5. Master Linux networking commands
  6. Understand system monitoring and troubleshooting
  7. Learn package management tools
  8. Practice shell scripting basics
  9. Explore DevOps and cloud-related Linux tools

Also Explore: How to Install Ruby on Rails on Windows and Linux?

Wrapping Up: Linux Commands Cheat Sheet

Linux commands become much easier once you understand where and why they are used. This Linux Commands Cheat Sheet covers essential Linux terminal commands for file management, networking, troubleshooting, process monitoring, permissions, compression, and package management. Whether you are preparing for interviews, working in DevOps, or learning Linux administration, practicing these commands regularly will improve your confidence and productivity significantly.

Explore Our Trending Linux and DevOps Guides

FAQs: Linux Commands Cheat Sheet

1. What are the most used Linux commands?

The most commonly used Linux commands include ls, cd, pwd, grep, find, chmod, ssh, top, ps, and systemctl.

2. Which Linux commands should beginners learn first?

Beginners should start with navigation commands like ls, cd, and pwd, followed by file management and networking commands.

3. Are Linux commands case-sensitive?

Yes, Linux commands are case-sensitive. For example, ls and LS are treated as different commands.

4. What is the difference between grep and find?

The grep command searches text inside files, while find searches for files and directories based on names, size, or permissions.

5. Which Linux commands do DevOps engineers use daily?

DevOps engineers frequently use commands like ssh, systemctl, docker, kubectl, grep, journalctl, and top for server management and automation.

6. Can I run Linux commands on Windows?

Yes. You can use WSL (Windows Subsystem for Linux), Git Bash, or virtual machines to run Linux commands on Windows systems.

7. Which Linux distribution is best for beginners?

Ubuntu is considered one of the best Linux distributions for beginners because of its simplicity, community support, and extensive documentation.

8. What are Linux shell commands?

Linux shell commands are terminal instructions executed through shells like Bash or Zsh to manage files, processes, networking, and system operations.

Course Schedule

Course Name Batch Type Details
Ubuntu Linux Training Every Weekday View Details
Ubuntu Linux Training Every Weekend View Details
About the Author
Sanjay Prajapat
About the Author

Sanjay Prajapat is a Data Engineer and technology writer with expertise in Python, SQL, data visualization, and machine learning. He simplifies complex concepts into engaging content, helping beginners and professionals learn effectively while exploring emerging fields like AI, ML, and cybersecurity in today’s evolving tech landscape.

Drop Us a Query
Fields marked * are mandatory
×

Your Shopping Cart


Your shopping cart is empty.