Linux Commands Cheatsheet

Top 60 essential Linux commands with practical examples based on the popular Linux tutorial video. Learn how to navigate the terminal, manage files, configure networks, and administer systems like a pro.

60 Commands
10 Categories
Practical Examples
๐Ÿ”‘
ssh
Secure Shell - Connect to remote Linux machines securely over a network.
ssh user@192.168.1.100
Remote Access
๐Ÿ“‚
ls
List directory contents - shows files and directories in current location.
ls -la # List all including hidden files
File Management
๐Ÿ“
pwd
Print Working Directory - shows the current directory path.
pwd
Navigation
๐Ÿ“
cd
Change Directory - navigate between folders.
cd /home/user/Documents
Navigation
โž•
touch
Create new empty files or update file timestamps.
touch newfile.txt
File Management
๐Ÿ“ข
echo
Display message or add content to files.
echo "Hello" >> file.txt
Text Processing
๐Ÿ“
nano
Simple text editor for terminal-based file editing.
nano file.txt
Editors
โœ๏ธ
vim
Powerful terminal-based text editor with advanced features.
vim file.txt
Editors
๐Ÿฑ
cat
Concatenate and display file contents quickly.
cat file.txt
Text Processing
๐Ÿ”’
shred
Securely delete files by overwriting their contents.
shred -u secret.txt
Security
๐Ÿ“
mkdir
Create new directories/folders.
mkdir new_folder
File Management
๐Ÿ“‹
cp
Copy files and directories.
cp file.txt /backup/
File Management
โžก๏ธ
mv
Move or rename files and directories.
mv old.txt new.txt
File Management
๐Ÿ—‘๏ธ
rm
Remove files or directories (use with caution).
rm -r old_directory/
File Management
๐Ÿ—‘๏ธ
rmdir
Remove empty directories.
rmdir empty_folder/
File Management
๐Ÿ”—
ln
Create links between files (symbolic or hard links).
ln -s target.txt link.txt
File Management
๐Ÿงน
clear
Clear terminal screen.
clear
Terminal
๐Ÿ‘ค
whoami
Display current username.
whoami
System Info
๐Ÿ”“
sudo
Execute commands with superuser privileges.
sudo apt update
Administration
๐Ÿ‘ฅ
useradd
Create new user accounts (requires sudo).
sudo useradd newuser
User Management
๐Ÿ‘ฅ
adduser
Interactive user creation with more options.
sudo adduser newuser
User Management
๐Ÿ”„
su
Switch user accounts.
su - otheruser
User Management
๐Ÿšช
exit
Exit current shell or user session.
exit
Terminal
๐Ÿ”‘
passwd
Change user password.
passwd
Security
๐Ÿ“–
man
Display manual pages for commands.
man ls
Help
โ“
whatis
Brief description of a command.
whatis ls
Help
๐Ÿ”
which
Show full path of commands.
which python
Help
๐ŸŒ
wget
Download files from the internet.
wget https://example.com/file.zip
Networking
๐Ÿ”„
curl
Transfer data to/from servers (more features than wget).
curl -O https://example.com/file.zip
Networking
๐Ÿ“ฆ
zip
Compress files into a zip archive.
zip archive.zip file1.txt file2.txt
Compression
๐Ÿ“ค
unzip
Extract files from a zip archive.
unzip archive.zip
Compression
๐Ÿ“„
less
View file contents page by page.
less longfile.txt
Text Processing
๐Ÿ‘†
head
Display first lines of a file.
head -n 10 file.txt
Text Processing
๐Ÿ‘‡
tail
Display last lines of a file (often used with -f for logs).
tail -f /var/log/syslog
Text Processing
๐Ÿ”„
cmp
Compare two files byte by byte.
cmp file1.txt file2.txt
Text Processing
๐Ÿ”€
diff
Show differences between two files.
diff file1.txt file2.txt
Text Processing
๐Ÿ” 
sort
Sort lines of text files alphabetically.
cat file.txt | sort
Text Processing
๐Ÿ”
find
Search for files in a directory hierarchy.
find /home -name "*.txt"
File Management
๐Ÿ›ก๏ธ
chmod
Change file permissions.
chmod +x script.sh
Permissions
๐Ÿ‘‘
chown
Change file owner and group.
chown user:group file.txt
Permissions
๐Ÿ“ก
ifconfig
Display network interface configuration (deprecated on some systems).
ifconfig
Networking
๐ŸŒ
ip
Modern replacement for ifconfig with more features.
ip address show
Networking
๐Ÿ”Ž
grep
Search text using patterns (extremely powerful).
grep "error" /var/log/syslog
Text Processing
๐Ÿ› ๏ธ
awk
Pattern scanning and text processing language.
awk '{print $1}' file.txt
Text Processing
๐Ÿ“ถ
ping
Test network connectivity to a host.
ping google.com
Networking
๐Ÿ›ฃ๏ธ
traceroute
Trace the network path to a host.
traceroute google.com
Networking
๐Ÿ“Š
netstat
Display network connections, routing tables, and interface statistics.
netstat -tulpn
Networking
๐Ÿ“ก
ss
Modern replacement for netstat.
ss -tulpn
Networking
๐Ÿ”ฅ
ufw
Uncomplicated Firewall - simplified interface for iptables.
sudo ufw allow 22/tcp
Security
๐Ÿง
uname
Print system information.
uname -a
System Info
๐Ÿ’พ
free
Display amount of free and used memory.
free -h
System Info
๐Ÿ’ฝ
df
Show disk space usage.
df -h
System Info
๐Ÿ“ˆ
ps
Report current processes.
ps aux
Processes
๐Ÿ“Š
top
Display Linux processes in real-time.
top
Processes
๐Ÿ’ฅ
kill
Terminate processes by ID.
kill -9 1234
Processes
๐Ÿ’ฃ
pkill
Terminate processes by name.
pkill -f "process_name"
Processes
โš™๏ธ
systemctl
Control systemd system and service manager.
sudo systemctl restart nginx
Services
๐Ÿ•ฐ๏ธ
history
Display command history.
history
Terminal
โป
shutdown
Shut down or reboot the system.
sudo shutdown -h now
System