If you're anything like me, you find it tedious to open up your terminal and navigate to your project by typing in a long, absolute path, or by repeatedly using
ls to figure out where you're at and where you need to go. At home I keep all of my projects in a folder, befittingly named, projects.
Navigating to my projects folder isn't too bad, it's only a couple of directories in. However, I'm lazy, so let's do this the lazy way.
If you're following along, your first and biggest task will be to find your .bashrc file. For me, I am using Pop OS! 19.10 and it was located under the Home directory. I did have to enable the show hidden files option to see it though.
If you want to use your CLI to find it, you may have to go to your home directory and use something like
ls -la | more
If you're having trouble finding it, a quick search in your favorite search engine of something like "where is .bashrc on Ubuntu 18.04" should work, just be sure to replace Ubuntu 18.04 with the OS that you're using. If you're using Windows and you've installed Git Bash, you'll have to do a search on how to find the .bashrc or add aliases to Git Bash. Also, you should make sure that you're using bash. Some operating systems use Z shell, or other shells. In my terminal, I can run echo $0 and it returns bash.
Now that you've (hopefully) found your .bashrc file, open it up with your favorite text editor. Here's mine:
As you can see, I've already created a few aliases. Today I'll create one to take me to my projects directory. I bet you can tell how to do this just from looking at the screenshot. If not, take a look at the gif below for that "ohhhhhh, that's how he did it" moment.
...And now for the moment you've all been waiting for:
Please note that you'll need to close your terminal and reopen it for your changes to take effect.
I'm a pretty average Linux user, however, I love learning cool techniques like this. What are your thoughts?