Navigate to a Folder from Any Location by Typing a Letter – Linux

Step 1: Add the alias to your shell configuration file

Open your shell configuration file in a text editor. Depending on your shell, this could be:

nano ~/.bashrc

Step 2: Add the alias

Add the following line to the file:

alias h=’cd /var/www/html’

Step 3: Save and reload

Save the file and exit the editor. Then, reload the shell configuration to apply the changes:

source ~/.bashrc

Step 4: Test it

Now, you can simply type h in your terminal, and it will take you directly to /var/www/html.

Leave a Reply

Your email address will not be published. Required fields are marked *