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 β