Efficiently Navigating Through Your Directories

(Cheat codes to make your life easier!)

Navigating through your directories can be done on separate lines in your Terminal. But this is inefficient.

A very ineffective way to get to your destination.

Chaining them all together on one line is much cleaner!

A better way to get to your destination.

This got me thinking; there has to be a faster way. As programmers we are lazy right? Introducing alias! Alias allows you to store shortcuts in your Terminal so that you can quickly accomplish tasks.

Alias shortcuts to navigate your directories. (It’s a good idea to use abbreviations that relate to the file path.)

The issue with using alias in this way is that it’s only stored during your current session. This means that if you reload Terminal your shortcuts will be gone. A way to work around this is by saving your alias shortcuts to your bash or zsh file so that they will always work.

To accomplish this you first want to open up your Terminal and type in the following if you are using zsh:

nano ~/.zshrc

If you are using bash you would type:

nano ~/.bash_profile

Your Terminal will open this:

The .zshrc window.

At the bottom I have already added in my different alias shortcuts. You can also install different themes, fonts, and color schemes if you’d like.

ctrl T will allow you to save

Saving changes to .zshrc

ctrl X will exit out of this screen.

Exiting out of the .zshrc window.

After reloading Terminal, a quick test of your new shortcuts will show you that alias is now working! Good luck and get creative!

Testing my new alias keys.

Source:

Full Stack Developer | React | JavaScript | Ruby on Rails