Linux Terminal Navigation Guide
By Sunrostern · · 3 min read
🧠 Terminal Navigation & Operations Cheat Sheet
1️⃣ Line Editing (while typing a command)
These are gold.
Cursor movement
ActionShortcutStart of lineCtrl + AEnd of lineCtrl + EMove back 1 charCtrl + BMove forward 1 charCtrl + FBack 1 wordAlt + BForward 1 wordAlt + F
Deleting text
Delete entire line
Ctrl + UDelete cursor → end of line
Ctrl + KDelete previous word
Ctrl + WDelete char under cursor
Ctrl + DBackspace⌫
Undo
ActionShortcutUndo last editCtrl + _ (Ctrl + Shift + -)
2️⃣ Command Execution & Control
ActionShortcutRun commandEnterCancel current commandCtrl + CSuspend commandCtrl + ZResume suspended jobfgRun in backgroundcommand &Exit shellexit or Ctrl + D
3️⃣ Command History (🔥 huge productivity boost)
ActionShortcutPrevious command↑Next command↓Search historyCtrl + RRepeat last command!!Repeat last with sudosudo !!Run command #!123Last argumentAlt + .
Pro tip
During Ctrl + R, keep pressing Ctrl + R to cycle matches.
4️⃣ Directory Navigation
CommandWhat it doespwdShow current directorylsList filesls -laList all + permissionscd dirGo into dircd ..Up one levelcd ~Home directorycd -Previous directory
5️⃣ File & Directory Operations
Create / remove
touch file.txtmkdir dir
mkdir -p a/b/c
rm file.txt
rm -r dir
rm -rf dir # dangerous
Copy / move
cp a.txt b.txtcp -r dir1 dir2
mv old new
6️⃣ Viewing & Inspecting Files
cat fileless file # scrollable
head -20 file
tail -20 file
tail -f log.txt # live logs
Inside less:
q→ quit/text→ searchn/N→ next / prev match
7️⃣ Searching & Finding
Find files
find . -name "*.js"Search text
grep "foo" filegrep -R "foo" .
grep -Rin "foo" . # recursive + line numbers
8️⃣ Processes & System
ps auxtop
htop # if installed
kill PID
kill -9 PID # force
Suspend → background → foreground:
Ctrl+Zbg
fg
jobs
9️⃣ Pipes & Redirection (Core Unix Power)
SyntaxMeaning``>Overwrite file>>Append<Input2>stderr&>stdout + stderr
Examples:
ls | grep foocommand > out.txt
command 2> err.txt
command &> all.txt
🔟 Permissions & Ownership
chmod 755 filechmod +x script.sh
chown user:group file
1️⃣1️⃣ Networking & Debugging
curl urlcurl -I url
wget url
ping google.com
lsof -i :3000
1️⃣2️⃣ Environment & Shell
envprintenv
echo $PATH
export FOO=bar
source ~/.zshrc
1️⃣3️⃣ Tab Completion & Expansion
ActionShortcutAutocompleteTabShow optionsTab TabExpand glob*Brace expansion{a,b,c}
rm file{1,2,3}.txt1️⃣4️⃣ Terminal UI shortcuts (macOS)
ActionShortcutNew tabCmd + TClose tabCmd + WSplit paneCmd + DClear screenCtrl + L
1️⃣5️⃣ Emergency / Recovery
SituationFixTerminal frozenCtrl + CMessed up terminalresetBinary garbage outputresetZombie processkill -9 PID
🔑 Top 10 to Burn into Muscle Memory
Ctrl+A Ctrl+E Ctrl+U Ctrl+K Ctrl+R
Ctrl+C Ctrl+Z fg !! Alt+.