Linux Commands Cheatsheet — Essential Reference
DodaTech
3 min read
In this tutorial, you'll learn about Linux Commands Cheatsheet. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
Essential Linux commands for file management, permissions, processes, networking, text processing, and package management — a sysadmin's daily reference.
File Operations
| Command | What it does |
|---|---|
ls -la |
List files (detailed, hidden) |
cp -r src dst |
Copy recursively |
mv src dst |
Move or rename |
rm -rf dir |
Remove recursively, force |
touch file |
Create empty file or update timestamp |
cat file |
Print file content |
less file |
Scroll through file (q to quit) |
head -n 5 file |
First 5 lines |
tail -f file |
Follow log in real time |
mkdir -p a/b/c |
Create nested directories |
Permissions
chmod 755 script.sh # rwxr-xr-x
chmod u+x script.sh # add execute for user
chown user:group file # change owner/group
chown -R user:group dir/ # recursive
Permission modes: r=4, w=2, x=1 — chmod 644 = rw-r--r--
Processes
| Command | What it does |
|---|---|
ps aux |
All running processes |
top / htop |
Interactive Process viewer |
kill -9 PID |
Force kill Process |
pkill nginx |
Kill by name |
jobs |
List Background Jobs |
fg %1 |
Bring job to foreground |
command & |
Run in background |
nohup command & |
Run immune to hup |
Networking
| Command | What it does |
|---|---|
ping 8.8.8.8 |
Test connectivity |
curl -s example.com |
HTTP request |
wget url |
Download file |
ssh user@host |
SSH connection |
netstat -tulpn |
Listening ports |
ss -tulpn |
Modern alternative |
ip a / ifconfig |
Network interfaces |
scp file user@host:/path |
Secure copy |
Package Management
| Distro | Command |
|---|---|
| Debian/Ubuntu | apt update && apt install pkg |
| RHEL/Fedora | dnf install pkg |
| Arch | pacman -S pkg |
| macOS | brew install pkg |
Text Processing
grep -r "error" /var/log/ # recursive search
grep -i "warning" log.txt # case-insensitive
grep -v "^#" config.conf # exclude comments
find /home -name "*.py" # find by name
find . -type f -size +10M # find by size
sort file.txt # sort lines
wc -l file.txt # count lines
uniq -c file.txt # count unique lines
sed & awk
sed 's/old/new/g' file.txt # replace all
sed -i '.bak' 's/old/new/g' file # in-place with backup
awk '{print $1, $3}' file.txt # print columns
awk '/error/ {print $0}' log.txt # filter + print
awk '{sum+=$1} END {print sum}' nums.txt # sum column
Compression
| Command | Ext | What it does |
|---|---|---|
tar czf archive.tar.gz dir/ |
.tar.gz |
Compress |
tar xzf archive.tar.gz |
.tar.gz |
Extract |
zip -r archive.zip dir/ |
.zip |
Compress |
unzip archive.zip |
.zip |
Extract |
See the full Linux administration guides for more.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro