LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Fast change directory for the cli. (https://www.linuxquestions.org/questions/linux-general-1/fast-change-directory-for-the-cli-817078/)

David the H. 06-30-2010 11:25 PM

There's also a seemingly little-known shopt option called autocd. From the man page:

Code:

autocd  If  set, a command name that is the name of a directory
        is executed as if it were the argument to the cd command.
        This option is  only used by interactive shells.


stf92 06-30-2010 11:59 PM

I did not realize shopt was a builtin command.

lumak 07-01-2010 12:05 AM

wow, I should read the bash manual, autocd and cdspell seem to be very useful... But it appears that my function solution also allows for the user typing a partial directory name and hitting enter. If the DIRLIST is crafted well enough with the most important directories listed first, then your option will be a few <enter> keys away...

Then again, if you install the bash-completion scripts, they probably allow you to tab complete a prefix if it's in your CDPATH.

JZL240I-U 07-01-2010 01:14 AM

If you want to learn bash and need material:

http://linux.org.mt/article/terminal
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html
http://www.gnu.org/software/bash/manual/bashref.html
http://www.dreaming.org/~giles/bashprompt/
http://www.justlinux.com/nhf/Shells/..._Commands.html
http://www.linuxcommand.org/who_what_where_why.php
http://theory.uwinnipeg.ca/UNIXhelp/
http://www.tldp.org/guides.html#abs
http://www.commandlinefu.com/commands/browse

HTH. Good luck.

sebas2 07-01-2010 06:51 AM

autojump
 
Hi,
I've never tried it, but I grabbed this URL sometime ago, and it seems to do what you want :
http://wiki.github.com/joelthelion/autojump/
Regards

stf92 07-01-2010 10:49 AM

@sebas2: most useful your link. Autojump is tiny and fast. Regards.
@JZL240I-U: thanks for the plentiful documentation. Cheers.

axobeauvi 07-08-2010 10:10 PM

this is a bit off of what you're asking, but the tab key is the auto complete.
if you want to change dir or whatever type the command then the first few characters then hit tab, it will work up/down the directory tree

allanf 07-08-2010 11:13 PM

Quote:

Originally Posted by stf92 (Post 4018820)
Linux kernel 2.6, GNU (Slackware 12.0).

Hi:

In the old days of M$-DOS, there was the NCD (Norton Change Directory) utility. Anything of the sort in Linux? Explanatory note: you typed out the name of the directory you wanted to go to, that is, last element of the dir path.
And you were, ipso facto, in that dir. If that was the only one by that name, good. When not, and if that wasn't the intended dir, you typed the same command again and you were in a second dir of that name. If this was the intended dir, good. And so on.
It simply maintained a data base with the whole tree, and updated it when invoked from a newly created dir o by means of an option, NCD/R.

Regards.

In the even before M$-DOS days there was Unix (of which the Linux system is a Unix flavor and Unix had its X-Window System since 1984 and with colors since 1985).

allanf 07-08-2010 11:14 PM

Quote:

Originally Posted by sebas2 (Post 4020410)
Hi,
I've never tried it, but I grabbed this URL sometime ago, and it seems to do what you want :
http://wiki.github.com/joelthelion/autojump/
Regards

Bash and vim already have tab completion. Why another tool???


All times are GMT -5. The time now is 01:13 AM.