Work Smarter in the Ubuntu Terminal
The terminal is one of Ubuntu's greatest strengths. Once you move beyond basic commands, you unlock a level of speed and control that no GUI can match. Here are 10 tips that will genuinely change how you work.
1. Use Ctrl+R for Reverse History Search
Instead of scrolling through command history with the arrow keys, press Ctrl+R and start typing part of a previous command. Bash will instantly find the most recent match. Press Ctrl+R again to cycle through older matches.
2. Jump Between Words with Alt+Arrow Keys
Don't hold backspace to delete a long command. Use Alt+Left and Alt+Right to jump word by word, or Alt+Backspace to delete the previous word. Ctrl+U clears the entire line before the cursor.
3. Run the Last Command as Root
Forgot to type sudo? No need to retype the whole command. Just run:
sudo !!
The !! expands to the last command you ran.
4. Use watch to Monitor Command Output
The watch command runs another command repeatedly at an interval, great for monitoring system state:
watch -n 2 free -h
This updates the memory usage display every 2 seconds.
5. Create Useful Aliases
Add shortcuts to your ~/.bashrc for commands you type constantly:
alias update='sudo apt update && sudo apt upgrade -y'
alias ll='ls -lah'
alias gs='git status'
Run source ~/.bashrc to apply changes immediately.
6. Use tmux for Persistent Sessions
tmux lets you split your terminal into panes, run multiple sessions, and — crucially — keep sessions alive when you disconnect from SSH. Install it with sudo apt install tmux. Basic commands:
tmux new -s mysession— start a named sessionCtrl+B, D— detach from sessiontmux attach -t mysession— reattach
7. Quickly Navigate Directories with pushd and popd
Use pushd /some/path to jump to a directory and push your current location onto a stack. Use popd to jump back. Much faster than using cd - for complex navigation.
8. Redirect Output to a File and Screen Simultaneously
Use tee to split output — it writes to a file and displays it in the terminal at the same time:
sudo apt upgrade 2>&1 | tee upgrade.log
9. Find and Kill a Process by Name
Instead of using ps aux | grep and then kill, use these shortcuts:
pgrep firefox # find PID by name
pkill firefox # kill process by name
10. Use !!:s/old/new to Fix Typos in the Last Command
Made a typo in your last command? Fix it without retyping everything:
!!:s/stauts/status
This replaces the first occurrence of "stauts" with "status" in the previous command and reruns it.
Keep Practicing
The terminal rewards consistent use. Bookmark this list and try incorporating one or two tips each week. Over time, these small habits compound into a dramatically faster workflow.