Vishwajith.K
Vishwajith.K

Reputation: 139

How to change directory by mentioning folder name?

It's bit annoying to type cd every time that I wish to Change Directory and then folder path/name.

So, any ways to avoid it? Without installing any extra stuff..

In case if things are blur: I wanted a replacement for this prompt> cd folder with this prompt> folder

Upvotes: 1

Views: 349

Answers (1)

Mir Rahed Uddin
Mir Rahed Uddin

Reputation: 1406

  1. Open your terminal (ctrl + alt + t), type sudo su then enter your password

  2. (I am using leafpad text editor to edit the .bashrc file. If you also want to use leafpad, install it using sudo apt-get install leafpad command, Otherwise, you can use any other text editor as you wish)

    Type the following command leafpad ~/.bashrc to edit the .bashrc file.

  3. Add the following command at the end of the file and save the file

    shopt -s autocd

  4. Update the changes made in the .bashrc file with the following command:

    source ~/.bashrc

    All Done :)

OR

echo 'shopt -s autocd' >> ~/.bashrc ; . ~/.bashrc will suffice

Upvotes: 3

Related Questions