Mastering Linux Commands: Your Ultimate Cheat Sheet!

Listen to this Post

Whether you’re a beginner stepping into the world of Linux or an experienced professional looking for a quick reference, this comprehensive guide covers essential Linux commands for:

  • File & Directory Management
  • Process & Disk Management
  • Networking & Remote Access
  • User & Group Management
  • System Monitoring & Troubleshooting
  • Containerization (Docker, Kubernetes)
  • CI/CD, Cloud Services & Automation (Ansible, Terraform)
  • Security, Backup, and More!

This resource is packed with commands and their use cases to streamline your workflow and enhance productivity.

You Should Know:

File & Directory Management

  • ls -la: List all files in a directory, including hidden files.
  • cp -r source_dir destination_dir: Copy directories recursively.
  • rm -rf dir_name: Remove a directory and its contents forcefully.
  • chmod 755 file_name: Change file permissions to read, write, and execute for the owner, and read/execute for others.
  • find /path -name "*.log": Find files with a `.log` extension in a specific directory.

Process & Disk Management

  • ps aux: Display all running processes.
  • kill -9 PID: Forcefully terminate a process by its Process ID.
  • df -h: Check disk space usage in a human-readable format.
  • du -sh /path: Check the size of a directory.

Networking & Remote Access

– `ifconfig` or ip a: Display network interface configurations.
ping google.com: Check connectivity to a remote server.
ssh user@remote_host: Connect to a remote server via SSH.
scp file.txt user@remote_host:/path: Securely copy files to a remote server.

User & Group Management

  • useradd username: Add a new user.
  • passwd username: Set or change a user’s password.
  • usermod -aG groupname username: Add a user to a group.
  • groupadd groupname: Create a new group.

System Monitoring & Troubleshooting

  • top: Display real-time system processes and resource usage.
  • htop: Interactive process viewer (install via sudo apt install htop).
  • journalctl -xe: View system logs for troubleshooting.
  • netstat -tuln: List all open ports and listening services.

Containerization (Docker, Kubernetes)

  • docker ps -a: List all Docker containers (running and stopped).
  • docker build -t image_name .: Build a Docker image from a Dockerfile.
  • kubectl get pods: List all Kubernetes pods in the current namespace.
  • kubectl apply -f deployment.yaml: Deploy a Kubernetes configuration file.

CI/CD, Cloud Services & Automation

  • ansible-playbook playbook.yml: Run an Ansible playbook.
  • terraform init: Initialize a Terraform working directory.
  • terraform apply: Apply changes to reach the desired state.
  • git clone repo_url: Clone a Git repository.
  • git push origin branch_name: Push changes to a remote Git branch.

Security, Backup, and More!

  • sudo ufw enable: Enable the Uncomplicated Firewall (UFW).
  • tar -czvf backup.tar.gz /path: Create a compressed backup of a directory.
  • rsync -avz source/ destination/: Synchronize files between directories.
  • chown user:group file_name: Change file ownership.

What Undercode Say:

Linux commands are the backbone of system administration, DevOps, and cloud computing. Mastering these commands not only enhances productivity but also ensures efficient system management. Whether you’re managing files, troubleshooting systems, or automating workflows, these commands are indispensable. For further learning, explore resources like Linux Documentation and DevOps Tools Tutorials. Keep practicing and experimenting to become a Linux power user!

References:

Reported By: Nitesh Devops – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

Whatsapp
TelegramFeatured Image