Lesson 02: Bestiary of the Shell

Terminal Spells & Alchemy

TRIAL OF THE GRASSES — PROGRESS2 / 13
The Witcher's Handbook (25 Tips)
Spell #01

Return to home directory

Jump back to your base camp instantly using ~ or just the raw command.

cd ~ cd
Spell #02

Which

Identify the location of binary artifacts in your PATH.

which grep
Spell #03

Multiple Commands

Chain your signs. Execute several commands sequentially.

command_1; command_2; command_3
Spell #04

Conditional Logic (&&)

Run the next command only if the previous trial was successful.

command_1 && command_2
Spell #05

History Senses

Search your past actions with Ctrl+R or filter with grep.

ctrl+r <term> history | grep mkdir
Spell #06

Unfreeze (Ctrl+Q)

Banish the accidental freeze of Ctrl+S.

Ctrl + Q
Spell #07

Help Signs

Every beast has its manual. Check the --help scroll.

ufw --help
Spell #08

Tail Logs

Watch the life of the system in real-time.

tail -f /var/log/httpd/access_log
Spell #09

Partial Read

View only the last N lines or bytes of a massive file.

tail -f -c 100 path_to_Log
Spell #10

Kill Process

Terminate the foreground monster immediately.

Ctrl + C
Spell #11

Copy/Paste

Essential terminal shortcuts for spell transfer.

Ctrl+Shift+C / Ctrl+Shift+V
Spell #12

Last Argument (!$)

Summon the last target of your previous command.

mkdir /long/path; cd !$
Spell #13

Z-Commands

Read compressed scrolls without manual extraction.

zless, zcat, zgrep
Spell #14

Sudo Re-run (!!)

Repeat the last command with root privileges.

sudo !!
Spell #15

Alchemy of Alias

Fix common typos or create shortcut potions.

alias gerp='grep'
Spell #16

Clear File Content

Wipe the scroll without destroying the parchment.

> filename
Spell #17

Hunt Files (Find)

Search for text patterns or specific file sizes.

grep -Pri "text" /path/
Spell #18

PWD

Reveal your current location in the labyrinth.

pwd
Spell #19

Disk Usage (du)

Measure the weight of a file or directory.

du -sh /path/
Spell #20

Free Space (df)

Check how much space is left on your mounts.

df -h
Spell #21

Table View

Format messy lists into readable columns.

cat /etc/passwd | column -t
Spell #22

Clean Altar

Wipe the terminal screen instantly.

clear / Ctrl + L
Spell #23

Batch Directories

Create entire paths in one breath.

mkdir -p dir/{s1,s2,s3}
Spell #24

List Users (w)

See who else is sharing the air in this system.

w
Spell #25

Priority (Nice)

Manipulate the CPU time share of any process.

renice -n -15 -p <pid>
Journey Roadmap
Lesson 02

Tips & Tricks

Active