Linux System Administration: Essential Commands and Practices

Listen to this Post

You Should Know:

Mastering Linux system administration requires familiarity with key commands and best practices. Below are essential commands and steps to optimize your workflow:

1. System Information

– `uname -a` – Display system information (kernel version, hostname, etc.).
– `df -h` – Check disk space usage in human-readable format.
– `free -m` – Show memory usage in megabytes.
– `uptime` – Check system uptime and load averages.

2. File and Directory Management

– `ls -la` – List all files (including hidden ones) with detailed permissions.
– `chmod 755 file.sh` – Set execute permissions for the owner, read/execute for others.
– `chown user:group file.txt` – Change file ownership.
– `find / -name “.log”` – Search for all `.log` files in the system.

3. Process Management

– `ps aux` – List all running processes.
– `top` / `htop` – Monitor system processes interactively.
– `kill -9 PID` – Forcefully terminate a process by its ID.
– `systemctl status nginx` – Check the status of a service (e.g., Nginx).

4. Networking

– `ifconfig` / `ip a` – Display network interfaces.
– `netstat -tuln` – List listening ports.
– `ping google.com` – Test network connectivity.
– `ssh user@remote_host` – Connect to a remote server via SSH.

5. Package Management

  • Debian/Ubuntu:
    sudo apt update && sudo apt upgrade 
    sudo apt install nginx 
    
  • RHEL/CentOS:
    sudo yum update 
    sudo yum install httpd 
    

6. Log Inspection

– `tail -f /var/log/syslog` – Monitor system logs in real-time.
– `journalctl -xe` – View detailed system logs (systemd systems).

7. Security Practices

– `sudo iptables -L` – List firewall rules.
– `sudo fail2ban-client status` – Check Fail2Ban status (brute-force protection).
– `sudo passwd username` – Change a user’s password.

8. Automation with Cron

  • Edit crontab:
    crontab -e 
    
  • Example job (runs daily at midnight):
    0 0    /path/to/backup.sh 
    

9. Backup and Compression

– `tar -czvf backup.tar.gz /path/to/folder` – Create a compressed backup.
– `rsync -avz /source user@remote:/destination` – Sync files securely.

10. Kernel and Module Management

– `lsmod` – List loaded kernel modules.
– `modprobe module_name` – Load a kernel module.

What Undercode Say:

Linux administration is a blend of command mastery and proactive system management. Regular updates, log monitoring, and security hardening are critical. Automation (cron, scripts) and backups ensure resilience. Always verify commands in a test environment before production use.

Expected Output:

A well-maintained Linux system with optimized performance, secure configurations, and automated routines.

References:

Reported By: Kinge Hans – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass βœ…

Join Our Cyber World:

πŸ’¬ Whatsapp | πŸ’¬ TelegramFeatured Image