Skip to main content

Command Palette

Search for a command to run...

Crucial_Linux_Commands_For_CloudAndDevOpsEngineer

Published
•4 min read•View as Markdown
Crucial_Linux_Commands_For_CloudAndDevOpsEngineer

As a Cloud and DevOps Engineer, mastering Linux commands is crucial for managing cloud infrastructure, automating deployments, and troubleshooting issues. Below is a categorized list of essential Linux commands:


1. System Monitoring & Performance

  • top / htop – Display system processes and resource usage.

  • vmstat – Show system performance statistics.

  • iostat – Monitor CPU and disk I/O performance.

  • free -m – Check available memory.

  • df -h – Check disk space usage.

  • du -sh * – Show disk usage of directories.

  • uptime – Display system uptime.

  • ps aux – View running processes.

  • kill -9 <PID> – Terminate a process forcefully.

  • netstat -tulnp / ss -tulnp – List open ports and services.


2. File Management & Permissions

  • ls -lah – List files with human-readable sizes and hidden files.

  • cp -r src dst – Copy directories recursively.

  • mv oldname newname – Rename/move files.

  • rm -rf dir/ – Remove files/directories recursively.

  • chmod 755 file – Modify file permissions.

  • chown user:group file – Change file ownership.

  • find /path -type f -name "*.log" – Find files by name.

  • locate filename – Find a file quickly.


3. User & Group Management

  • whoami – Display current user.

  • id – Show user ID (UID) and group ID (GID).

  • sudo su - – Switch to root user.

  • adduser username / userdel -r username – Add or remove a user.

  • passwd username – Change user password.

  • usermod -aG groupname username – Add user to a group.

  • groups username – List user's groups.


4. Networking & Connectivity

  • ip a / ifconfig – Show network interfaces.

  • ping google.com – Test network connectivity.

  • traceroute google.com – Trace network path to a host.

  • curl -I https://example.com – Fetch HTTP headers.

  • wget https://example.com/file.zip – Download files from a URL.

  • scp user@host:/path/file . – Secure copy files from a remote server.

  • rsync -avz src/ dest/ – Sync files between directories or servers.


5. Logs & Debugging

  • tail -f /var/log/syslog – View logs in real-time.

  • journalctl -xe – View system logs.

  • dmesg | grep error – Check kernel logs for errors.

  • cat /var/log/auth.log – Check authentication logs.

  • grep "error" /var/log/app.log – Search for "error" in logs.


6. Package Management

  • Debian/Ubuntu:

    • apt update && apt upgrade -y – Update and upgrade packages.

    • apt install package – Install a package.

    • apt remove package – Remove a package.

  • RHEL/CentOS:

    • yum update -y / dnf update -y

    • yum install package / dnf install package

  • Common:

    • dpkg -i package.deb – Install a .deb package.

    • rpm -ivh package.rpm – Install an .rpm package.


7. Process & Job Management

  • & – Run a process in the background (e.g., command &).

  • jobs – List background jobs.

  • fg %1 – Bring job 1 to the foreground.

  • nohup command & – Run a command even after logout.

  • tmux / screen – Persistent terminal sessions.


8. Disk & Partition Management

  • fdisk -l – List disk partitions.

  • lsblk – Show block devices.

  • mount /dev/sdb1 /mnt – Mount a partition.

  • umount /mnt – Unmount a partition.

  • mkfs.ext4 /dev/sdb1 – Format a disk with ext4.


9. Compression & Archiving

  • tar -cvf archive.tar directory/ – Create a tar archive.

  • tar -xvf archive.tar – Extract a tar archive.

  • tar -czvf archive.tar.gz directory/ – Compress using gzip.

  • zip -r archive.zip directory/ – Zip a directory.

  • unzip archive.zip – Extract a zip file.


10. SSH & Remote Access

  • ssh user@host – Connect to a remote server.

  • ssh-keygen -t rsa -b 4096 – Generate an SSH key pair.

  • ssh-copy-id user@host – Copy SSH key to a server.

  • scp file user@host:/path/ – Securely copy files.


11. Cron Jobs & Automation

  • crontab -e – Edit cron jobs.

  • crontab -l – List cron jobs.

  • Example: 0 2 * * * /path/script.sh (Run script at 2 AM daily).


12. Kubernetes & Docker Commands

  • Docker:

    • docker ps – List running containers.

    • docker images – List available images.

    • docker exec -it container_id bash – Access a running container.

    • docker-compose up -d – Start services in the background.

  • Kubernetes:

    • kubectl get pods – List running pods.

    • kubectl logs pod-name – View logs of a pod.

    • kubectl apply -f deployment.yaml – Deploy an application.


13. Cloud-Specific Commands

  • AWS CLI:

    • aws s3 ls – List S3 buckets.

    • aws ec2 describe-instances – Get EC2 instance details.

    • aws rds describe-db-instances – Get RDS instance details.

    • aws configure – Set up AWS CLI credentials.

These commands form the foundation of Linux system administration and are crucial for Cloud and DevOps engineers.