Linux Commands for DevOps with Descriptions
System & Process Monitoring
top: Real-time view of running processes and system resource usage.
htop: Enhanced version of `top` with better UI (install separately).
ps aux: Shows all running processes with detailed info.
free -m: Displays system memory usage in MB.
uptime: Shows system load and how long the system has been running.
vmstat: Displays memory, CPU, and I/O statistics.
iostat: Provides CPU and disk I/O statistics.
Disk & File System Management
df -h: Shows disk space usage of file systems (human-readable).
du -sh *: Summarizes disk usage of files/folders in current directory.
mount / umount: Mount or unmount filesystems.
lsblk: Lists block devices and mount points.
fdisk -l: Displays disk partitions.
File & Directory Operations
ls -l: Lists files and directories with details.
cp, mv, rm: Copy, move, or delete files/directories.
mkdir, rmdir: Create or remove directories.
find /path -name "file": Find files by name.
grep "text" file: Search for text within files.
tar -czvf file.tar.gz dir/: Create compressed tar archive.
unzip, tar -xvzf: Extract zip or tar files.
User & Permission Management
adduser, useradd: Add a new user.
passwd: Set or change user password.
chmod: Change file permissions.
chown: Change file ownership.
sudo: Run a command with root privileges.
whoami: Display the current user.
Networking
ping: Test connectivity to another host.
curl, wget: Transfer data from/to servers.
netstat -tuln: Show listening ports and connections.
ss -tuln: Modern replacement for `netstat`.
ip a: Show IP addresses.
hostname -I: Display IP address of the machine.
scp, rsync: Securely copy files to/from remote systems.
nmap: Scan open ports and services (install separately).
Package Management
apt, yum, dnf, zypper: Install/update packages (depends on distro).
apt update && apt upgrade: Update package list and upgrade all packages.
rpm -qa: List installed RPM packages (RHEL-based systems).
Logs & Troubleshooting
journalctl -xe: View system logs (for systemd).
tail -f /var/log/syslog: Continuously view the end of a log file.
dmesg: View kernel messages.
strace: Trace system calls and signals of a process.
System Control & Services
systemctl status service: Check status of a systemd service.
systemctl start/stop/restart service: Manage services.
crontab -e: Edit cron jobs (scheduled tasks).
reboot, shutdown: Restart or shut down the system.
File Permissions & SELinux
ls -lZ: List files with SELinux context (if enabled).
getenforce / setenforce: Check or set SELinux mode.
DevOps-Specific Tools (CLI Usage)
docker, docker-compose: Container management.
kubectl: Kubernetes cluster management.
helm: Kubernetes package manager.
ansible, terraform: Automation and Infrastructure as Code (IaC).
git: Version control.
jenkins-cli: Jenkins command-line interface.