Linux Terminal Commands That Make You Actually Productive
Beyond ls and cd. The commands developers use constantly but beginners rarely get taught — pipes, grep, awk, find, xargs, and the shortcuts that add up.
The terminal is faster than any GUI for the tasks you do repeatedly. Getting there requires learning the commands nobody explicitly teaches you.
File and Directory Navigation
- cd - (hyphen) — goes back to previous directory. Faster than typing the full path when switching between two locations.
- pushd /some/path and popd — saves current location to a stack, changes to new path. popd returns. Better than cd - when navigating multiple levels.
- ls -lah — list with sizes in human-readable format (KB, MB, GB) and show hidden files. More useful than plain ls.
- tree -L 2 — shows directory structure 2 levels deep. Requires tree to be installed (brew install tree / apt install tree).
Text Processing Power Tools
grep -E (extended regex): grep -E 'error|warning' logfile.txt finds lines with either. grep -v 'debug' inverts — shows lines that don't match.
awk: mostly used for extracting specific columns. awk '{print $3}' file.txt prints the 3rd whitespace-separated field from each line. awk -F',' '{print $1}' extracts the first CSV column.
sed: stream editor for substitution. sed 's/old/new/g' file.txt replaces all instances of 'old' with 'new'. Add -i to edit the file in place: sed -i 's/localhost/production.db/g' config.yaml.
sort | uniq -c | sort -rn: powerful pattern for finding most frequent items. cat access.log | awk '{print $1}' | sort | uniq -c | sort -rn | head -10 — top 10 most frequent IP addresses in an access log.
Process Management
- ps aux | grep process_name — find running processes. pgrep process_name is cleaner if you just need the PID.
- kill -9 PID — force kill a process. kill PID first (graceful shutdown); use -9 only if it doesn't respond.
- lsof -i :3000 — what process is using port 3000? Essential when starting a dev server and finding 'address already in use'.
- nohup command & — run a command that continues after you close the terminal. Output goes to nohup.out by default.
- Ctrl+Z, then bg — pause a running process (Ctrl+Z), then resume it in the background (bg). fg brings it back to foreground.
SSH and Remote Work
ssh user@host 'command' — run a single command on a remote server without entering an interactive session. Useful for quick checks: ssh user@server 'df -h' to check disk space remotely.
scp local_file user@host:/remote/path — secure copy to/from a remote server. rsync -avz is better for directories (only transfers changed files).
ssh -L 8080:localhost:3000 user@host — SSH tunnel. Forwards port 3000 on the remote server to port 8080 on your local machine. Access a database or internal service that isn't publicly exposed.
Keyboard Shortcuts Nobody Shows You
- Ctrl+R — reverse search through command history. Start typing any part of a previous command.
- Ctrl+A / Ctrl+E — jump to beginning/end of line. Faster than Home/End on some keyboards.
- Alt+. (period) — inserts the last argument of the previous command. Repeat to cycle through previous commands' last arguments.
- Ctrl+L — clear the terminal screen (same as 'clear' command).
- !! — previous command. !word — most recent command starting with 'word'.
Frequently Asked Questions
What's the fastest way to search for text across files?+
How do I find a file when I don't know where it is?+
What does the pipe | do in the terminal?+
How do I run the last command as root without retyping it?+
🔧 Free Tools Used in This Guide
FreeToolKit Team
FreeToolKit Team
We build free browser-based tools and write practical guides without the fluff.
Tags: