Top 60 Linux Commands Cheat Sheet.
Essential commands for daily use.
A. File and Directory Management Commands
ssh: Secure Shell, used for secure remote access to a system.ls: List directory contents.pwd: Print the current working directory.cd: Change directory to a different folder.touch: Create an empty file or update the modified timestamp of an existing file.echo: Print a message or the value of a variable.nano: A simple text editor.vim: A more advanced text editor with many features.cat: Print the contents of a file to the console.shred: Securely delete a file by overwriting its contents.mkdir: Create a new directory.cp: Copy a file from one location to another.mv: Move a file from one location to another, or rename a file.rm: Remove a file.rmdir: Remove a directory if it is empty.ln: Create a link to a file or directory.head: Display the first lines of a file.tail: Display the last lines of a file.cmp: Compare two files byte by byte.diff: Display the differences between two files.sort: Sort the lines of a file.find: Search for files in a directory hierarchy.chmod: Change the permissions of a file or directory.chown: Change the owner of a file or directory.
B. System Management Commands
clear: Clear the console.useradd: Add a new user to the system.sudo: Run a command with administrative privileges.adduser: Add a new user to the system with more options thanuseradd.su: Switch to another user account.exit: Close the current terminal or log out of the current user account.sudo passwd: Change the password for the current user.sudo passwd [username]: Change the password for another user.sudo apt: A package manager used to install, update, and remove software packages on Debian-based systems.sudo apt update & install: Update package lists and install packages.finger: Display information about a user.man: Display the manual page of a command.whatis: Display a brief description of a command.which: Locate a command and display its path.whereis: Locate the binary, source, and manual page files for a command.wget: Download files from the web.curl: Transfer data to or from a server.zip: Compress files into a zip archive.unzip: Extract files from a zip archive.less: View a file one page at a time.
C. File Comparison & Manipulation Commands
ifconfig: Configure network interfaces.ip address: Display IP address information.ping: Test network connectivity by sending packets to a host.resolvectl status: Display the current DNS resolver configuration.netstat: Display network connections, routing tables, and interface statistics.iptables: Configure and administer the netfilter firewall.ufw: A user-friendly interface to manage iptables firewall rules.
D. Networking Management & Monitoring Commands
-
uname: Print system information, including kernel name, network node hostname, kernel release, and kernel version. -
neofetch: Display system information in a colorful and visually appealing way. -
cal: Display a calendar of the current month or year. -
free: Display the amount of free and used system memory. -
dfanddf -h: Display disk usage statistics for a file system. -
ps: Report a snapshot of current processes. -
top: Display dynamic real-time information about running processes. -
kill: Send a signal to terminate a process. -
pkill: Send a signal to terminate one or more processes based on their name. -
systemctl: Control the system and service manager. -
history: Display previously executed commands. -
sudo reboot: Reboot the system with administrative privileges. -
shutdown: Shutdown or reboot the system.credits: [NetworkChuck]
Linux Commands Cheat Sheet with Examples :
1. File and Directory Management
-
ls
List files and directories.
Example:ls -
ls -l
List files with detailed information.
Example:ls -l -
mkdir
Create a new directory.
Example:mkdir new_folder -
rmdir
Remove an empty directory.
Example:rmdir empty_folder -
rm
Delete files or directories.
Example:rm file.txt -
cp
Copy files or directories.
Example:cp source.txt destination.txt -
mv
Move or rename files.
Example:mv old_name.txt new_name.txt -
pwd
Show the current directory.
Example:pwd
2. File Viewing
-
cat
Display file contents.
Example:cat file.txt -
less
View file with pagination.
Example:less file.txt -
head
Display the first 10 lines of a file.
Example:head file.txt -
tail
Display the last 10 lines of a file.
Example:tail file.txt -
tail -f
Follow updates to a file (e.g., log file).
Example:tail -f log.txt
3. File Permissions and Ownership
-
chmod
Change file permissions.
Example:chmod 755 script.sh -
chown
Change file ownership.
Example:chown user:group file.txt -
ls -l
View file permissions and ownership.
Example:ls -l
4. Searching
-
grep
Search for a pattern in a file.
Example:grep "search_term" file.txt -
grep -r
Search recursively in directories.
Example:grep -r "search_term" directory/ -
find
Locate files by name or criteria.
Example:find /path -name "file.txt" -
locate
Search files quickly using a pre-built database.
Example:locate file.txt -
updatedb
Update the database forlocate.
Example:sudo updatedb
5. Disk Usage
-
df -h
Show free disk space in human-readable format.
Example:df -h -
du -h
Show disk usage of files/directories.
Example:du -h directory/
6. Networking
-
ip addr
Display network interfaces and IP addresses.
Example:ip addr -
ping
Test connectivity to a host.
Example:ping google.com -
netstat
View network connections.
Example:netstat -tuln -
nslookup
Query DNS records for a domain.
Example:nslookup example.com -
traceroute
Trace the route to a host.
Example:traceroute google.com
7. User Management
-
adduser
Add a new user.
Example:sudo adduser username -
deluser
Remove a user.
Example:sudo deluser username -
whoami
Show the current logged-in user.
Example:whoami -
who
Show logged-in users.
Example:who
8. Process Management
-
ps aux
List all running processes.
Example:ps aux -
top
Display real-time process usage.
Example:top -
kill
Terminate a process by PID.
Example:kill 1234 -
killall
Terminate processes by name.
Example:killall firefox
9. Package Management (Debian-based Systems)
-
apt update
Update package lists.
Example:sudo apt update -
apt upgrade
Upgrade installed packages.
Example:sudo apt upgrade -
apt install
Install a package.
Example:sudo apt install curl -
apt remove
Remove a package.
Example:sudo apt remove package_name -
apt search
Search for a package.
Example:apt search package_name
10. System Monitoring
-
uname -a
Display system information.
Example:uname -a -
free -h
Show memory usage in human-readable format.
Example:free -h -
uptime
Show system uptime.
Example:uptime

