Linux is one of the most powerful operating systems for developers, DevOps engineers, system administrators, cybersecurity professionals, cloud engineers, and power users. Its real strength becomes visible when you stop relying on graphical interfaces and start working confidently from the command line.
The terminal allows you to navigate files, manage processes, inspect hardware, configure networks, control services, automate repetitive tasks, work with containers, troubleshoot systems, and manage remote servers.
This guide contains 1,000 Linux shortcuts, commands, shell techniques, and productivity tricks designed to take you from basic terminal usage to professional Linux administration.
1. Master the Linux Terminal First
Before learning hundreds of commands, become comfortable controlling the terminal itself. Keyboard shortcuts can save enormous amounts of time because you don't need to repeatedly move your cursor or retype commands.
For example, Ctrl + C stops a running command, Ctrl + L clears the screen, and Ctrl + R searches your command history.
Essential terminal shortcuts
| # | Shortcut | What it does |
|---|---|---|
| 1 | Ctrl + C |
Stop the current command |
| 2 | Ctrl + D |
Exit the shell or send EOF |
| 3 | Ctrl + Z |
Suspend the current process |
| 4 | Ctrl + L |
Clear the terminal |
| 5 | Ctrl + A |
Move to the beginning of the line |
| 6 | Ctrl + E |
Move to the end of the line |
| 7 | Ctrl + B |
Move backward one character |
| 8 | Ctrl + F |
Move forward one character |
| 9 | Alt + B |
Move backward one word |
| 10 | Alt + F |
Move forward one word |
| 11 | Ctrl + U |
Delete from cursor to line beginning |
| 12 | Ctrl + K |
Delete from cursor to line end |
| 13 | Ctrl + W |
Delete the previous word |
| 14 | Alt + D |
Delete the next word |
| 15 | Ctrl + Y |
Paste deleted text |
| 16 | Ctrl + T |
Swap the previous two characters |
| 17 | Alt + T |
Swap the previous two words |
| 18 | Ctrl + R |
Search command history |
| 19 | Ctrl + G |
Exit history search |
| 20 | Ctrl + P |
Show previous command |
| 21 | Ctrl + N |
Show next command |
| 22 | Up Arrow |
Previous command |
| 23 | Down Arrow |
Next command |
| 24 | Home |
Beginning of command line |
| 25 | End |
End of command line |
| 26 | Alt + Backspace |
Delete previous word |
| 27 | Ctrl + Backspace |
Delete previous word in supported terminals |
| 28 | Ctrl + Shift + V |
Paste terminal text |
| 29 | Ctrl + Shift + C |
Copy terminal selection |
| 30 | Ctrl + Shift + T |
Open a new terminal tab |
| 31 | Ctrl + Shift + W |
Close terminal tab |
| 32 | Ctrl + Shift + N |
Open a new terminal window |
| 33 | Ctrl + S |
Pause terminal output |
| 34 | Ctrl + Q |
Resume terminal output |
| 35 | Ctrl + \ |
Quit a process with SIGQUIT |
| 36 | Ctrl + X Ctrl + E |
Edit command in an external editor |
| 37 | Ctrl + X Ctrl + U |
Undo a readline change |
| 38 | Ctrl + X Ctrl + X |
Toggle cursor/mark position |
| 39 | Alt + U |
Uppercase the next word |
| 40 | Alt + L |
Lowercase the next word |
| 41 | Alt + C |
Capitalize the next word |
| 42 | Alt + . |
Insert the previous command's last argument |
| 43 | Alt + < |
Move to first history entry |
| 44 | Alt + > |
Move to last history entry |
| 45 | Ctrl + X Ctrl + R |
Reload readline configuration |
| 46 | Ctrl + X Ctrl + V |
Show readline version |
| 47 | Ctrl + X Ctrl + J |
Accept the current line |
| 48 | Ctrl + X Ctrl + X |
Toggle cursor position |
| 49 | Ctrl + D |
Log out when the command line is empty |
| 50 | reset |
Reset a broken terminal |
These shortcuts become second nature with practice. A professional Linux user often navigates and edits commands without touching the mouse.
2. Master Filesystem Navigation
Linux organizes everything into a hierarchical filesystem. Learning how to move through that hierarchy quickly is one of the first skills you should master.
The most important commands are pwd, ls, and cd.
Navigation commands
| # | Command | What it does |
|---|---|---|
| 51 | pwd |
Print current directory |
| 52 | ls |
List directory contents |
| 53 | ls -l |
Detailed listing |
| 54 | ls -a |
Show hidden files |
| 55 | ls -la |
Detailed hidden-file listing |
| 56 | ls -lh |
Human-readable sizes |
| 57 | ls -lt |
Sort by modification time |
| 58 | ls -ltr |
Reverse time sorting |
| 59 | ls -lS |
Sort by file size |
| 60 | ls -R |
Recursively list directories |
| 61 | cd / |
Go to filesystem root |
| 62 | cd ~ |
Go to home directory |
| 63 | cd .. |
Go to parent directory |
| 64 | cd - |
Return to previous directory |
| 65 | cd . |
Reference current directory |
| 66 | cd /tmp |
Enter /tmp
|
| 67 | cd /var/log |
Enter system logs |
| 68 | cd /etc |
Enter configuration directory |
| 69 | cd /usr/bin |
Enter common executable directory |
| 70 | cd /opt |
Enter optional software directory |
| 71 | pushd /path |
Push directory onto stack |
| 72 | popd |
Return to stacked directory |
| 73 | dirs |
Display directory stack |
| 74 | tree |
Display directory tree |
| 75 | tree -L 2 |
Display two directory levels |
| 76 | tree -a |
Include hidden files |
| 77 | find . -maxdepth 1 |
Search current level |
| 78 | find . -type f |
Find files |
| 79 | find . -type d |
Find directories |
| 80 | find . -name "*.log" |
Find log files |
| 81 | find . -iname "*.jpg" |
Case-insensitive filename search |
| 82 | find . -empty |
Find empty files/directories |
| 83 | find . -type f -size +100M |
Find large files |
| 84 | find . -mtime -1 |
Find files modified recently |
| 85 | find . -mmin -60 |
Find files modified within an hour |
| 86 | find . -user username |
Find files owned by a user |
| 87 | find . -perm 777 |
Find files with permission 777 |
| 88 | find . -type f -delete |
Delete matching files |
| 89 | realpath file |
Show absolute path |
| 90 | readlink -f file |
Resolve absolute path |
| 91 | basename /path/file.txt |
Extract filename |
| 92 | dirname /path/file.txt |
Extract directory |
| 93 | namei /path/file |
Inspect path components |
| 94 | ls /bin |
List system binaries |
| 95 | ls /sbin |
List administrative binaries |
| 96 | ls /home |
List user directories |
| 97 | ls /dev |
List devices |
| 98 | ls /proc |
List process information |
| 99 | ls /sys |
List kernel/device information |
| 100 | ls /run |
List runtime information |
The goal isn't simply knowing what /etc or /var contains. You should become comfortable jumping between directories without thinking about the path.
3. Master File Management
Linux gives you precise control over files and directories. Commands such as cp, mv, rm, ln, and stat are fundamental.
File-management commands
| # | Command | What it does |
|---|---|---|
| 101 | touch file |
Create an empty file |
| 102 | touch -a file |
Update access time |
| 103 | touch -m file |
Update modification time |
| 104 | mkdir dir |
Create directory |
| 105 | mkdir -p a/b/c |
Create nested directories |
| 106 | mkdir -m 755 dir |
Create directory with permissions |
| 107 | cp file dest |
Copy file |
| 108 | cp -r dir dest |
Copy directory recursively |
| 109 | cp -a src dest |
Preserve attributes |
| 110 | cp -i file dest |
Ask before overwriting |
| 111 | cp -u file dest |
Copy only newer files |
| 112 | cp -v file dest |
Show copy operations |
| 113 | mv file dest |
Move or rename |
| 114 | mv -i file dest |
Ask before overwriting |
| 115 | mv -v file dest |
Show move operations |
| 116 | rm file |
Delete file |
| 117 | rm -i file |
Confirm deletion |
| 118 | rm -r dir |
Remove directory recursively |
| 119 | rm -f file |
Force deletion |
| 120 | rmdir dir |
Remove empty directory |
| 121 | ln file link |
Create hard link |
| 122 | ln -s target link |
Create symbolic link |
| 123 | readlink link |
Show symlink target |
| 124 | stat file |
Show file metadata |
| 125 | file file |
Identify file type |
| 126 | du file |
Show disk usage |
| 127 | du -h file |
Human-readable usage |
| 128 | du -sh dir |
Show total directory size |
| 129 | du -sh * |
Show size of each item |
| 130 | du -ah |
Show recursive sizes |
| 131 | df |
Show filesystem usage |
| 132 | df -h |
Human-readable filesystem usage |
| 133 | df -T |
Show filesystem types |
| 134 | df -i |
Show inode usage |
| 135 | sync |
Flush filesystem buffers |
| 136 | truncate -s 0 file |
Empty a file |
| 137 | truncate -s 1G file |
Set file size |
| 138 | shred file |
Overwrite file contents |
| 139 | install file dir |
Copy/install file with attributes |
| 140 | mktemp |
Create temporary file |
| 141 | mktemp -d |
Create temporary directory |
| 142 | basename file |
Extract filename |
| 143 | dirname file |
Extract directory |
| 144 | pathchk file |
Check pathname validity |
| 145 | lsattr file |
Show filesystem attributes |
| 146 | chattr +i file |
Make file immutable |
| 147 | chattr -i file |
Remove immutable attribute |
| 148 | getfacl file |
Show ACL permissions |
| 149 | setfacl -m u:user:rwx file |
Set ACL |
| 150 | setfacl -x u:user file |
Remove ACL entry |
Important: Commands such as rm -rf and shred can have serious consequences. Always verify paths before executing destructive commands.
4. Master File Inspection
A Linux professional spends a significant amount of time reading logs, configuration files, application output, and command results.
Viewing and searching content
| # | Command | What it does |
|---|---|---|
| 151 | cat file |
Display file |
| 152 | cat -n file |
Show line numbers |
| 153 | tac file |
Display lines in reverse |
| 154 | less file |
Browse large files |
| 155 | more file |
Paginate content |
| 156 | head file |
Show first lines |
| 157 | head -n 20 file |
Show first 20 lines |
| 158 | tail file |
Show last lines |
| 159 | tail -n 20 file |
Show last 20 lines |
| 160 | tail -f log |
Follow a growing log |
| 161 | tail -F log |
Follow logs across rotation |
| 162 | wc file |
Count lines, words, bytes |
| 163 | wc -l file |
Count lines |
| 164 | wc -w file |
Count words |
| 165 | wc -c file |
Count bytes |
| 166 | wc -m file |
Count characters |
| 167 | nl file |
Number lines |
| 168 | od file |
Display binary/octal data |
| 169 | xxd file |
Display hexadecimal data |
| 170 | hexdump file |
Hexadecimal dump |
| 171 | strings file |
Extract printable strings |
| 172 | cut -d: -f1 file |
Extract first field |
| 173 | paste a b |
Merge files line-by-line |
| 174 | join a b |
Join files on fields |
| 175 | sort file |
Sort lines |
| 176 | sort -r file |
Reverse sort |
| 177 | sort -n file |
Numeric sort |
| 178 | sort -h file |
Human-readable sort |
| 179 | sort -u file |
Sort and remove duplicates |
| 180 | uniq file |
Remove adjacent duplicates |
| 181 | uniq -c file |
Count duplicates |
| 182 | uniq -d file |
Display duplicates |
| 183 | comm a b |
Compare sorted files |
| 184 | diff a b |
Compare files |
| 185 | diff -u a b |
Unified diff |
| 186 | cmp a b |
Compare byte-by-byte |
| 187 | sed -n '1,10p' file |
Print selected lines |
| 188 | awk '{print $1}' file |
Print first column |
| 189 | grep pattern file |
Search text |
| 190 | grep -i pattern file |
Case-insensitive search |
| 191 | grep -n pattern file |
Show matching line numbers |
| 192 | grep -r pattern dir |
Recursive search |
| 193 | grep -v pattern file |
Invert matching |
| 194 | grep -w word file |
Match whole words |
| 195 | grep -E 'regex' file |
Extended regex |
| 196 | grep -F 'text' file |
Literal search |
| 197 | grep -C 2 pattern file |
Show surrounding context |
| 198 | grep -l pattern files |
Show matching filenames |
| 199 | grep -L pattern files |
Show nonmatching files |
| 200 | grep -o pattern file |
Show only matching text |
These commands become especially powerful when combined with pipes.
5. Master Text Processing
Linux becomes extremely powerful when you learn to manipulate text directly from the command line.
grep, sed, awk, cut, tr, sort, uniq, and xargs form a powerful toolkit for processing structured and unstructured text.
Text-processing mastery
| # | Command | What it does |
|---|---|---|
| 201 | sed 's/a/b/' file |
Replace first match |
| 202 | sed 's/a/b/g' file |
Replace all matches |
| 203 | sed -i 's/a/b/g' file |
Edit file in place |
| 204 | sed -n '/error/p' file |
Print matching lines |
| 205 | sed -n '5p' file |
Print line 5 |
| 206 | sed '5d' file |
Delete line 5 from output |
| 207 | sed '1d' file |
Skip first line |
| 208 | sed '$d' file |
Remove final line from output |
| 209 | awk '{print $NF}' file |
Print last field |
| 210 | awk '{print NR,$0}' file |
Add line numbers |
| 211 | awk -F: '{print $1}' /etc/passwd |
Extract usernames |
| 212 | awk '$3 > 100 {print}' file |
Filter numeric values |
| 213 | awk 'BEGIN{print "Start"}' |
Run initialization |
| 214 | awk 'END{print NR}' file |
Count records |
| 215 | cut -c1-10 file |
Extract characters |
| 216 | cut -d, -f2 file |
Extract CSV field |
| 217 | tr a-z A-Z |
Convert case |
| 218 | tr -d '\r' |
Remove carriage returns |
| 219 | tr -s ' ' |
Collapse repeated spaces |
| 220 | rev file |
Reverse lines |
| 221 | fold -w 80 file |
Wrap long lines |
| 222 | fmt file |
Format paragraphs |
| 223 | column -t file |
Align columns |
| 224 | expand file |
Convert tabs to spaces |
| 225 | unexpand file |
Convert spaces to tabs |
| 226 | printf '%s\n' text |
Formatted output |
| 227 | echo "$var" |
Print variable |
| 228 | echo -n text |
Print without newline |
| 229 | printf '%q\n' "$var" |
Shell-escaped output |
| 230 | seq 1 10 |
Generate sequence |
| 231 | seq 10 -1 1 |
Generate reverse sequence |
| 232 | yes |
Repeatedly output text |
| 233 | xargs command |
Build command arguments |
| 234 | xargs -n1 command |
One argument per execution |
| 235 | xargs -P4 command |
Run four jobs in parallel |
| 236 | tee file |
Display and save output |
| 237 | tee -a file |
Append output |
| 238 | shuf file |
Randomize lines |
| 239 | shuf -n 5 file |
Select random lines |
| 240 | split file |
Split files |
| 241 | split -l 1000 file |
Split by line count |
| 242 | csplit file pattern |
Split around pattern |
| 243 | paste -sd, file |
Join lines |
| 244 | `grep \ | sort \ |
| 245 | {% raw %}`sort \ | uniq -c` |
| 246 | `sort \ | uniq -c \ |
| 247 | {% raw %}awk '{sum += $1} END {print sum}'
|
Sum a column |
| 248 | awk '{sum += $1} END {print sum/NR}' |
Calculate average |
| 249 | grep -oE '[0-9]+' file |
Extract numbers |
| 250 | grep -oE 'https?://[^ ]+' file |
Extract URLs |
6. Master Linux Permissions
Linux permissions are fundamental to system administration and security.
Every file has an owner, a group, and permission settings for the owner, group, and others.
Permissions and ownership
| # | Command | What it does |
|---|---|---|
| 251 | ls -l |
Inspect permissions |
| 252 | chmod 755 file |
Set common executable permissions |
| 253 | chmod 644 file |
Set common file permissions |
| 254 | chmod 700 file |
Owner-only access |
| 255 | chmod 600 file |
Owner read/write only |
| 256 | chmod +x file |
Add execute permission |
| 257 | chmod -x file |
Remove execute permission |
| 258 | chmod u+x file |
Add owner execute permission |
| 259 | chmod g+w file |
Add group write permission |
| 260 | chmod o-r file |
Remove others' read permission |
| 261 | chmod a+r file |
Add read permission |
| 262 | chmod -R 755 dir |
Recursively modify permissions |
| 263 | chown user file |
Change owner |
| 264 | chown user:group file |
Change owner and group |
| 265 | chown -R user:group dir |
Recursively change ownership |
| 266 | chgrp group file |
Change group |
| 267 | umask |
Show default permission mask |
| 268 | umask 022 |
Set default permission mask |
| 269 | id |
Show user identity |
| 270 | id user |
Show another user's identity |
| 271 | whoami |
Show current username |
| 272 | groups |
Show group memberships |
| 273 | groups user |
Show user's groups |
| 274 | who |
Show logged-in users |
| 275 | w |
Show user activity |
| 276 | last |
Show login history |
| 277 | lastlog |
Show last-login information |
| 278 | passwd |
Change password |
| 279 | sudo command |
Run command as administrator |
| 280 | sudo -i |
Open root login shell |
| 281 | sudo -s |
Open privileged shell |
| 282 | sudo -u user command |
Run as another user |
| 283 | sudo -l |
Show sudo permissions |
| 284 | su user |
Switch user |
| 285 | su - |
Switch to root/login shell |
| 286 | visudo |
Safely edit sudoers configuration |
| 287 | getent passwd user |
Query user database |
| 288 | getent group group |
Query group database |
| 289 | useradd user |
Create user |
| 290 | userdel user |
Delete user |
| 291 | usermod -aG group user |
Add user to group |
| 292 | groupadd group |
Create group |
| 293 | groupdel group |
Delete group |
| 294 | gpasswd -a user group |
Add user to group |
| 295 | gpasswd -d user group |
Remove user from group |
| 296 | chage -l user |
Show password aging |
| 297 | chage -M 90 user |
Set password expiration |
| 298 | loginctl list-users |
List users |
| 299 | loginctl user-status |
Show session status |
| 300 | getfacl file |
Inspect ACLs |
Understanding permissions is more important than memorizing numerical modes. Learn what r, w, and x mean for files and directories, then master symbolic and numeric notation.
7. Master Processes and Jobs
A Linux system can run hundreds or thousands of processes simultaneously. Professional Linux users need to know how to inspect, control, prioritize, and troubleshoot them.
Process management
| # | Command | What it does |
|---|---|---|
| 301 | ps |
Show processes |
| 302 | ps aux |
Show all processes |
| 303 | ps -ef |
Full process listing |
| 304 | ps aux --sort=-%cpu |
Sort by CPU |
| 305 | ps aux --sort=-%mem |
Sort by memory |
| 306 | top |
Interactive process monitor |
| 307 | htop |
Enhanced process monitor |
| 308 | pgrep name |
Find process IDs |
| 309 | pidof program |
Find program PIDs |
| 310 | pstree |
Display process tree |
| 311 | kill PID |
Send termination signal |
| 312 | kill -9 PID |
Force-kill process |
| 313 | kill -STOP PID |
Stop process |
| 314 | kill -CONT PID |
Continue process |
| 315 | killall name |
Kill processes by name |
| 316 | pkill pattern |
Kill matching processes |
| 317 | nice command |
Start with adjusted priority |
| 318 | nice -n 10 command |
Start with lower priority |
| 319 | renice 10 -p PID |
Change process priority |
| 320 | jobs |
Show shell jobs |
| 321 | fg |
Bring job to foreground |
| 322 | fg %1 |
Bring job 1 foreground |
| 323 | bg |
Resume background job |
| 324 | bg %1 |
Resume job 1 |
| 325 | command & |
Run command in background |
| 326 | nohup command & |
Keep process running after logout |
| 327 | disown |
Detach shell job |
| 328 | disown -h %1 |
Keep job alive after logout |
| 329 | wait |
Wait for background jobs |
| 330 | wait PID |
Wait for process |
| 331 | time command |
Measure execution time |
| 332 | /usr/bin/time command |
Detailed resource timing |
| 333 | watch command |
Repeat command |
| 334 | watch -n 1 command |
Repeat every second |
| 335 | timeout 10 command |
Limit execution |
| 336 | timeout 10s command |
Ten-second timeout |
| 337 | strace command |
Trace system calls |
| 338 | strace -p PID |
Trace running process |
| 339 | lsof -p PID |
Show files opened by process |
| 340 | lsof -i |
Show network connections |
| 341 | lsof /path/file |
Find process using file |
| 342 | fuser file |
Find processes using file |
| 343 | fuser -k port/tcp |
Kill process using port |
| 344 | vmstat |
System statistics |
| 345 | vmstat 1 |
Monitor statistics |
| 346 | iostat |
CPU/I/O statistics |
| 347 | mpstat |
CPU statistics |
| 348 | pidstat |
Per-process statistics |
| 349 | sar |
System activity reporting |
| 350 | uptime |
Show load averages |
A key professional habit is to inspect before killing. Identify the process, understand what it is doing, and then choose the least disruptive action.
8. Master Environment Variables and Bash
Environment variables control much of the behavior of Linux applications and shells.
The PATH variable, for example, determines where the shell searches for executable commands.
Environment and shell techniques
| # | Command | What it does |
|---|---|---|
| 351 | env |
Show environment variables |
| 352 | printenv |
Print environment |
| 353 | printenv PATH |
Show PATH |
| 354 | echo $HOME |
Show home directory |
| 355 | echo $USER |
Show username |
| 356 | echo $SHELL |
Show shell |
| 357 | echo $PWD |
Show current directory |
| 358 | echo $OLDPWD |
Show previous directory |
| 359 | echo $? |
Show last exit status |
| 360 | echo $$ |
Show shell PID |
| 361 | echo $! |
Show last background PID |
| 362 | echo $# |
Show argument count |
| 363 | echo $0 |
Show script name |
| 364 | export VAR=value |
Export variable |
| 365 | unset VAR |
Remove variable |
| 366 | VAR=value command |
Set variable for one command |
| 367 | readonly VAR=value |
Make variable read-only |
| 368 | set |
Show shell variables |
| 369 | set -x |
Enable tracing |
| 370 | set +x |
Disable tracing |
| 371 | set -e |
Exit on command failure |
| 372 | set -u |
Error on unset variables |
| 373 | set -o pipefail |
Detect pipeline failures |
| 374 | set -euxo pipefail |
Strict shell mode |
| 375 | source file |
Load shell configuration |
| 376 | . file |
Source a file |
| 377 | alias |
Show aliases |
| 378 | alias ll='ls -lah' |
Create alias |
| 379 | unalias ll |
Remove alias |
| 380 | type command |
Identify command |
| 381 | type -a command |
Show all command locations |
| 382 | command -v command |
Locate executable |
| 383 | which command |
Locate executable |
| 384 | whereis command |
Locate binary and documentation |
| 385 | hash |
Show shell command cache |
| 386 | hash -r |
Clear command cache |
| 387 | history |
Show history |
| 388 | history 20 |
Show recent history |
| 389 | !! |
Repeat previous command |
| 390 | !$ |
Reuse last argument |
| 391 | !* |
Reuse all arguments |
| 392 | !^ |
Reuse first argument |
| 393 | !n |
Execute history entry |
| 394 | !-2 |
Execute previous-previous command |
| 395 | !string |
Execute latest matching command |
| 396 | ^old^new^ |
Replace text in previous command |
| 397 | HISTCONTROL=ignoredups |
Ignore duplicate history |
| 398 | HISTSIZE=10000 |
Increase history size |
| 399 | HISTFILE=~/.bash_history |
Define history file |
| 400 | history -c |
Clear current history |
9. Master Pipes and Redirection
The Unix philosophy is built around small programs that do one thing well and can be combined.
The pipe operator | is one of the most important concepts to understand.
For example:
ps aux | grep nginx
The output of ps becomes the input of grep.
Pipes and redirection
| # | Command | What it does |
|---|---|---|
| 401 | command > file |
Redirect stdout |
| 402 | command >> file |
Append stdout |
| 403 | command < file |
Redirect stdin |
| 404 | command 2> file |
Redirect stderr |
| 405 | command 2>> file |
Append stderr |
| 406 | command &> file |
Redirect stdout and stderr |
| 407 | command 2>&1 |
Redirect stderr to stdout |
| 408 | command 1>&2 |
Redirect stdout to stderr |
| 409 | command > /dev/null |
Discard output |
| 410 | command 2> /dev/null |
Discard errors |
| 411 | command &> /dev/null |
Discard all output |
| 412 | `command \ | less` |
| 413 | `command \ | grep text` |
| 414 | `command \ | sort` |
| 415 | `command \ | uniq` |
| 416 | `command \ | wc -l` |
| 417 | `command \ | tee file` |
| 418 | `command1 \ | command2` |
| 419 | command1 && command2 |
Run second after success |
| 420 | `command1 \ | \ |
| 421 | {% raw %}command1 ; command2
|
Run commands sequentially |
| 422 | (command1; command2) |
Run in subshell |
| 423 | { command1; command2; } |
Run in current shell |
| 424 | $(command) |
Command substitution |
| 425 | `command` |
Legacy command substitution |
| 426 | VAR=$(command) |
Store command output |
| 427 | <(command) |
Process substitution |
| 428 | >(command) |
Output process substitution |
| 429 | xargs |
Convert input into arguments |
| 430 | xargs -0 |
Process null-delimited input |
| 431 | `find ... -print0 \ | xargs -0` |
| 432 | `cmd1 \ | cmd2 \ |
| 433 | {% raw %}`yes \ | command` |
| 434 | `printf ... \ | command` |
| 435 | `cat file \ | command` |
| 436 | command <<EOF |
Start heredoc |
| 437 | command <<'EOF' |
Literal heredoc |
| 438 | command <<< "$var" |
Here-string |
| 439 | exec > file |
Redirect shell stdout |
| 440 | exec 2> errors.log |
Redirect shell errors |
| 441 | exec 3>file |
Open file descriptor 3 |
| 442 | >&3 |
Redirect to descriptor 3 |
| 443 | 0<&3 |
Read from descriptor 3 |
| 444 | command & |
Background command |
| 445 | command &>/dev/null & |
Silent background command |
| 446 | nohup command >/tmp/out 2>&1 & |
Persistent background command |
| 447 | `command \ | & other` |
| 448 | coproc name command |
Start coprocess |
| 449 | wait $! |
Wait for background process |
| 450 | exit $? |
Exit with previous status |
Once you understand pipes and redirection, Linux commands stop being isolated tools and become building blocks.
10. Master Archives and Compression
Linux systems frequently deal with compressed logs, backups, source-code packages, application releases, and deployment artifacts.
Compression commands
| # | Command | What it does |
|---|---|---|
| 451 | tar -cf archive.tar files |
Create tar archive |
| 452 | tar -xf archive.tar |
Extract tar archive |
| 453 | tar -tf archive.tar |
List archive contents |
| 454 | tar -czf archive.tar.gz dir |
Create gzip archive |
| 455 | tar -xzf archive.tar.gz |
Extract gzip archive |
| 456 | tar -cjf archive.tar.bz2 dir |
Create bzip2 archive |
| 457 | tar -xjf archive.tar.bz2 |
Extract bzip2 archive |
| 458 | tar -cJf archive.tar.xz dir |
Create xz archive |
| 459 | tar -xJf archive.tar.xz |
Extract xz archive |
| 460 | tar -tvf archive.tar |
Verbose listing |
| 461 | tar -rf archive.tar file |
Append to tar |
| 462 | tar -uf archive.tar dir |
Update archive |
| 463 | tar --delete -f archive.tar file |
Delete archive member |
| 464 | gzip file |
Compress with gzip |
| 465 | gzip -d file.gz |
Decompress gzip |
| 466 | gunzip file.gz |
Decompress gzip |
| 467 | gzip -k file |
Keep original |
| 468 | bzip2 file |
Compress with bzip2 |
| 469 | bunzip2 file.bz2 |
Decompress bzip2 |
| 470 | xz file |
Compress with xz |
| 471 | unxz file.xz |
Decompress xz |
| 472 | zip archive.zip files |
Create ZIP |
| 473 | zip -r archive.zip dir |
ZIP directory |
| 474 | unzip archive.zip |
Extract ZIP |
| 475 | unzip -l archive.zip |
List ZIP contents |
| 476 | zipinfo archive.zip |
Inspect ZIP |
| 477 | 7z a archive.7z files |
Create 7z archive |
| 478 | 7z x archive.7z |
Extract 7z |
| 479 | zcat file.gz |
Read gzip directly |
| 480 | bzcat file.bz2 |
Read bzip2 directly |
| 481 | xzcat file.xz |
Read xz directly |
| 482 | zgrep pattern file.gz |
Search gzip |
| 483 | zless file.gz |
Browse gzip |
| 484 | zmore file.gz |
Paginate gzip |
| 485 | tar -C dir -xf archive.tar |
Extract to directory |
| 486 | tar --exclude='*.log' |
Exclude files |
| 487 | tar --exclude=dir |
Exclude directory |
| 488 | tar -czvf archive.tar.gz dir |
Verbose archive creation |
| 489 | tar -xvzf archive.tar.gz |
Verbose extraction |
| 490 | gzip -9 file |
Maximum gzip compression |
| 491 | gzip -1 file |
Faster gzip compression |
| 492 | xz -9 file |
High xz compression |
| 493 | zip -9 archive.zip file |
Maximum ZIP compression |
| 494 | `tar -cf - dir \ | gzip > archive.tar.gz` |
| 495 | tar -xf - < archive.tar |
Extract from stdin |
| 496 | `tar -czf - dir \ | ssh host 'cat > archive.tar.gz'` |
| 497 | `tar -czf - dir \ | ssh host 'tar -xzf -'` |
| 498 | gzip -l file.gz |
Show compression statistics |
| 499 | file archive.tar.gz |
Identify archive |
| 500 | du -sh archive |
Check archive size |
11. Master Disk and Storage Management
Storage problems are common in production environments. Knowing how to inspect disks, partitions, filesystems, mounts, and inodes is essential.
Storage commands
| # | Command | What it does |
|---|---|---|
| 501 | lsblk |
List block devices |
| 502 | lsblk -f |
Show filesystem information |
| 503 | blkid |
Show block-device UUIDs |
| 504 | df -h |
Show filesystem capacity |
| 505 | du -sh . |
Show current directory size |
| 506 | du -sh * |
Show item sizes |
| 507 | `du -ah . \ | sort -h` |
| 508 | ncdu |
Interactive disk analyzer |
| 509 | mount |
Show mounted filesystems |
| 510 | mount /dev/sdb1 /mnt |
Mount filesystem |
| 511 | umount /mnt |
Unmount filesystem |
| 512 | findmnt |
Show mounts |
| 513 | findmnt /path |
Identify mount |
| 514 | cat /etc/fstab |
View mount configuration |
| 515 | swapon --show |
Show swap |
| 516 | free -h |
Show memory and swap |
| 517 | sync |
Flush buffers |
| 518 | fdisk -l |
List partitions |
| 519 | parted -l |
List partition information |
| 520 | file -s /dev/sdb |
Identify device data |
| 521 | dd if=/dev/zero of=file bs=1M count=10 |
Create test file |
| 522 | dd if=file of=copy |
Raw copy |
| 523 | lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINT |
Custom block listing |
| 524 | du --max-depth=1 -h |
Directory-level usage |
| 525 | df -Th |
Filesystem type and usage |
| 526 | df -ih |
Inode usage |
| 527 | tune2fs -l /dev/device |
Inspect ext filesystem |
| 528 | e2fsck |
Check ext filesystem |
| 529 | fsck |
Check filesystem |
| 530 | mkswap /dev/device |
Create swap area |
| 531 | swapon /dev/device |
Enable swap |
| 532 | swapoff /dev/device |
Disable swap |
| 533 | fstrim -av |
Trim supported filesystems |
| 534 | ls /dev/disk/by-uuid |
List disks by UUID |
| 535 | ls /dev/disk/by-label |
List disks by label |
| 536 | blkid /dev/sda1 |
Show partition UUID |
| 537 | mount -o ro device mountpoint |
Mount read-only |
| 538 | mount -a |
Mount fstab filesystems |
| 539 | umount -l mountpoint |
Lazy unmount |
| 540 | umount -f mountpoint |
Force unmount where supported |
| 541 | du -x |
Stay on one filesystem |
| 542 | du -d 1 |
Limit depth |
| 543 | df -P |
POSIX-style output |
| 544 | lsblk -S |
List SCSI devices |
| 545 | lsblk -t |
Show device topology |
| 546 | udevadm info |
Inspect device information |
| 547 | udevadm monitor |
Monitor device events |
| 548 | `dmesg \ | grep -i usb` |
| 549 | `dmesg \ | tail` |
| 550 | journalctl -k |
Show kernel journal |
12. Master Linux Networking
Networking is one of the most important areas for Linux professionals.
Whether you're troubleshooting a web server, configuring a cloud instance, debugging DNS, or investigating an unreachable service, networking commands help you understand what is happening.
Networking commands
| # | Command | What it does |
|---|---|---|
| 551 | ip addr |
Show IP addresses |
| 552 | ip link |
Show interfaces |
| 553 | ip route |
Show routing table |
| 554 | ip neigh |
Show neighbor table |
| 555 | ip -br addr |
Compact IP display |
| 556 | ip -br link |
Compact interface display |
| 557 | ip link set eth0 up |
Enable interface |
| 558 | ip link set eth0 down |
Disable interface |
| 559 | ip addr add IP/24 dev eth0 |
Add IP address |
| 560 | ip addr del IP/24 dev eth0 |
Remove IP address |
| 561 | ip route get 8.8.8.8 |
Show route to destination |
| 562 | ping host |
Test connectivity |
| 563 | ping -c 4 host |
Send four pings |
| 564 | ping6 host |
Test IPv6 |
| 565 | traceroute host |
Trace route |
| 566 | tracepath host |
Trace route and MTU |
| 567 | mtr host |
Combine ping and traceroute |
| 568 | curl URL |
Make HTTP request |
| 569 | curl -I URL |
Show HTTP headers |
| 570 | curl -L URL |
Follow redirects |
| 571 | curl -O URL |
Download resource |
| 572 | curl -o file URL |
Save response to file |
| 573 | curl -s URL |
Silent request |
| 574 | curl -v URL |
Verbose request |
| 575 | curl -X POST URL |
Send POST request |
| 576 | curl -d 'data' URL |
Send request data |
| 577 | curl -H 'Header: value' URL |
Add HTTP header |
| 578 | wget URL |
Download resource |
| 579 | wget -c URL |
Resume download |
| 580 | wget -q URL |
Quiet download |
| 581 | wget -r URL |
Recursive download |
| 582 | dig domain |
DNS query |
| 583 | dig +short domain |
Concise DNS result |
| 584 | dig MX domain |
Query MX records |
| 585 | dig NS domain |
Query NS records |
| 586 | host domain |
DNS lookup |
| 587 | nslookup domain |
DNS lookup |
| 588 | resolvectl status |
Show DNS configuration |
| 589 | resolvectl query domain |
Query DNS |
| 590 | ss -tuln |
Show listening sockets |
| 591 | ss -tunap |
Show connections and processes |
| 592 | ss -ltn |
Show listening TCP ports |
| 593 | ss -lun |
Show listening UDP ports |
| 594 | nc -vz host port |
Test TCP port |
| 595 | nc -l port |
Listen on port |
| 596 | hostname |
Show hostname |
| 597 | hostname -I |
Show local IP addresses |
| 598 | uname -n |
Show hostname |
| 599 | arp -a |
Show ARP cache where available |
| 600 | ethtool eth0 |
Inspect Ethernet interface |
13. Master SSH and Remote Linux
Linux professionals rarely work only on their local machine. SSH is the foundation of remote Linux administration.
SSH commands
| # | Command | What it does |
|---|---|---|
| 601 | ssh user@host |
Connect to remote host |
| 602 | ssh -p 2222 user@host |
Connect using custom port |
| 603 | ssh -i key user@host |
Use private key |
| 604 | ssh -v user@host |
Debug SSH |
| 605 | ssh -vvv user@host |
Detailed SSH debugging |
| 606 | ssh-keygen |
Generate SSH key |
| 607 | ssh-keygen -t ed25519 |
Generate Ed25519 key |
| 608 | ssh-keygen -t rsa |
Generate RSA key |
| 609 | ssh-keygen -lf key.pub |
Show fingerprint |
| 610 | ssh-copy-id user@host |
Install public key |
| 611 | ssh-add key |
Add key to agent |
| 612 | ssh-add -l |
List agent keys |
| 613 | ssh-add -D |
Remove agent keys |
| 614 | ssh-agent bash |
Start SSH agent shell |
| 615 | scp file user@host:/path |
Copy file remotely |
| 616 | scp user@host:/path/file . |
Download remote file |
| 617 | scp -r dir user@host:/path |
Copy directory |
| 618 | rsync file host:/path |
Synchronize file |
| 619 | rsync -av dir host:/path |
Synchronize directory |
| 620 | rsync -avz dir host:/path |
Compress transfer |
| 621 | rsync --delete src dest |
Mirror directories |
| 622 | rsync --dry-run src dest |
Preview synchronization |
| 623 | ssh host command |
Execute remote command |
| 624 | ssh host 'sudo command' |
Execute privileged command |
| 625 | ssh -L 8080:localhost:80 host |
Local port forwarding |
| 626 | ssh -R 8080:localhost:80 host |
Remote port forwarding |
| 627 | ssh -D 1080 host |
SOCKS proxy |
| 628 | ssh -N host |
Don't execute remote command |
| 629 | ssh -fN host |
Background SSH forwarding |
| 630 | ssh -o ServerAliveInterval=60 host |
Keep connection alive |
| 631 | ssh -G host |
Show effective configuration |
| 632 | ssh-keyscan host |
Retrieve host keys |
| 633 | ~/.ssh/config |
User SSH configuration |
| 634 | ~/.ssh/authorized_keys |
Authorized keys |
| 635 | ~/.ssh/known_hosts |
Known hosts |
| 636 | chmod 700 ~/.ssh |
Protect SSH directory |
| 637 | chmod 600 ~/.ssh/id_ed25519 |
Protect private key |
| 638 | chmod 644 ~/.ssh/id_ed25519.pub |
Protect public key |
| 639 | ssh-keygen -R host |
Remove known host |
| 640 | scp -P port file host:/path |
SCP using custom port |
| 641 | rsync -e ssh src host:/path |
Rsync over SSH |
| 642 | rsync -e 'ssh -p 2222' src host:/path |
Rsync over custom SSH port |
| 643 | ssh user@host 'uptime' |
Check remote uptime |
| 644 | ssh user@host 'df -h' |
Check remote storage |
| 645 | ssh user@host 'free -h' |
Check remote memory |
| 646 | ssh user@host 'ps aux' |
Inspect remote processes |
| 647 | ssh user@host 'journalctl -n 50' |
Inspect recent logs |
| 648 | ssh user@host 'systemctl status service' |
Check remote service |
| 649 | ssh user@host 'ip addr' |
Inspect remote network |
| 650 | ssh user@host 'uname -a' |
Inspect remote kernel |
14. Master Package Management
Linux distributions use different package managers. Learn the package manager used by the distribution you administer.
Debian/Ubuntu
| # | Command | What it does |
|---|---|---|
| 651 | apt update |
Refresh package indexes |
| 652 | apt upgrade |
Upgrade packages |
| 653 | apt install package |
Install package |
| 654 | apt remove package |
Remove package |
| 655 | apt purge package |
Remove package and configuration |
| 656 | apt autoremove |
Remove unused dependencies |
| 657 | apt search package |
Search packages |
| 658 | apt show package |
Show package information |
| 659 | apt list --installed |
List installed packages |
| 660 | apt policy package |
Show package versions |
| 661 | apt-cache search package |
Search package cache |
| 662 | apt-cache policy package |
Show package policy |
| 663 | dpkg -i package.deb |
Install DEB |
| 664 | dpkg -r package |
Remove package |
| 665 | dpkg -l |
List packages |
| 666 | dpkg -L package |
List package files |
| 667 | dpkg -S /path/file |
Find package owning file |
Fedora/RHEL
| # | Command | What it does |
|---|---|---|
| 668 | dnf install package |
Install package |
| 669 | dnf update |
Update packages |
| 670 | dnf remove package |
Remove package |
| 671 | dnf search package |
Search packages |
| 672 | dnf info package |
Show package information |
| 673 | dnf list installed |
List installed packages |
| 674 | dnf history |
Show package transactions |
| 675 | yum install package |
Install using legacy yum |
| 676 | rpm -i package.rpm |
Install RPM |
| 677 | rpm -e package |
Remove RPM |
| 678 | rpm -qa |
List RPM packages |
| 679 | rpm -qi package |
Show RPM information |
| 680 | rpm -ql package |
List RPM files |
Arch Linux
| # | Command | What it does |
|---|---|---|
| 681 | pacman -S package |
Install package |
| 682 | pacman -Syu |
Update system |
| 683 | pacman -R package |
Remove package |
| 684 | pacman -Ss package |
Search packages |
| 685 | pacman -Qi package |
Show package information |
Other package systems
| # | Command | What it does |
|---|---|---|
| 686 | zypper install package |
Install openSUSE package |
| 687 | zypper update |
Update packages |
| 688 | zypper remove package |
Remove package |
| 689 | snap list |
List Snap packages |
| 690 | snap install package |
Install Snap |
| 691 | snap remove package |
Remove Snap |
| 692 | flatpak list |
List Flatpak applications |
| 693 | flatpak install package |
Install Flatpak |
| 694 | flatpak update |
Update Flatpaks |
| 695 | flatpak uninstall package |
Remove Flatpak |
| 696 | apt-mark hold package |
Hold package |
| 697 | apt-mark unhold package |
Remove package hold |
| 698 | apt-mark manual package |
Mark manually installed |
| 699 | apt-mark auto package |
Mark automatically installed |
| 700 | apt clean |
Clear package cache |
15. Master System Information
When troubleshooting Linux, you need to know how to inspect the machine itself.
CPU, memory, kernel, devices, operating-system information, logs, and system state are all available from the command line.
System information commands
| # | Command | What it does |
|---|---|---|
| 701 | uname -a |
Complete kernel information |
| 702 | uname -r |
Kernel version |
| 703 | uname -m |
CPU architecture |
| 704 | hostnamectl |
System information |
| 705 | lsb_release -a |
Distribution information |
| 706 | cat /etc/os-release |
OS information |
| 707 | uptime |
System uptime |
| 708 | free -h |
Memory usage |
| 709 | lscpu |
CPU information |
| 710 | lsmem |
Memory ranges |
| 711 | lsusb |
USB devices |
| 712 | lspci |
PCI devices |
| 713 | lspci -k |
PCI devices and drivers |
| 714 | lshw |
Hardware information |
| 715 | lsmod |
Loaded kernel modules |
| 716 | modinfo module |
Module information |
| 717 | modprobe module |
Load module |
| 718 | modprobe -r module |
Remove module |
| 719 | dmesg |
Kernel messages |
| 720 | dmesg -T |
Human-readable kernel timestamps |
| 721 | journalctl |
System journal |
| 722 | journalctl -b |
Current boot logs |
| 723 | journalctl -b -1 |
Previous boot logs |
| 724 | journalctl -p err |
Error-level logs |
| 725 | journalctl -f |
Follow logs |
| 726 | journalctl -u service |
Service logs |
| 727 | journalctl --since today |
Today's logs |
| 728 | journalctl --since "1 hour ago" |
Recent logs |
| 729 | timedatectl |
Time configuration |
| 730 | timedatectl status |
Clock status |
| 731 | localectl |
Locale settings |
| 732 | locale |
Locale variables |
| 733 | date |
Current date/time |
| 734 | date -u |
UTC time |
| 735 | cal |
Calendar |
| 736 | whoami |
Current user |
| 737 | id |
User identity |
| 738 | who |
Logged-in users |
| 739 | w |
User activity |
| 740 | last |
Login history |
| 741 | uptime -p |
Pretty uptime |
| 742 | cat /proc/cpuinfo |
Detailed CPU data |
| 743 | cat /proc/meminfo |
Detailed memory data |
| 744 | cat /proc/version |
Kernel build information |
| 745 | cat /proc/loadavg |
Load averages |
| 746 | cat /proc/uptime |
Kernel uptime |
| 747 | free -m |
Memory in MB |
| 748 | free -g |
Memory in GB |
| 749 | vmstat -s |
System statistics |
| 750 | dmesg --level=err,warn |
Kernel warnings/errors |
16. Master systemd and Services
Modern Linux distributions commonly use systemd for service management.
Understanding systemctl and journalctl is essential for Linux administration.
systemd commands
| # | Command | What it does |
|---|---|---|
| 751 | systemctl status service |
Show service status |
| 752 | systemctl start service |
Start service |
| 753 | systemctl stop service |
Stop service |
| 754 | systemctl restart service |
Restart service |
| 755 | systemctl reload service |
Reload configuration |
| 756 | systemctl enable service |
Enable at boot |
| 757 | systemctl disable service |
Disable at boot |
| 758 | systemctl enable --now service |
Enable and start |
| 759 | systemctl disable --now service |
Disable and stop |
| 760 | systemctl is-active service |
Check active state |
| 761 | systemctl is-enabled service |
Check boot enablement |
| 762 | systemctl is-failed service |
Check failure |
| 763 | systemctl list-units |
List active units |
| 764 | systemctl list-units --type=service |
List services |
| 765 | systemctl list-unit-files |
List installed units |
| 766 | systemctl list-dependencies service |
Show dependencies |
| 767 | systemctl cat service |
Show service configuration |
| 768 | systemctl edit service |
Create override |
| 769 | systemctl daemon-reload |
Reload unit configuration |
| 770 | systemctl mask service |
Prevent service startup |
| 771 | systemctl unmask service |
Remove service mask |
| 772 | systemctl reboot |
Reboot |
| 773 | systemctl poweroff |
Power off |
| 774 | systemctl suspend |
Suspend |
| 775 | systemctl hibernate |
Hibernate |
| 776 | systemctl rescue |
Enter rescue mode |
| 777 | systemctl emergency |
Enter emergency mode |
| 778 | systemctl get-default |
Show default target |
| 779 | systemctl set-default graphical.target |
Set graphical target |
| 780 | systemctl set-default multi-user.target |
Set multi-user target |
| 781 | systemctl list-timers |
List timers |
| 782 | systemctl status timer |
Show timer status |
| 783 | systemctl start timer |
Start timer |
| 784 | systemctl enable timer |
Enable timer |
| 785 | journalctl -u service |
Service logs |
| 786 | journalctl -fu service |
Follow service logs |
| 787 | systemctl reset-failed service |
Clear failure state |
| 788 | systemctl show service |
Show service properties |
| 789 | systemctl list-sockets |
List socket units |
| 790 | systemctl list-mounts |
List mounts |
| 791 | systemctl list-paths |
List path units |
| 792 | systemctl list-scopes |
List scopes |
| 793 | systemctl reboot --firmware-setup |
Reboot to firmware setup where supported |
| 794 | loginctl list-sessions |
List sessions |
| 795 | loginctl session-status |
Show session status |
| 796 | loginctl terminate-session ID |
Terminate session |
| 797 | loginctl lock-session |
Lock session |
| 798 | loginctl unlock-session |
Unlock session |
| 799 | loginctl terminate-user user |
Terminate user sessions |
| 800 | systemd-analyze |
Analyze system boot |
17. Master Scheduling and Automation
Linux becomes significantly more powerful when you stop manually repeating tasks and start automating them.
Cron, systemd timers, shell loops, find, xargs, and at are useful tools for automation.
Scheduling and automation
| # | Command | What it does |
|---|---|---|
| 801 | crontab -e |
Edit user cron jobs |
| 802 | crontab -l |
List cron jobs |
| 803 | crontab -r |
Remove cron jobs |
| 804 | at 10:00 |
Schedule a command |
| 805 | atq |
List scheduled jobs |
| 806 | atrm ID |
Remove scheduled job |
| 807 | batch |
Run jobs when load permits |
| 808 | sleep 10 |
Pause execution |
| 809 | sleep 1h |
Pause for an hour |
| 810 | watch -n 5 command |
Repeat command |
| 811 | timeout 60 command |
Limit execution time |
| 812 | date |
Generate timestamp |
| 813 | date +%F |
Output ISO date |
| 814 | date +%T |
Output current time |
| 815 | date +%s |
Unix timestamp |
| 816 | date -d tomorrow |
Calculate tomorrow |
| 817 | date -d "next monday" |
Calculate next Monday |
| 818 | date -d "@TIMESTAMP" |
Convert Unix timestamp |
| 819 | sleep 5 && command |
Delay command |
| 820 | `command \ | at now` |
| 821 | while true; do command; sleep 5; done |
Repeat command |
| 822 | for f in *; do command "$f"; done |
Process files in loop |
| 823 | find . -exec command {} \; |
Execute per match |
| 824 | find . -exec command {} + |
Batch execute matches |
| 825 | `find . -print0 \ | xargs -0 command` |
| 826 | watch 'df -h' |
Monitor storage |
| 827 | watch 'free -h' |
Monitor memory |
| 828 | watch 'ss -tuln' |
Monitor ports |
| 829 | `watch 'ps aux --sort=-%cpu \ | head'` |
| 830 | watch 'du -sh *' |
Monitor directory sizes |
| 831 | crontab -u user -l |
View another user's cron |
| 832 | systemctl list-timers |
List systemd timers |
| 833 | systemd-run --on-active=1m command |
Run delayed command |
| 834 | systemd-run --on-calendar=daily command |
Schedule systemd task |
| 835 | nohup command & |
Persist background process |
| 836 | disown -h |
Detach shell job |
| 837 | trap 'command' EXIT |
Execute on script exit |
| 838 | trap 'command' INT |
Handle interrupt |
| 839 | trap -p |
Show configured traps |
| 840 | while read line; do command; done |
Process input lines |
| 841 | until command; do sleep 1; done |
Retry until success |
| 842 | for i in {1..10}; do echo "$i"; done |
Iterate numbers |
| 843 | `seq 1 10 \ | xargs -n1 command` |
| 844 | parallel command ::: a b c |
Parallel execution |
| 845 | flock file command |
Prevent concurrent execution |
| 846 | timeout 5s curl URL |
Time-limit HTTP request |
| 847 | watch -d command |
Highlight output changes |
| 848 | watch -g command |
Exit when output changes |
| 849 | cron |
Background scheduling service |
| 850 | systemd-run |
Create transient systemd unit |
18. Master Git from Linux
Linux and Git are deeply connected in modern software development.
You should be comfortable managing repositories directly from the terminal.
Git commands
| # | Command | What it does |
|---|---|---|
| 851 | git init |
Initialize repository |
| 852 | git clone URL |
Clone repository |
| 853 | git status |
Show repository status |
| 854 | git add file |
Stage file |
| 855 | git add . |
Stage changes |
| 856 | git commit -m "message" |
Create commit |
| 857 | git log |
Show commit history |
| 858 | git log --oneline |
Compact history |
| 859 | git log --graph --oneline |
Graph history |
| 860 | git diff |
Show unstaged changes |
| 861 | git diff --cached |
Show staged changes |
| 862 | git diff HEAD |
Show all changes |
| 863 | git branch |
List branches |
| 864 | git branch name |
Create branch |
| 865 | git switch name |
Switch branch |
| 866 | git switch -c name |
Create and switch branch |
| 867 | git checkout name |
Switch branch |
| 868 | git merge branch |
Merge branch |
| 869 | git rebase branch |
Rebase |
| 870 | git fetch |
Download remote changes |
| 871 | git pull |
Fetch and integrate |
| 872 | git push |
Upload commits |
| 873 | git push -u origin branch |
Push and track branch |
| 874 | git remote -v |
Show remotes |
| 875 | git remote add origin URL |
Add remote |
| 876 | git stash |
Temporarily save changes |
| 877 | git stash pop |
Restore stash |
| 878 | git stash list |
List stashes |
| 879 | git stash apply |
Apply stash |
| 880 | git stash drop |
Delete stash |
| 881 | git reset file |
Unstage file |
| 882 | git reset --soft HEAD~1 |
Undo commit, preserve staged changes |
| 883 | git reset --mixed HEAD~1 |
Undo commit, preserve working changes |
| 884 | git reset --hard HEAD~1 |
Reset commit and working tree |
| 885 | git restore file |
Restore working-tree file |
| 886 | git restore --staged file |
Unstage file |
| 887 | git revert COMMIT |
Create inverse commit |
| 888 | git tag |
List tags |
| 889 | git tag v1.0.0 |
Create tag |
| 890 | git show COMMIT |
Show commit details |
| 891 | git blame file |
Show line authorship |
| 892 | git cherry-pick COMMIT |
Apply specific commit |
| 893 | git clean -n |
Preview untracked deletion |
| 894 | git clean -fd |
Delete untracked files/directories |
| 895 | git reflog |
Show reference history |
| 896 | git bisect start |
Start binary search |
| 897 | git bisect good |
Mark good commit |
| 898 | git bisect bad |
Mark bad commit |
| 899 | git grep pattern |
Search repository |
| 900 | git shortlog -sn |
Summarize contributors |
19. Master Docker from the Terminal
Containers are an important part of modern Linux development and DevOps.
If you understand Docker from the command line, you can build, run, inspect, debug, network, and manage containers without depending on graphical tools.
Docker commands
| # | Command | What it does |
|---|---|---|
| 901 | docker ps |
List running containers |
| 902 | docker ps -a |
List all containers |
| 903 | docker images |
List images |
| 904 | docker pull image |
Download image |
| 905 | docker run image |
Run container |
| 906 | docker run -it image bash |
Open interactive shell |
| 907 | docker run -d image |
Run detached |
| 908 | docker stop container |
Stop container |
| 909 | docker start container |
Start container |
| 910 | docker restart container |
Restart container |
| 911 | docker rm container |
Remove container |
| 912 | docker rm -f container |
Force-remove container |
| 913 | docker rmi image |
Remove image |
| 914 | docker exec -it container bash |
Enter container |
| 915 | docker logs container |
View logs |
| 916 | docker logs -f container |
Follow logs |
| 917 | docker inspect container |
Inspect container |
| 918 | docker stats |
Show resource usage |
| 919 | docker top container |
Show container processes |
| 920 | docker cp file container:/path |
Copy into container |
| 921 | docker cp container:/path file |
Copy from container |
| 922 | docker build -t app . |
Build image |
| 923 | docker tag image repository:tag |
Tag image |
| 924 | docker push repository:tag |
Push image |
| 925 | docker login |
Authenticate registry |
| 926 | docker logout |
Log out |
| 927 | docker network ls |
List networks |
| 928 | docker network create network |
Create network |
| 929 | docker network connect network container |
Connect container |
| 930 | docker network disconnect network container |
Disconnect container |
| 931 | docker volume ls |
List volumes |
| 932 | docker volume create volume |
Create volume |
| 933 | docker volume inspect volume |
Inspect volume |
| 934 | docker volume rm volume |
Remove volume |
| 935 | docker system df |
Show Docker disk usage |
| 936 | docker system prune |
Remove unused resources |
| 937 | docker container prune |
Remove stopped containers |
| 938 | docker image prune |
Remove unused images |
| 939 | docker volume prune |
Remove unused volumes |
| 940 | docker compose up |
Start Compose services |
| 941 | docker compose up -d |
Start detached |
| 942 | docker compose down |
Stop and remove services |
| 943 | docker compose ps |
Show Compose containers |
| 944 | docker compose logs |
Show Compose logs |
| 945 | docker compose logs -f |
Follow Compose logs |
| 946 | docker compose build |
Build Compose images |
| 947 | docker compose pull |
Pull Compose images |
| 948 | docker compose restart |
Restart services |
| 949 | docker compose exec service bash |
Enter service container |
| 950 | docker compose config |
Validate Compose configuration |
20. Become a Linux Power User
The final 50 techniques bring everything together.
The difference between a beginner and a professional isn't the number of commands memorized. It's the ability to combine commands into efficient workflows.
Advanced Linux productivity
| # | Command | What it does |
|---|---|---|
| 951 | fzf |
Interactive fuzzy finder |
| 952 | `history \ | fzf` |
| 953 | `find . \ | fzf` |
| 954 | Ctrl + R |
Search command history |
| 955 | !! |
Repeat previous command |
| 956 | sudo !! |
Repeat previous command with sudo |
| 957 | cd $(dirname "$(fzf)") |
Navigate using fuzzy selection |
| 958 | alias ll='ls -lah' |
Create listing shortcut |
| 959 | alias gs='git status' |
Create Git shortcut |
| 960 | alias ..='cd ..' |
Parent-directory shortcut |
| 961 | alias ...='cd ../..' |
Go up two directories |
| 962 | alias c='clear' |
Clear shortcut |
| 963 | alias ports='ss -tuln' |
Quickly inspect ports |
| 964 | alias myip='curl -s ifconfig.me' |
Check public IP |
| 965 | alias update='sudo apt update && sudo apt upgrade' |
Update Debian/Ubuntu |
| 966 | clear |
Clear terminal |
| 967 | reset |
Reset terminal |
| 968 | tput cols |
Show terminal width |
| 969 | tput lines |
Show terminal height |
| 970 | tput clear |
Clear using terminal capabilities |
| 971 | printf '\033c' |
Reset terminal display |
| 972 | `env \ | sort` |
| 973 | `alias \ | less` |
| 974 | `compgen -c \ | sort -u` |
| 975 | compgen -b |
List Bash builtins |
| 976 | help command |
Show Bash builtin help |
| 977 | man command |
Open manual |
| 978 | man -k keyword |
Search manual pages |
| 979 | apropos keyword |
Search command descriptions |
| 980 | info command |
Open GNU documentation |
| 981 | command --help |
Show command help |
| 982 | command -h |
Short help where supported |
| 983 | whatis command |
Show brief description |
| 984 | tldr command |
Show concise examples if installed |
| 985 | watch -n 1 'date' |
Live clock |
| 986 | watch -n 1 'free -h' |
Live memory monitor |
| 987 | watch -n 1 'df -h' |
Live disk monitor |
| 988 | watch -n 1 'uptime' |
Live load monitor |
| 989 | watch -n 1 'ss -s' |
Live socket monitor |
| 990 | `find . -type f -print \ | wc -l` |
| 991 | `du -ah . \ | sort -rh \ |
| 992 | {% raw %}`ps aux --sort=-%cpu \ | head` |
| 993 | `ps aux --sort=-%mem \ | head` |
| 994 | journalctl -p err -b |
Find boot errors |
| 995 | `dmesg -T \ | tail -50` |
| 996 | `history \ | tail -50` |
| 997 | command1 && command2 |
Chain successful commands |
| 998 | `command1 \ | \ |
| 999 | {% raw %}`command \ | tee output.log` |
| 1000 | man man |
Learn how to use manual pages |
The Real Secret to Linux Mastery
Learning 1,000 Linux commands doesn't make you a Linux professional.
Knowing how to combine them does.
A beginner might run:
ls
A more experienced user might run:
ls -lah
A power user might use:
find /var/log -type f -name "*.log" -size +100M -print
A system administrator might investigate further:
find /var/log -type f -name "*.log" -size +100M -exec ls -lh {} \;
And an experienced engineer understands why those commands are useful, what the output means, what could go wrong, and what command should come next.
That is the mindset you want to develop.
Your Linux Mastery Roadmap
LINUX BEGINNER
↓
Terminal Navigation
↓
Files & Directories
↓
Text Processing
↓
Permissions
↓
Processes
↓
Pipes & Redirection
↓
Networking
↓
SSH
↓
Storage
↓
Package Management
↓
systemd & Services
↓
Bash Scripting
↓
Automation
↓
Git
↓
Docker
↓
Troubleshooting
↓
System Administration
↓
LINUX POWER USER
↓
LINUX PROFESSIONAL
The 10 Commands You Should Know Extremely Well
If you want to prioritize, start with these:
cd
ls
find
grep
sed
awk
chmod
chown
ps
systemctl
Then learn how to combine them with:
|
>
>>
2>
&&
||
$
xargs
find -exec
For example:
ps aux | grep nginx
find /var/log -type f | grep nginx
journalctl -u nginx | grep -i error
du -ah /var | sort -rh | head -20
ps aux --sort=-%mem | head
These combinations demonstrate the real power of Linux: inspect → filter → transform → act → verify.
Final Challenge
Don't just read these 1,000 Linux shortcuts.
Practice them.
Create a virtual machine or safe test environment and work through progressively harder tasks:
Day 1–5
Terminal + Navigation
Day 6–10
Files + Permissions
Day 11–15
Text Processing
Day 16–20
Processes + Jobs
Day 21–25
Pipes + Redirection
Day 26–30
Networking
Day 31–35
SSH + Remote Administration
Day 36–40
Storage + Packages
Day 41–45
systemd + Logs
Day 46–50
Bash + Automation
Day 51–55
Git + Docker
Day 56–60
Troubleshooting + Advanced Workflows
By the end, your goal shouldn't be to say:
"I know 1,000 Linux commands."
Your goal should be:
"Give me a Linux problem, and I'll know how to investigate it from the terminal."
That is when you start becoming a Linux pro.
Top comments (0)