Change The Directory Without "cd"
Automatically Switch To A Directory Without Using Cd Command
Let us say you wanted to go to the directory Downloads. You don’t need to type “cd Downloads” every time to go that directory. Instead, just type “Downloads” in the Terminal. Sounds cool, yeah? Indeed!When you type Downloads in the Terminal, you will see the following message:
$ Downloads/ bash: Downloads/: Is a directoryYou can type “cd Downloads” to go the Downloads directory, right? But, wait! You don’t have to use cd command anymore. To do so, edit your .bashrc file:
vi ~/.bashrcAnd, add the following line at the end:
shopt -s autocdUpdate the changes made in the .bashrc file with the following command:
source ~/.bashrcAll done! You can now go to any directory without using cd command. Just enter the path of the directory like below. Bash can automatically prepend cd when entering just the path of any directory in the Terminal.
[sk@sk]: ~>$ Downloads/ cd -- Downloads/ [sk@sk]: ~/Downloads>$ Telegram/ cd -- Telegram/ [sk@sk]: ~/Downloads/Telegram>$
REFERENSI :
https://www.ostechnix.com/automatically-switch-directory-without-using-cd-command/
Komentar
Posting Komentar