Monday, March 3, 2025

💻 100 Essential Linux Commands for DevOps 🚀

 

💻 100 Essential Linux Commands for DevOps 🚀

Mastering Linux is a fundamental skill for DevOps engineers. Below is a comprehensive list of 100 essential Linux commands categorized into different sections to help you manage servers, automate tasks, and troubleshoot effectively.



🌍 Shape Your Future with AI & Infinite Knowledge...!!

🌐 Want to Generate Text-to-Voice, Images & Videos? 👉 http://www.ai.skyinfinitetech.com 📚 Read In-Depth Tech & Self-Improvement Blogs 👉 http://www.skyinfinitetech.com ▶ Watch Life-Changing Videos on YouTube 👉 https://www.youtube.com/@SkyInfinite-Learning 🔥 Transform Your Skills, Business & Productivity – Join Us Today! 🔥



1️⃣ Basic Linux Commands 🏁

✔️ pwd → Print current working directory
✔️ ls → List files and directories
✔️ cd <directory> → Change directory
✔️ mkdir <dir> → Create a new directory
✔️ rmdir <dir> → Remove an empty directory
✔️ rm -rf <dir/file> → Remove files or directories recursively
✔️ touch <file> → Create an empty file
✔️ cp <source> <destination> → Copy files and directories
✔️ mv <source> <destination> → Move or rename files
✔️ find <path> -name "<filename>" → Find files by name



2️⃣ File & Directory Permissions 🔐

✔️ ls -l → Show detailed file permissions
✔️ chmod 755 <file> → Change file permissions
✔️ chown user:group <file> → Change file owner
✔️ chgrp <group> <file> → Change group ownership
✔️ umask <value> → Set default file permissions



3️⃣ File Viewing & Editing 📄

✔️ cat <file> → Display file content
✔️ less <file> → View file content page by page
✔️ tail -f <file> → View last 10 lines of a file in real-time
✔️ head -n <num> <file> → Show first N lines of a file
✔️ nano <file> → Open file in Nano editor
✔️ vi <file> → Open file in Vi editor
✔️ sed 's/old/new/g' <file> → Replace text in a file
✔️ awk '{print $1}' <file> → Extract specific columns from a file



4️⃣ User Management 👤

✔️ whoami → Show current logged-in user
✔️ who → Show all logged-in users
✔️ id → Show user ID and group ID
✔️ adduser <username> → Create a new user
✔️ passwd <username> → Change user password
✔️ deluser <username> → Delete a user
✔️ usermod -aG <group> <username> → Add a user to a group



5️⃣ Process Management 🔄

✔️ ps aux → Show all running processes
✔️ top → Show real-time CPU & memory usage
✔️ htop → Interactive process viewer
✔️ kill <PID> → Kill a process by PID
✔️ killall <process> → Kill all processes by name
✔️ pkill -9 <process> → Force kill a process
✔️ nice -n <priority> <command> → Run a process with a priority
✔️ nohup <command> & → Run a process in the background



6️⃣ Disk Management 💾

✔️ df -h → Show disk usage in human-readable format
✔️ du -sh <dir> → Show disk usage of a directory
✔️ lsblk → List information about block devices
✔️ mount <device> <mount_point> → Mount a filesystem
✔️ umount <device> → Unmount a filesystem
✔️ fsck <device> → Check and repair a filesystem
✔️ mkfs.ext4 <device> → Format a partition with ext4 filesystem



7️⃣ Network Commands 🌐

✔️ ifconfig or ip a → Show network interface details
✔️ ping <host> → Check network connectivity
✔️ netstat -tulnp → Show open ports and listening services
✔️ ss -tulnp → Show active network connections
✔️ traceroute <host> → Show the path of packets
✔️ wget <URL> → Download a file from the internet
✔️ curl -I <URL> → Fetch HTTP headers from a URL
✔️ scp <file> user@host:/path/ → Securely copy files to a remote server
✔️ rsync -av <source> <destination> → Sync files between directories



8️⃣ Log Management 📜

✔️ tail -f /var/log/syslog → View system logs in real-time
✔️ journalctl -xe → View extended logs
✔️ grep "error" /var/log/syslog → Filter logs for errors
✔️ dmesg | less → View boot logs
✔️ cat /var/log/auth.log → Check authentication logs



9️⃣ Package Management 📦

🔹 Debian-based (Ubuntu, Debian)
✔️ apt update → Update package list
✔️ apt upgrade → Upgrade installed packages
✔️ apt install <package> → Install a package
✔️ apt remove <package> → Remove a package

🔹 RHEL-based (CentOS, Fedora)
✔️ yum update → Update package list
✔️ yum install <package> → Install a package
✔️ yum remove <package> → Remove a package



🔟 Services & Systemd Management ⚙️

✔️ systemctl start <service> → Start a service
✔️ systemctl stop <service> → Stop a service
✔️ systemctl restart <service> → Restart a service
✔️ systemctl enable <service> → Enable service on boot
✔️ systemctl status <service> → Show service status



1️⃣1️⃣ SSH & Remote Access 🔑

✔️ ssh user@host → Connect to a remote server
✔️ ssh -i key.pem user@host → Connect using SSH key
✔️ scp file.txt user@host:/path/ → Copy files securely
✔️ rsync -avz user@host:/path/ /local/path/ → Sync files remotely



1️⃣2️⃣ Scheduling Tasks (Cron Jobs) ⏳

✔️ crontab -e → Edit cron jobs
✔️ crontab -l → List scheduled cron jobs
✔️ echo "0 2 * * * /path/script.sh" | crontab - → Schedule a daily script



1️⃣3️⃣ Miscellaneous Useful Commands 🔥

✔️ alias ll='ls -lah' → Create a shortcut for commands
✔️ history | grep <command> → Search command history
✔️ echo $SHELL → Show current shell
✔️ date → Display current date and time
✔️ uptime → Show system uptime
✔️ env → Show environment variables
✔️ uname -r → Show Linux kernel version
✔️ shutdown -h now → Shutdown the system



📌 Summary & Next Steps 🚀

✔️ These 100 essential Linux commands will help you efficiently manage servers, automate tasks, and troubleshoot issues as a DevOps Engineer.
✔️ Now, let's deep dive into each section starting with Linux Basics in detail!

📢 Which topic should we cover next? Linux File System, User Management, or Networking? 🚀


No comments:

Post a Comment

Terraform State Deep Dive: Why it's Crucial and How to Manage It

Terraform State Deep Dive: Why it's Crucial and How to Manage It ...