As you want to navigate to move almost nuke and corner of your file system.
But sometimes you often go to a specific folder, maybe that is Downloads or you specific workspace folder.
➜ ~ cd ~/Downloads
➜ Downloads
Edit your shell source file by doing the following command in terminal
vi ~/.zshrc
or
vi ~/.bash_profile
Update below content into the bottom of your source file,
#Alias to my Download folder
alias downloads='cd ~/Downloads'
Save the profile file by doing vi save (escape + :wq!)
➜ downloads
Now type downloads in your terminal hit enter. You are into the Downloads folder.
Troubleshoot:
Restart the terminal if not working, or check the typo to your profile settings
Below command can be useful to add the current directory to the alias list, as it avoids to open the
bash_profile to update in the vi editor.
Replace the <name> with the actual value. after the edit, there should not any angle brackets in the terminal command.
➜ echo "alias <name>='cd $PWD'" | cat >> ~/.bash_profile
Note: As this is appended command, please make sure that you execute it once per alias name.
No comments:
Post a Comment