Sitemap

4 Linux Commands and Hacks That Will Blow Your Mind

4 min readAug 21, 2024
Press enter or click to view image in full size

1. The tilda symbol : ~

This symbol “ ~ ”, commonly known as the tilda symbol, is significant when navigating the Linux command line or ( terminal ). It is used to navigate to the current user's home directory. So, basically, you use it when navigating around with the “ cd ” and you want to go to the user’s home directory asap.

Press enter or click to view image in full size
tilda key in action. It goes directly to the user's home directory

As you can see on top initially we are at the root directory ( the top-level directory in Linux) then when we used the ~ tilda symbol we immediately navigated to the home directory.

2. The Slash / commonly known as the ( forward slash ) 😂😂😂

The slash “ / ” is used to navigate to the root in Linux. So, anytime you want to go to the root use the slash and you will be taken there immediately. There is no need to use cd ../../ multiple times.

$ cd ../../../ # There is no need of doing this you can just use the slash /
$ pwd
$ /home/boni
$ cd /
$ pwd
$ /

3. UP and Down Keys on the keyboard:

The up and down keys in Linux are a privilege to have since they play a very huge role in helping us navigate to the previous commands we had run. Use them to navigate back and forth your command history. The commands are stored in a file called .bash_history. It stores all the commands and when using the up and down keys they go through the commands one by one.

Press enter or click to view image in full size
gif explanation on how to use up and down keys

NB: As you have seen the bash-history is easily accessible and is not ideal for usage with sensitive data.

3. TAB completions <TAB KEY>

The TAB key is one of my favorite keys because it does most of the work of completing the words, especially the long ones. To use TAB completions you just have to start typing the first character of the folder you are navigating to and then press tab and it will auto-complete for you.

Also, note that when there are multiple files with the same name you want to complete it will print the files that best fit the characters you have just typed and then you can go ahead and narrow down by adding more characters until only one is left. Also if there is only one file or directory inside the folder and you press TAB it will instantly complete it even without typing anything.

TAB completions are not only limited to files and folders but also programs. E.g. if you type …

$ pyt  # and press tab in a linux command line it will try to match pyt with
# either python3 e.t.c

4. The Reverse Search 🎉😍

Finally, our command for the day is the Reverse search hack. The reverse search hack helps you quickly find through your bash history. Imagine you had a very long command you used last week and you went through a hard time to fine-tune it to work and now you can’t remember it 🤨🤨. This is where the reverse search comes into play. To use it you type Ctrl + R

On pressing Ctrl + R you will see something written reverse-search. You start typing and then it will auto-complete based on what you are typing.

Also if there are a bunch of related commands you can continue pressing Ctrl + R and it will cycle through your history and get you the command you are looking for🥳🥳.

Press enter or click to view image in full size
Reverse search by techwithwin

Conclusion

Finally, that’s it from me if you’d like to talk or anything you can always find me at https://techwithtwin.com

--

--

TechWithTwin
TechWithTwin

Written by TechWithTwin

I'm a Fullstack Developer (Next.js, Django, and Express.js ) and an accomplished technical writer.

No responses yet