Essential Linux Commands Every DevOps Engineer Must Know
Linux is the backbone of modern cloud computing and DevOps. Mastering key Linux commands can significantly boost efficiency in automation, troubleshooting, and system administration. This post covers the essential Linux commands that every DevOps engineer should know.
File and Directory Management
Listing Files and Directories
- ls -l → Displays files in a long listing format
- ls -a → Shows hidden files
- ls -lh → Lists files with human-readable sizes
Creating and Removing Files & Directories
- touch file.txt → Creates a new empty file
- mkdir new_folder → Creates a new directory
- rm -r folder/ → Removes a directory and its contents
Moving and Copying Files
- cp file1.txt file2.txt → Copies file1 to file2
- mv oldname.txt newname.txt → Renames or moves a file
- rsync -av source/ destination/ → Syncs directories efficiently
User and Permission Management
Managing Users & Groups
- whoami → Shows the current user
- sudo useradd devops_user → Creates a new user
- sudo passwd devops_user → Sets a password for the user
Managing Permissions
- chmod 755 script.sh → Changes file permissions
- chown user:group file.txt → Changes file ownership
Process Management
- ps aux → Lists running processes
- top → Displays real-time system usage
- kill -9 <PID> → Kills a process by its ID
Networking Commands
- ifconfig / ip a → Displays network configuration
- ping google.com → Checks network connectivity
- netstat -tulnp → Lists active connections and ports
Package Management
For Debian/Ubuntu:
- sudo apt update && sudo apt upgrade → Updates and upgrades packages
- sudo apt install package_name → Installs a package
For RHEL/CentOS:
- sudo yum install package_name → Installs a package
Logs and Monitoring
- tail -f /var/log/syslog → Follows system logs in real-time
- journalctl -xe → Checks systemd logs
- dmesg | grep error → Finds system boot errors
Disk Management
- df -h → Shows disk space usage
- du -sh /folder/ → Displays folder size
- fdisk -l → Lists disk partitions
Conclusion
These Linux commands including cronjob form the foundation for any DevOps engineer. Mastering them will help you automate tasks, manage servers efficiently, and troubleshoot system issues faster.
What’s your favourite Linux command? Drop a comment below!
Post a Comment