Mastering Linux: The Ultimate Command Cheat Sheet!

Listen to this Post

Linux is the backbone of modern computing, and mastering its commands can elevate your tech skills significantly. Below is a categorized list of essential Linux commands for tech enthusiasts, developers, and cybersecurity experts.

File & Directory Management

– `ls` – List directory contents
– `cd` – Change directory
– `mkdir` – Create a directory
– `rm` – Remove files/directories
– `find` – Search for files

Example:

mkdir new_folder && cd new_folder 
ls -la 

### **Process Management**

– `ps` – Display running processes
– `top` – Dynamic real-time process viewer
– `kill` – Terminate processes by PID
– `bg` / `fg` – Run processes in background/foreground

**Example:**

ps aux | grep "nginx" 
kill -9 1234 

### **Disk Management**

– `df` – Disk space usage
– `du` – Directory space usage
– `fdisk` – Partition table manipulator
– `mount` / `umount` – Mount/unmount filesystems

**Example:**

df -h 
du -sh /var/log 

### **Networking**

– `ping` – Test network connectivity
– `ifconfig` / `ip` – Network interface configuration
– `netstat` – Network statistics
– `ssh` – Secure remote login
– `scp` – Secure file transfer

**Example:**

ping google.com 
ssh user@remote-server 

### **User & Group Management**

– `useradd` – Add a user
– `passwd` – Change password
– `whoami` – Display current user
– `id` – Show user/group info

**Example:**

sudo useradd -m newuser 
sudo passwd newuser 

### **Archiving & Compression**

– `tar` – Archive files
– `gzip` / `bzip2` / `xz` – Compression tools

**Example:**

tar -czvf archive.tar.gz /path/to/dir 

### **Package Management**

– `apt-get` / `yum` / `dnf` – Package managers
– `dpkg` / `rpm` – Low-level package tools

**Example:**

sudo apt-get update && sudo apt-get upgrade 

### **System Monitoring**

– `uptime` – System uptime
– `free` – Memory usage
– `vmstat` – Virtual memory stats
– `lscpu` – CPU information

**Example:**

free -m 
uptime 

### **Text Processing**

– `grep` – Search text patterns
– `sed` – Stream editor
– `awk` – Text processing tool

**Example:**

grep "error" /var/log/syslog 

### **Security & Permissions**

– `chmod` – Change file permissions
– `chown` – Change file ownership
– `sudo` – Execute as superuser

**Example:**

chmod 755 script.sh 
sudo chown user:group file 

### **Automation & Containerization**

– `Docker` – Container management
– `Kubernetes` – Container orchestration
– `Ansible` – Configuration automation

**Example:**

docker ps -a 
kubectl get pods 

### **Cloud & DevOps Tools**

– `AWS CLI` – AWS management
– `Azure CLI` – Azure management
– `GitLab CI` – CI/CD pipelines

**Example:**

aws s3 ls 
gitlab-runner exec docker test 

### **You Should Know:**