Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Looks like you can use shopt -s implicitcd. You probably have to put this in your .bashrc or profile...
EDIT: At least I think it works for Bash 3.0. I tried it on my Debian sarge system which has Bash 2.0 and it doesn't have the implicitcd shell option...
I would say that that depends on how many times a day you have to type 'CD'. If it's enough times then you might actually be making a saving in the time spent typing directories.
Just depends if your pedantic enough to want to save a total of 500milliseconds by the end of the day.
This is one feature of the csh (of many) that I don't think people appreciate until they use it a lot. But it really is a nice thing, especially since it is almost always the desired action. And if you're walking through a filesystem (with tabs) it just makes sense a lot of the time to not keep typing cd.
doesn't work with Bash 3.1.17(1) on OpenBSD 4.0. It says
-bash: shopt: implicitcd: invalid shell option name
My bad, that man page was a FreeBSD page. I wonder if they do patch the shell and add that option... I guess read the man page on your machine and see if there's another option...
Or, if you are not restricted to using bash, you could try zsh. For my purposes, it is the same as bash, with options bash does not include, such as autocd.
If you enter something that cannot be interpreted as a command, such as a directory path, zsh will automatically cd to that directory.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.