Linux Must-Know Commands

 0 Replies
 0 Subscribed to this topic
 0 Subscribed to this forum
Sort:
Author
Messages
SuperUser Account
Posts: 16

Linux Must Know Commands

Navigation & Filesystem
pwd
Print current working directory
ls
List directory contents
cd [dir]
Change directory
tree
Visualize directory structure
find [path] -name "[file]"
Find files by name
File Operations
touch [file]
Create empty file
rm [file]
Remove file
rm -r [dir]
Remove directory recursively
cp [src] [dest]
Copy files/directories
mv [src] [dest]
Move/rename files
File Viewing
cat [file]
Print file contents
less [file]
Scrollable file viewer
head -n 10 [file]
First 10 lines
tail -n 10 [file]
Last 10 lines
tail -f [file]
Follow live updates
File Permissions
umask
Default permission mask
stat [file]
Display file info
chmod [mode] [file]
Change permissions
chown [user]:[group] [file]
Change owner/group
Process Management
ps aux
List all processes
top
Real-time monitor
htop
Interactive process viewer
kill [PID]
Kill by ID
killall [name]
Kill all by name
Networking
ip a
Show IP addresses
ping [host]
Check connectivity
curl [url]
Fetch URL content
wget [url]
Download files
netstat -tuln
List open ports
Disk & Storage
df -h
Disk usage (human readable)
du -sh [dir]
Directory size
lsblk
List block devices
fdisk -l
Show disk partitions
mount / umount
Mount / Unmount filesystem
User Management
whoami
Show current user
id
Show user ID & groups
adduser [name]
Add new user
passwd [user]
Change password
groups [user]
List user’s groups
System Info
uname -a
Show system info
uptime
Show load & uptime
free -h
Show RAM usage
dmesg
Boot and kernel logs
Search & Text
grep '[pattern]' [file]
Search in files
awk '{print $1}'
Text processing
sed 's/old/new/g'
Edit text in stream
cut -d':' -f1
Split by delimiter
sort, uniq, wc -l
Count / sort / filter