This content originally appeared on DEV Community and was authored by Oliver Bennet
Introduction
As a system administrator, mastering Bash commands is essential for managing, troubleshooting, and automating system tasks. Here’s a look at ten commands that can make a Sysadmin’s life easier, boost efficiency, and enhance control over the environment.
1. top
- Real-Time Process Monitoring
Description: Displays real-time information on CPU usage, memory, and running processes.
Why It’s Important: Allows for quick identification of resource-hogging processes and helps maintain system performance.
Basic Usage: top
(Press q to exit)
2. ps
- View Active Processes
Description: Lists currently running processes with detailed information.
Why It’s Important: Useful for identifying specific processes, their statuses, and their memory or CPU usage.
Basic Usage: ps aux
(List all processes with details)
3. grep
- Search Text Within Files
Description: Searches for specific strings within files.
Why It’s Important: Essential for sifting through log files or configuration files to locate errors or specific entries.
Basic Usage: grep "error" /var/log/syslog
4. df
- Disk Space Usage
Description: Displays available and used disk space on file systems.
Why It’s Important: Helps prevent disk space from filling up unexpectedly, which could disrupt services.
Basic Usage: df -h
(Human-readable format)
5. du
- Disk Usage by Directory
Description: Shows disk space usage for files and directories.
Why It’s Important: Identifies large files and directories consuming disk space, useful for cleanup tasks.
Basic Usage: du -sh /path/to/directory
6. netstat
or ss
- Network Statistics
Description: Displays network connections, routing tables, interface statistics, and more.
Why It’s Important: Useful for network diagnostics and ensuring proper connectivity and firewall rules.
Basic Usage: netstat -tuln
or ss -tuln
(List listening ports)
7. tar
- Archiving and Compression
Description: Compresses and decompresses files and directories.
Why It’s Important: Essential for backups, transferring large files, or archiving logs.
Basic Usage: tar -czvf backup.tar.gz /path/to/directory
(Compresses directory into a .tar.gz file)
8. rsync
- Synchronize Files and Directories
Description: Copies and synchronizes files locally or to/from remote servers.
Why It’s Important: Useful for backups, migrations, and replicating data across systems.
Basic Usage: rsync -av /source/path /destination/path
9. chmod
- Change File Permissions
Description: Modifies file and directory permissions.
Why It’s Important: Ensures secure access control by setting correct permissions for files and directories.
Basic Usage:
chmod 755 script.sh
10. systemctl
- Control and Manage System Services
Description: Starts, stops, enables, and checks the status of system services.
Why It’s Important: Critical for managing and troubleshooting system services on modern Linux systems.
Basic Usage: systemctl status nginx (Check the status of the Nginx service)
Conclusion
Mastering these commands can significantly improve productivity and system control for Sysadmins. By incorporating these tools into your daily routine, you can streamline operations, troubleshoot issues more effectively, and ensure smooth system management.
🔗 Support my Work
▶️ Support by Subscribing my YouTube
▶️ Explore more open-source tutorials on my website
▶️ Follow me on X
☕ Buy me a Coffee
This content originally appeared on DEV Community and was authored by Oliver Bennet
Oliver Bennet | Sciencx (2024-10-25T08:43:26+00:00) 10 Bash Commands Every Sysadmin Should Know. Retrieved from https://www.scien.cx/2024/10/25/10-bash-commands-every-sysadmin-should-know/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.