Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

In the terminal You use cd ../../........ to get to wherever you want,

But I am lazy, I am wondering if it is possible to automatically cd into the directories if the command is simply the directory.

The terminals obviously know it's the directory because you get the output of

$ ../
bash: ../: Is a directory

So is it possible to hijack this message to automatically cd into that directory?

share|improve this question
    
lol that is lazy. Just be careful some direcotires and executables share the same name, that's why typing cd is better. –  coteyr May 20 '13 at 23:07
add comment

1 Answer

Add shopt -s autocd to your ~/.bashrc.

Also, you might want to run man shopt in terminal for more useful options.

share|improve this answer
    
Yes. This Works perfectly. I can also use cd foldername in order to change directory in the common way but, how can I remove such functionality and revert to default? Thanks in advance. –  Geppettvs D'Constanzo May 20 '13 at 23:23
    
shopt -u autocd -- read the link man. –  coteyr May 20 '13 at 23:38
1  
info bash --index-search='shopt' or Gnu Bash Reference - Shopt –  LantzR May 20 '13 at 23:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.