Essential Linux Commands For Managing Servers
Managing servers efficiently requires a solid understanding of Linux command-line tools. This article covers the most essential Linux commands every system administrator or DevOps engineer should know. From file management to process control and networking, this guide will give you the foundation to work confidently on Linux-based systems.
1. Navigation and File Management
pwd – Print the current working directory:
pwd
ls – List files and directories:
ls -lah
cd – Change directories:
cd /var/www
cp, mv, rm – Copy, move, and delete files:
cp file.txt /backup/
mv oldname.txt newname.txt
rm file.txt
2. File Content Viewing
cat, less, head, tail – View content of files:
cat file.txt
less /var/log/syslog
head -n 10 file.txt
tail -f /var/log/nginx/access.log
3. User and Permission Management
adduser, passwd, userdel – Manage users:
adduser newuser
passwd newuser
userdel newuser
chmod, chown – Change file permissions and ownership:
chmod 755 script.sh
chown www-data:www-data index.html
4. Package Management
Depending on your distro, use apt (Debian/Ubuntu) or yum/dnf (RHEL/CentOS):
# Debian/Ubuntu
apt update
apt install nginx
# RHEL/CentOS
dnf install nginx
5. Process Management
top, ps, kill – Monitor and control processes:
top
ps aux | grep nginx
kill -9 1234
6. Networking Commands
ping, curl, netstat, ss, ip – Network diagnostics and configuration:
ping google.com
curl ifconfig.me
netstat -tuln
ss -tuln
ip addr
7. System Monitoring
df, du, free, uptime – Monitor disk and memory usage:
df -h
du -sh /var/log
free -m
uptime
8. Services and Systemd
systemctl – Manage services on modern Linux distributions:
systemctl status nginx
systemctl start nginx
systemctl enable nginx
9. Archiving and Compression
tar, gzip, unzip – Compress and extract files:
tar -czvf archive.tar.gz folder/
tar -xzvf archive.tar.gz
unzip file.zip
Conclusion
These Linux commands form the backbone of daily server management. By mastering them, you can navigate and control your Linux environment with confidence. Whether you’re deploying apps, troubleshooting, or monitoring performance, these tools are essential for every system administrator or DevOps engineer. Practice them regularly and explore their options for even more power and flexibility.