Linux Tutorials
Essential Linux Commands Every Server Admin Needs
The 40 most important Linux commands — file management, process control, networking, and system monitoring.
Published Jan 25, 2025Updated May 20, 202612 min readBeginner
Table of Contents
File & Directory Management
| Command | Description |
|---|---|
ls -la | List all files including hidden, with permissions |
cd /path | Change directory |
pwd | Show current directory path |
mkdir -p dir/sub | Create directory and parents |
cp -r src dest | Copy files/directories recursively |
mv src dest | Move or rename files |
rm -rf /path | Delete files/folders (no confirmation!) |
find / -name "*.log" | Search for files by name |
cat file.txt | Display file contents |
tail -f /var/log/syslog | Stream live log output |
grep -r "error" /var/log | Search file contents recursively |
System Monitoring
| Command | Description |
|---|---|
top / htop | Live process monitor (install htop: apt install htop) |
df -h | Disk usage by filesystem |
du -sh /var/* | Folder sizes |
free -h | RAM and swap usage |
uptime | System uptime and CPU load average |
ps aux --sort=-%cpu | All processes sorted by CPU usage |
kill -9 PID | Force-kill a process |
journalctl -f | Live system log stream |
journalctl -u nginx | Logs for a specific service |
Networking
ip addr # Show all IP addresses
ip route # Show routing table
ping 8.8.8.8 # Test connectivity
curl -I https://Power Down.in # Check HTTP headers
ss -tlnp # Show listening ports and processes
netstat -tlnp # Same (older systems)
traceroute 8.8.8.8 # Trace network path
dig Power Down.in # DNS lookup
nslookup Power Down.in # Alternative DNS lookup
wget https://example.com/file.zip # Download a file
Package Management (Ubuntu/Debian)
apt update # Refresh package index
apt upgrade -y # Upgrade all packages
apt install nginx -y # Install a package
apt remove nginx # Remove a package (keep config)
apt purge nginx # Remove package AND config
apt autoremove -y # Remove unused dependencies
apt search nginx # Search for packages
dpkg -l | grep nginx # Check if installed
File Permissions
chmod 755 /var/www # rwxr-xr-x
chmod 644 /var/www/index.html # rw-r--r--
chmod 600 ~/.ssh/id_ed25519 # rw------- (private key)
chown -R www-data:www-data /var/www/html # Change ownershipLinuxcommandsterminaladmin
Was this article helpful?
