The Ultimate Guide to Unix/Linux Commands with Examples
Unix/Linux is a powerful operating system, widely used by developers and system administrators. Mastering its command-line tools enhances productivity and helps you manage files, processes, permissions, and systems efficiently. This guide categorizes the most essential Unix/Linux commands by function — with practical examples included.
📁 File and Directory Commands
Listing and Navigating Directories
File Viewing and Creation
File and Directory Operations
⚙️ Process Management
View Running Processes
Terminate Processes
Job Control
🔒 File Permissions
Permission Basics
Each permission level is represented numerically:
-
r(read) = 4 -
w(write) = 2 -
x(execute) = 1
Change File Permissions
🔍 Search and Find
Using grep to Search Patterns
Count Lines
Locate Files and Processes
🖥️ System Information
General System Details
CPU & Memory
Disk and Resource Usage
Locate Executables
📦 Compression and Archives
Tar Commands
Gzip Compression
🌐 Networking Commands
Basic Network Utilities
⌨️ Keyboard Shortcuts & Command History
Handy Shortcuts
-
Ctrl + C: Terminate current command -
Ctrl + Z: Pause current command -
Ctrl + D: Logout/EOF -
Ctrl + W: Delete word -
Ctrl + U: Delete entire line -
Ctrl + R: Reverse search command history -
!!: Repeat last command -
exit: Logout
Command History
✍️ Practical File Editing and Examples
Create a File
View and Edit a File
Add this content:
Save and Exit in vi:
-
Press
ito insert -
Press
Esc, then type:wqand press Enter
📄 Specific Line Display
View Top/Bottom Lines
Compare Two Files
✅ Summary of Categories
| Category | Commands |
|---|---|
| 📁 File Management | ls, cd, pwd, cp, mv, rm, touch |
| 🔄 Process Management | ps, top, kill, fg, bg, pkill |
| 🔒 Permissions | chmod, ls -ltr |
| 🔍 Searching | grep, find, locate, pgrep |
| 🖥️ System Info | date, uptime, uname, df, free |
| 📦 Compression | tar, gzip |
| 🌐 Networking | ping, wget, dig, whois |
| ⌨️ Shortcuts | Ctrl+C, !!, Ctrl+R, exit |
Comments
Post a Comment