Skip to main content

 🚀 𝗧𝗼𝗽 𝗟𝗶𝗻𝘂𝘅 𝗰𝗼𝗺𝗺𝗮𝗻𝗱𝘀 𝘂𝘀𝗲𝗳𝘂𝗹 𝗶𝗻 𝗜𝗻𝘁𝗲𝗿𝘃𝗶𝗲𝘄 𝗳𝗼𝗿 𝗗𝗲𝘃𝗼𝗽𝘀 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿🚀


Linux is the backbone of cloud computing, DevOps, and system administration. Mastering these essential Linux commands can help you troubleshoot, automate, and optimize infrastructure efficiently.


🔹 Basic File & Directory Commands


1️⃣ ls – List files & directories 

2️⃣ cd – Change directory

3️⃣ pwd – Show current directory

4️⃣ mkdir – Create a directory

5️⃣ rm -rf – Remove files & directories


🔹 File Management


6️⃣ touch – Create an empty file

7️⃣ cp – Copy files & directories

8️⃣ mv – Move or rename files

9️⃣ cat – View file contents

🔟 less – Paginated file viewing


🔹 Permissions & Ownership


1️⃣1️⃣ chmod – Change file permissions

1️⃣2️⃣ chown – Change file owner

1️⃣3️⃣ umask – Set default permissions


🔹 Process Management


1️⃣4️⃣ ps – View running processes

1️⃣5️⃣ top – Monitor system performance

1️⃣6️⃣ kill – Terminate processes

1️⃣7️⃣ pkill – Kill processes by name

1️⃣8️⃣ nice / renice – Adjust process priority


🔹 Networking Commands


1️⃣9️⃣ ping – Check network connectivity

2️⃣0️⃣ netstat -tulnp – View open ports

2️⃣1️⃣ ip a – Check IP address

2️⃣2️⃣ nslookup – Query DNS records


🔹 Disk & Storage Management


2️⃣3️⃣ df -h – Check disk space

2️⃣4️⃣ du -sh folder/ – Check directory size

2️⃣5️⃣ mount – Mount filesystems


🔹 User Management


2️⃣6️⃣ whoami – Show current user

2️⃣7️⃣ id – Display user ID & group ID

2️⃣8️⃣ who – List logged-in users

2️⃣9️⃣ passwd – Change password

3️⃣0️⃣ su – Switch user


🔹 Logs & Monitoring


3️⃣1️⃣ uptime – Show system uptime

3️⃣2️⃣ dmesg – View system logs

3️⃣3️⃣ journalctl – Check systemd logs

3️⃣4️⃣ tail -f /var/log/syslog – Monitor logs live


🔹 Package Management


3️⃣5️⃣ apt / yum / dnf – Install packages

3️⃣6️⃣ rpm -q – Query installed RPM packages

3️⃣7️⃣ dpkg -l – List installed Debian packages


🔹 Advanced Commands


3️⃣8️⃣ crontab -e – Schedule tasks

3️⃣9️⃣ systemctl – Manage services

4️⃣0️⃣ tar -cvf backup.tar /dir – Create an archive

4️⃣1️⃣ grep – Search for patterns

4️⃣2️⃣ find – Locate files


🔹 Special Commands for DevOps


4️⃣3️⃣ docker ps – List running containers

4️⃣4️⃣ kubectl get pods – View Kubernetes pods

4️⃣5️⃣ ansible-playbook – Run Ansible automation scripts


🔹 Miscellaneous Commands


4️⃣6️⃣ alias – Create command shortcuts

4️⃣7️⃣ history – View command history

4️⃣8️⃣ env – Show environment variables

4️⃣9️⃣ echo $PATH – Display system path

5️⃣0️⃣ exit – Log out of a session


Basic LINUX Commands 

📂 File Management & Navigation

🔹 ls – List files and directories
🔹 ls -l – List with detailed info
🔹 ls -la – Include hidden files
🔹 cd dir – Change to directory
🔹 cd .. – Move to the parent directory
🔹 cd /dir – Change to an absolute path
🔹 cd – Go to home directory
🔹 pwd – Print current directory
🔹 mkdir dir – Create a directory
🔹 rm file – Delete a file
🔹 rm -f file – Force delete file
🔹 rm -r dir – Delete a directory
🔹 rm -rf dir – Force remove directory
🔹 cp file1 file2 – Copy file
🔹 mv file1 file2 – Rename file
🔹 mv file dir/ – Move file to directory
🔹 touch file – Create/update file
🔹 cat file – View file contents
🔹 tail -f file – View file as it updates


---

🌐 Networking

🔹 ping host – Check connectivity
🔹 whois domain – Get domain info
🔹 dig domain – Get DNS records
🔹 wget file – Download file
🔹 wget -c file – Resume download
🔹 curl URL – Fetch webpage content
🔹 ssh user@host – Remote login


---

⚙ System Info

🔹 date – Show date/time
🔹 uptime – System uptime
🔹 whoami – Show current user
🔹 w – Who is online
🔹 cat /proc/cpuinfo – CPU details
🔹 cat /proc/meminfo – Memory info
🔹 free – Check RAM usage
🔹 du -sh – Show directory size
🔹 df -h – Disk space usage
🔹 uname -a – Kernel info


---

📦 Compression

🔹 tar -cf file.tar files/ – Create archive
🔹 tar -xf file.tar – Extract archive
🔹 tar -tf file.tar – List archive contents


---

🔐 Permissions

🔹 chmod 777 file – Full access for all
🔹 chmod 755 file – rwx for owner, rx for others


---

🛠 Process Management

🔹 ps – View running processes
🔹 ps aux – Detailed process list
🔹 kill PID – Kill a process
🔹 killall process – Kill all instances
🔹 grep "pattern" file – Search for text
🔹 locate file – Find a file
🔹 whereis app – Locate application
🔹 man command – Get command manual

*****Essential Linux Commands for DevOps*****

System Analysis:
• htop - Interactive process viewer with CPU, memory, and load metrics
• netstat -tulpn - Display active network connections and listening ports
• ps aux | grep - Filter and find specific running processes
• lsof - List open files and processes using them
• dmesg - Display kernel-related messages and system logs

File Management:
• find . -name - Search files recursively by name or pattern
• rsync - Efficient file transfer and synchronization tool
• tar -xvf - Extract compressed archives
• grep -r - Search text patterns recursively in files
• sed -i - Stream editor for inline text modifications

Container & Orchestration:
• docker stats - Real-time container resource usage
• docker logs -f - Stream container logs live
• kubectl get pods - List Kubernetes pod status
• crictl pods - Low-level container runtime inspection

Monitoring & Logs:
• tail -f - Follow file updates in real-time
• watch - Execute commands periodically
• vmstat - Report virtual memory statistics
• journalctl - Query systemd journal logs

Network Tools:
• curl -v - HTTP request debugging with headers
• dig - DNS lookup utility
• ss - Socket statistics
• nc - Network testing and data transfer

Performance:
• strace - Trace system calls and signals
• tcpdump - Capture and analyze network traffic
• perf - Performance analysis tools
• sar - Collect and report system activity

System Control:
• systemctl - Control systemd services and units
• chmod/chown - Manage file permissions and ownership
• du -sh - Summarize directory sizes
• screen/tmux - Terminal session management

Comments