The best thing about working with the terminal is just how efficient it can be. Imagine if someone gave you a thousand documents and told you to replace specific patterns of text inside those files. You could spend days opening those files in an editor and manually replacing the text inside them. Or you could run a single “sed” command and be done in a few seconds. It genuinely feels like a superpower the more I learn about it and practice it. Here are 6 things I learned that made the terminal less frustrating for me and sped things up at the same time.
Set background tasks
What to do when you can’t get back to the terminal prompt
You know how sometimes a command can “capture” your terminal session. It just keeps running and running, never returning you to the terminal prompt again. Try this the next time you can’t get back to the prompt.
First, if the session is already captured, press Ctrl+C to kill the command. Pressing Ctrl+C on any running command stops it instantly.
Then run the same command but type “&” at the very end. The ampersand makes it run in the background instead. For example, if I run this sleep command, it will capture the terminal for 30 seconds.
sleep 30
I could add & at the end to make it wait in the background instead. You also get the process ID for this running command. You can find it later by entering jobs.
sleep 30 &
If you don’t want to terminate a running process with Ctrl+C, you can press Ctrl+Z instead, which pauses it temporarily and returns you to the prompt. To unpause it and run it in the background, you can just enter bg. You can type fg to bring it back to the terminal.
Sometimes, you want to keep a process running without keeping the terminal window open. That’s what nohup is for. Just type nohup followed by the command to background a task.
nohup sleep 90 &
Now your process will keep running in the background even if you close the terminal window.
Use shortcuts
Makes navigating the terminal less annoying
First, you can use the up and down arrow keys to flip through your command history. This shortcut alone will save you so much typing, especially if you tend to run the same or similar commands often. If it’s taking too long to get to an entry with arrow keys, press Ctrl+R and you can search through your entire history with keywords.
If you hate typing long paths, just type the beginning of a path and press Tab, and it’ll autocomplete it for you.
I use the zsh shell to get autocomplete hints for regular commands. Bash (the default Linux shell) lacks a lot of modern features like in-line hints, but you can always replace it with a different shell.
Also, you don’t need to use arrow keys to go to the end or start of commands. Just press Ctrl+A to jump to the start of a command. It’s usually handy when you forget to type sudo in front of a command. Press Ctrl+E to jump back to the end.
At some point, you have probably seen a “permission denied” error because you forgot to run a command with sudo. When that happens, just do sudo !!. The two bangs rerun the last command with sudo attached.
You might already know that the clear command clears the screen, but you can do the same just by pressing Ctrl+L.
Set aliases for frequently used commands
Call long commands with one word
One thing that I’ve always found incredibly annoying is typing repetitive commands and paths. Aliases save you that trouble. You can assign a trigger word (alias) to a long command and run that command just by typing the alias word.
For example, I have to frequently ssh into my tiny home server and cloud servers. This is the ssh command for one of them.
ssh ubuntu@140.245.xx.xx -i ~/.ssh/oracle2.key
Instead of typing it every time, I have defined the alias “oracle” for the whole command. So I can just type oracle in the terminal, hit Enter, and it connects me right away.
You can define aliases for any command by opening the shell configuration file. First, check which shell you’re on right now.
echo $SHELL
If it says /usr/bin/bash, you’re using the Bash shell. If it says /usr/bin/zsh, you are in Zsh.
You can edit the Bash configuration file by typing nano ~/.bashrc. To edit the Zsh configuration, type nano ~/.zshrc and hit Enter.
Then anywhere in the configuration file, type the word alias followed by your trigger word and command.
alias oracle=”ssh ubuntu@140.245.xx.xx -i ~/.ssh/oracle2.key”
Save the configuration file by pressing Ctrl+O, then Enter. Hit Ctrl+X to exit the nano editor.
You will need to refresh the configuration, so the alias becomes active. Run this command. Replace ~/.zshrc with ~/.bashrc if you’re using Bash.
source ~/.zshrc
Use the command-line to search files and processes
Quickly search through your files without leaving the terminal
You don’t need to open a GUI file manager to look for your files or search inside the files. Search files with find. Type the directory path you want to search for and use the -name flag to search by file name.
find /home/user/Downloads -name “petition”
You can use grep to search inside a file. This command prints any lines that contain the word “vote” inside the petition file.
grep “vote” petition.txt
I’ve covered searching inside the terminal in detail here.
Pipe commands
Let the terminal do your work for you
Usually when you type a command and hit Enter, you see a result printed on the terminal right away. However, you can feed that output directly to other commands to create useful chains. It’s called “piping.”
Say you have a petition text file which contains a list of votes, but you don’t want to manually count the votes. You could run cat petition.txt to print what’s inside the text file. Then use the pipe character| to feed that output to a grep command that prints all lines containing the word “vote.” Finally, you pipe that output to a command that does the counting.
cat petition.txt | grep “vote” | wc -l
You can do the same for multiple files in a directory. This command will list all text files containing the word “petition” and count their votes.
cat $(ls *petition*.txt) | grep “vote” | wc -l
Operating System
Ubuntu Linux 22.04 LTS
CPU
13th Gen Intel Core i7-1360P
Learning a few habits can make the terminal feel a lot more comfortable
I remember feeling like the terminal was fighting me whenever I had to use it. It took the longest time to get used to saving and exiting in nano, for example. But it did click eventually as I developed these habits.

