Linux administration lives and dies by the command line. Whether you manage one server or a hundred, these are the commands you will reach for every day. This guide is a practical reference — real commands used in real scenarios, with explanations that actually make sense.
Navigation and File Management
pwd # Print current working directory
ls -lah # List files with sizes, hidden files, human-readable
cd /var/log # Change directory
cd ~ # Go to home directory
cd - # Go to previous directory
Copying, Moving, Deleting
cp file.txt /tmp/ # Copy file
cp -r /etc/nginx /backup/nginx # Copy directory recursively
mv oldname.txt newname.txt # Rename or move file
rm file.txt # Delete file
rm -rf /tmp/old-dir/ # Delete directory recursively (careful!)
mkdir -p /opt/myapp/logs # Create nested directories
Viewing File Contents
cat /etc/os-release # View full file
less /var/log/syslog # Paginated view (q to quit)
head -20 /var/log/nginx/error.log # First 20 lines
tail -50 /var/log/syslog # Last 50 lines
tail -f /var/log/auth.log # Live follow (great for logs)
Searching Inside Files
grep "error" /var/log/syslog
grep -i "failed" /var/log/auth.log
grep -r "listen 80" /etc/nginx/
grep -n "root" /etc/passwd
grep -v "^#" /etc/ssh/sshd_config
User and Permission Commands
whoami
id
sudo su -
su - alok
passwd alok
File Permissions
ls -l /etc/shadow
chmod 640 /etc/myapp.conf
chmod +x script.sh
chown alok:www-data file
chown -R alok /opt/myapp
Process Management
ps aux
ps aux | grep nginx
top
kill 1234
kill -9 1234
pkill nginx
pgrep -l nginx
Disk and Storage
df -h
du -sh /var/log
du -sh /var/log/*
lsblk
fdisk -l
mount | grep sda
Networking
ip addr show
ip route show
ping -c 4 8.8.8.8
ss -tulnp
curl -I https://example.com
wget -q -O /tmp/file.tar.gz https://example.com/file.tar.gz
Service Management (systemd)
systemctl status nginx
systemctl start nginx
systemctl stop nginx
systemctl restart nginx
systemctl enable nginx
systemctl disable nginx
journalctl -u nginx -n 50
Archiving and Compression
tar -czvf backup.tar.gz /etc/nginx/
tar -xzvf backup.tar.gz -C /tmp/
zip -r site.zip /var/www/html/
unzip site.zip -d /var/www/html/
Text Processing Quickref
wc -l /var/log/syslog
sort users.txt
sort -n -r sizes.txt
uniq -c sorted.txt
cut -d: -f1 /etc/passwd
awk -F: "{print $1, $3}" /etc/passwd
System Information
uname -a
hostnamectl
uptime
free -h
lscpu
lspci
Using man Pages
man ls
man ssh
man 5 passwd
Use /keyword inside man to search, n for next match, q to quit.
Summary
These commands form the backbone of Linux administration. Practice them on a test VM until they become muscle memory. The real skill is knowing which command to reach for in a given situation, and knowing how to combine them with pipes and redirects to solve problems fast.