Quick directory navigation in the bash shell
I would like to frequently switch between directories that are in totally unrelated paths, for example /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/.
But I don't want to type cd /[full-path]/ all the time. Are there any shortcut commands to switch to previously worked directories?
One solution I could think of is to add environment variables to my bash .profile for the frequently used directories and cd to them using those variables.
But is there any other solution to this?
bash shell command-line alias cd-command
add a comment |
I would like to frequently switch between directories that are in totally unrelated paths, for example /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/.
But I don't want to type cd /[full-path]/ all the time. Are there any shortcut commands to switch to previously worked directories?
One solution I could think of is to add environment variables to my bash .profile for the frequently used directories and cd to them using those variables.
But is there any other solution to this?
bash shell command-line alias cd-command
Symbolic links could also be useful for this. en.wikipedia.org/wiki/…
– user606723
Feb 9 '12 at 15:11
add a comment |
I would like to frequently switch between directories that are in totally unrelated paths, for example /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/.
But I don't want to type cd /[full-path]/ all the time. Are there any shortcut commands to switch to previously worked directories?
One solution I could think of is to add environment variables to my bash .profile for the frequently used directories and cd to them using those variables.
But is there any other solution to this?
bash shell command-line alias cd-command
I would like to frequently switch between directories that are in totally unrelated paths, for example /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/.
But I don't want to type cd /[full-path]/ all the time. Are there any shortcut commands to switch to previously worked directories?
One solution I could think of is to add environment variables to my bash .profile for the frequently used directories and cd to them using those variables.
But is there any other solution to this?
bash shell command-line alias cd-command
bash shell command-line alias cd-command
edited Dec 23 '16 at 23:08
Alex Stragies
3,3751639
3,3751639
asked Feb 8 '12 at 7:33
saiy2ksaiy2k
773279
773279
Symbolic links could also be useful for this. en.wikipedia.org/wiki/…
– user606723
Feb 9 '12 at 15:11
add a comment |
Symbolic links could also be useful for this. en.wikipedia.org/wiki/…
– user606723
Feb 9 '12 at 15:11
Symbolic links could also be useful for this. en.wikipedia.org/wiki/…
– user606723
Feb 9 '12 at 15:11
Symbolic links could also be useful for this. en.wikipedia.org/wiki/…
– user606723
Feb 9 '12 at 15:11
add a comment |
35 Answers
35
active
oldest
votes
1 2
next
If you're just switching between two directories, you can use cd - to go back and forth.
13
How this has eluded me for so long is a mystery. Thank you very much for this excellent tip.
– Mr. Shickadance
Feb 9 '12 at 15:21
3
+1 Certainly one of my favorites and one that somehow many experts have 'missed'.
– Michael Durrant
Apr 24 '12 at 2:17
add a comment |
There is a shell variable CDPATH in bash and ksh and cdpath in zsh:
CDPATH The search path for the cd command. This is a colon-separated
list of directories in which the shell looks for destination
directories specified by the cd command.
So you can set in your ~/.bashrc:
export CDPATH=/Project/Warnest:~/Dropbox/Projects/ds
Then cd docs and cd test will take you to the first found such directory. (I mean, even if a directory with the same name will exist in the current directory, CDPATH will still be consulted. If CDPATH will contain more directories having subdirectories with the given name, the first one will be used.)
16
It should be mentioned that in general, you'll want the first entry in$CDPATHto be.(an explicitly entry, i.e.:also works). Otherwise you'll end up with the odd behavior whereCDPATHdirs take precedence over directories in the current working directory, which you probably do not want.
– jw013
Feb 8 '12 at 23:40
4
I do pretty much the same thing, but without theexport. That way,CDPATHis not exported to scripts with potentially weird or harmful effects. See here for more discussion and examples.
– Telemachus
Feb 17 '12 at 12:47
"bash and ksh and cdpath in zsh" ... and in tcsh (just answering a question based on that over on Super User and found this while looking for similar answers on SE).
– Hennes
Nov 13 '13 at 7:36
This is POSIX-specified, I think. At least, the POSIX forcdrefers to it.
– mikeserv
Aug 30 '14 at 17:47
add a comment |
Something else you might try is a tool called autojump. It keeps a database of calls to it's alias (j by default) and attempts to make intelligent decisions about where you want to go. For example if you frequently type:
j ~/Pictures
You can use the following to get there in a pinch:
j Pic
It is available of Debian and Ubuntu, and included on a per-user basis in ~/.bashrc or ~/.zshrc by default.
5
Autojump is probably the best tool for this, it takes a little while to build up the database of common dirs, but once it does I think you'll find that you can't live without it. I know every time I'm on someone else's computer I feel crippled.
– quodlibetor
Feb 13 '12 at 18:29
1
thanks love this tool! And althoughcd -is handy to know if you don't already know it, I think this is a much better solution than the current top answer.
– User
Oct 13 '14 at 4:49
Installed system-wide on what systems?
– ctrl-alt-delor
Jan 17 '17 at 16:13
1
@richard It is available as a package (e.g.apt-get install autojumpin Ubuntu, but also for many others as documented on their page) for system-wide installation, but each user needs to load it into their shell environment so it can override cd to keep track of where you're going
– nealmcb
Apr 6 '17 at 17:56
Important to saysource /usr/share/autojump/autojump.shshould be added to ~/.bashrc for autojump to work.
– Pablo Bianchi
Jul 10 '17 at 2:10
|
show 1 more comment
If it's a small number of directories, you can use pushd to rotate between them:
# starting point
$ pwd
/Project/Warnest/docs
# add second dir and change to it
$ pushd ~/Dropbox/Projects/ds/test
~/Dropbox/Projects/ds/test /Project/Warnest/docs
# prove we're in the right place
$ pwd
~/Dropbox/Projects/ds/test
# swap directories
$ pushd
/Project/Warnest/docs ~/Dropbox/Projects/ds/test
unlike cd -, you can use this with more than two directories
Following up on Noach's suggestion, I'm now using this:
function pd()
{
if [[ $# -ge 1 ]];
then
choice="$1"
else
dirs -v
echo -n "? "
read choice
fi
if [[ -n $choice ]];
then
declare -i cnum="$choice"
if [[ $cnum != $choice ]];
then #choice is not numeric
choice=$(dirs -v | grep $choice | tail -1 | awk '{print $1}')
cnum="$choice"
if [[ -z $choice || $cnum != $choice ]];
then
echo "$choice not found"
return
fi
fi
choice="+$choice"
fi
pushd $choice
}
example usage:
# same as pushd +1
$ pd 1
# show a prompt, choose by number
$ pd
0 ~/Dropbox/Projects/ds/test
1 /Project/Warnest/docs
2 /tmp
? 2
/tmp ~/Dropbox/Projects/ds/test /Project/Warnest/docs
# or choose by substring match
$ pd
0 /tmp
1 ~/Dropbox/Projects/ds/test
2 /Project/Warnest/docs
? doc
/Project/Warnest/docs /tmp ~/Dropbox/Projects/ds/test
# substring without prompt
$ pd test
~/Dropbox/Projects/ds/test /Project/Warnest/docs /tmp
etc. Obviously this is just for rotating through the stack and doesn't handle adding new paths - maybe I should rename it.
6
Ooh, I knew aboutpushdandpopdfor traversal, but not that pushd could rotate what's been used so far...
– Izkata
Feb 8 '12 at 20:29
add a comment |
I use alias in bashrc to do those cds.
such as:
alias wdoc='cd ~/Project/Warnest/docs'
alias dstest='cd ~/Dropbox/Projects/ds/test'
is bashrc a file like .profile? in which I need to add those lines?
– saiy2k
Feb 8 '12 at 7:43
~/.bashrcor/etc/bash.bashrc. I did not use.profilebefore, so don't know the relationship between them :-(
– Felix Yan
Feb 8 '12 at 7:45
scripts bashrc will start everytime you open terminal. profile with startup.
– user14517
Feb 8 '12 at 10:42
added those lines to my.bash_profileand it works great.. thx :)
– saiy2k
Feb 8 '12 at 10:56
I have several specific project folders i go to regularly, this is the easiest way to set them up and maintain them. Also, for me, it results in the absolute least number of characters typed of all the solutions here. KISS! :-)
– moodboom
Jun 10 '16 at 12:08
add a comment |
I found a script (typically called acd_funch.sh) that solved this issue for me. With this you can type cd -- to see the last 10 directories that you've used. It'll look something like this:
0 ~/Documents/onedir
1 ~/Music/anotherdir
2 ~/Music/thirddir
3 ~/etc/etc
To go to ~/Music/thirddir just type cd -2
References
- scripts/acd_func.sh
- SkyRocknRoll / acd_func.sh
NOTE: This script was originally published in a linux gazette article which is available here: acd_func.sh -- extends bash's CD to keep, display and access history of visited directory names.
The very same script was also published in the Linux Gazette, Issue #109, December 2004.
– Serge Stroobandt
Jun 20 '13 at 21:12
@Dean The link goes to a music video and says that Geocities has closed.
– somethingSomething
Aug 30 '14 at 15:05
1
@somethingSomething Added alternate links.
– Dean
Aug 30 '14 at 17:42
history | grep cd
– user2180794
Feb 12 at 12:41
add a comment |
Try the cdable_vars shell option in bash. You switch it on with shopt -s cdable_vars.
Then you need to set your variables export dir1=/some/path. and finally cd dir1, etc.
You can then put it in your ~/.bashrc to make it stick.
add a comment |
Use "pushd -n" (assuming you use bash).
Add to your ~/.bashrc:
pushd -n /Project/Warnest/docs/
pushd -n ~/Dropbox/Projects/ds/test/
then,
cd ~ is your home,
cd ~1 is ~/Dropbox/Projects/ds/test/
cd ~2 is /Project/Warnest/docs/
You can use ~1,~2 etc in exactly the same way as ~.
add a comment |
There are a lot of good suggestions here. Which to use would depend on whether you have a small fixed list of directories you switch among, or whether you are looking for a more generic solution.
If it's a small fixed list, setting up simple aliases (as Felix Yan suggested) would be easiest to use.
If you're looking for a more generalized solution (i.e. many different directories, changing over time), I'd use pushd and popd (as Useless suggested). I personally find the default pushd/popd to be hard to use, especially as you start switching among many folders; however I wrote a few tweaks that make it much easier for me. Add the following to your bashrc:
alias dirs='dirs -v'
pd ()
{
if [ "$1" ]; then
pushd "${1/#[0-9]*/+$1}";
else
pushd;
fi > /dev/null
}
- Use
pd(as a shorter form ofpushd) to jump to a new folder, remembering where you were. - Use
dirsto see the list of saved directories. - Use
pd 3to jump to directory number 3.
Example Usage:
$ PS1='w$ ' ## just for demo purposes
~$ pd ~/Documents/data
~/Documents/data$ pd ../spec
~/Documents/spec$ pd ~/Dropbox/Public/
~/Dropbox/Public$ pd /tmp
/tmp$ pd /etc/defaults/
/etc/defaults$ dirs
0 /etc/defaults
1 /tmp
2 ~/Dropbox/Public
3 ~/Documents/spec
4 ~/Documents/data
5 ~
/etc/defaults$ pd 2
~/Dropbox/Public$ dirs
0 ~/Dropbox/Public
1 ~/Documents/spec
2 ~/Documents/data
3 ~
4 /etc/defaults
5 /tmp
~/Dropbox/Public$ pd 4
/etc/defaults$ dirs
0 /etc/defaults
1 /tmp
2 ~/Dropbox/Public
3 ~/Documents/spec
4 ~/Documents/data
5 ~
/etc/defaults$ pd 3
~/Documents/spec$ popd
~/Documents/data ~ /etc/defaults /tmp ~/Dropbox/Public
~/Documents/data$
add a comment |
The following appeared to work on the one case I tested it on, and you can just drop your directory names as symlinks in ~/Bookmarks:
mkdir "$HOME/Bookmarks"
ln -s /tmp "$HOME/Bookmarks/testdir"
function ccd() { cd $(readlink "$HOME/Bookmarks/$1") ; }
ccd testdir && echo $PWD
# gives /tmp
that ccd() function need to typed in the terminal prompt or somewhere else? can u pls explain?
– saiy2k
Feb 8 '12 at 8:41
1
@saiy2k: sorry, yes. Thefunctionline goes into your .bashrc (you can type it in your terminal to test, but it'll be gone when you close that window), the lines before set up the test case of "testdir" becoming a name for/tmp, and the last line is the test to see if it works.
– Ulrich Schwarz
Feb 8 '12 at 17:19
add a comment |
You could do worse than try j2.
From the README:
Spend a lot of time cd-ing around a complex directory tree?
j keeps track of where you’ve been and how much time you spend there, and provides a convenient way to jump to the directories you actually use.
I use it extensively & recommend it.
add a comment |
I'd advice using zsh, that shell as very good TAB completion for directories, files, and even options for most cli programs.
I've been using that shell for years now, and I'd miss the functionality if it was gone.
Scripting the zsh is a lot of fun, too, with a large number of one-liners that can help you every day.
No need to change to zsh for TAB completeion since bash has it all the same. For other functionality maybe but not for this.
– Peer Stritzinger
Feb 9 '12 at 11:14
1
@PeerStritzinger Bash introduced that kind of functionality in BASH 4.0, but compared to zsh, it is still quite far behind. Saying "all the same" is certainly incorrect.
– polemon
Feb 22 '12 at 0:02
Well zsh is ceartainly the übershell but just for tab completion there is no need to change (question was asked for bash). Besides bash 4.0 was introduced about 3 years ago ...
– Peer Stritzinger
Feb 22 '12 at 9:45
add a comment |
In my experience, the greatest speedup in navigating in a shell is to use its history search functionality. In Bash you can search backwards in your history of commands by pressing Ctrl+R and type in some pattern. That pattern is then matched against previous entries in your history -- may it be cd commands or other operations -- and suggestions are made as you type. Simply hit enter to run the suggested command again. This is called reverse-search-history in Bash and I love it. It saves me a lot of keystrokes and spares my internal memory.
It's a good thing because you only have to remember some smaller part of a command, like Drop or Wa to distinguish between the two history entries cd ~/Dropbox/Projects/ds/test/ and cd /Project/Warnest/docs/.
add a comment |
I also use these aliases (add them to ~/.bashrc):
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
It's much quicker to go to the upper directory with them (yet it only solves half of the navigation).
1
These are helpful aliases, but I'm not entirely sure that they will match the OP's needs. You might consider expanding on your answer to suggest how these might be directly helpful for the OP's issue.
– HalosGhost
Jul 11 '14 at 18:36
add a comment |
if you're using zsh:
you don't have to type
cd, just type directory path (/foo/bar/baz<Enter>equals tocd /foo/bar/baz<Enter>)
requires
auto_cdoption to be set
- you can expand abbreviated paths with
Tabkey (/u/sh/pi<Tab>expands to/usr/share/pixmaps; works for file names as well)
3
Bash 4 has gainedshopt -s autocd, so it's no longer a zsh-only goodness.
– Gilles
Feb 8 '12 at 23:44
add a comment |
There is a rather nice tool for quick directory changes:
xd - eXtra fast Directory changer
http://xd-home.sourceforge.net/xdman.html
a bit awkward is that you need to map it in bash profile or similar as it only outputs the directory
# function to do `cd` using `xd`
# -g turns generalized directory search command processing on
# which improves the whole thing a bit
f()
{
cd `/usr/bin/xd -g $*`
}
you can do things like:
# change to /var/log/a* (gives you a list to choose from)
f vla
# to skip the list and go directly to /var/log/apache2
f vlapach
add a comment |
You never ever should type full path in shell anyway. You always can use:
soffice /P*/W*/*/mydoc*
instead of
soffice /Project/Warnest/docs/mydoc.odt
This is like tab-completing, but worse in every way
– Michael Mrozek♦
May 14 '16 at 18:41
You can't do this with tab completing with euqal amount of keypressing unless Project is only file starting with P, etc. Also you have to wait for completion each time, using * you have no need to wait.
– gena2x
Nov 23 '16 at 12:08
I think you have it backwards -- you can't doP*unless Project is the only file starting with P. Tab completion can cycle (by default in most shells; you need to rebind tab tomenu-completein bash), and resolves instantly in simple cases like this, there's no waiting around for it
– Michael Mrozek♦
Nov 23 '16 at 15:47
Regarding 'you can't do it' - you can, try it, you missing whole point if you think you can't. Try echo /u*/b*/g++
– gena2x
Nov 23 '16 at 17:26
1
I understand what you mean, it's faster as long as you're sure you've typed an unambiguous path, but something like/P*/W*/*/mydoc*sounds like it would work fine until one day you happened to make another file that matches that glob, and suddenly you end up opening both at once./u*/*/g++is impressively few characters, but hopefully nothing else in any of the subfolders of any of my root folders starting withuis namedg++. (As a nice compromise, in some shells you can use tab to expand globs in-place as you go)
– Michael Mrozek♦
Nov 23 '16 at 17:42
|
show 3 more comments
There's also OLDPWD, an environment variable which, according to IEEE 1003.1 (POSIX), should be updated with the previous working directory each time cd changes the working directory (for the curious ones, line 80244 of page 2506 of IEEE 1003.1-2008).
add a comment |
There is also a "wcd" app created specifically for this (also ported to cygwin, since I am on that). You can create shortcuts, bookmarks of dirs with it. Also supports wild cards. Reading the man page & docs in /usr/share/wcd should help a lot.
http://manpages.ubuntu.com/manpages/hardy/man7/wcd.7.html
add a comment |
cdargs is the most efficient tool for bookmarking a directory: http://www.youtube.com/watch?v=uWB2FIQlzZg
Is this a product you are associated with?
– Kazark
Feb 27 '13 at 19:21
Thanks for pointing me to cdargs. Simplysudo apt-get cdargson ubuntu. BTW the youtube video is really bad but the tool is great.
– DavidG
Jul 21 '14 at 16:00
add a comment |
Try fastcd (https://github.com/frazenshtein/fastcd)
It sets hook that records visited directories from bash. And sets script as "j" alias, that shows you the last visited directories, with the ability to quickly cd (start typing to filter directories).
Modification of .bashrc is required to make the "j" alias.
Getting tool
cd ~; mkdir Soft; cd Soft
git clone https://github.com/frazenshtein/fastcd
Install required modules
pip install --user urwid
Source the set.sh file into your bashrc
echo -e "nsource /home/$USER/Soft/fastcd/set.shn" >> ~/.bashrc
And update bashrc
source ~/.bashrc
Then just type "j" in console
How does this work? If it's aliases, what does this tool do for you that you can't do by manually editing.bashrc?
– G-Man
Nov 3 '14 at 22:55
It launches daemon that records visited directories in ~/.fastcd for launched shells(bash). "j" launches tool that shows you the last visited directories, with the ability to quickly cd. Modification of .bashrc is required to make the "j" alias. You can see source code for more information, i guess
– Sam Toliman
Nov 3 '14 at 23:36
Thanks for your quick response. This is the sort of information that should be in the answer. Please edit your answer to include this info.
– G-Man
Nov 4 '14 at 15:21
add a comment |
I had the same question, and first found this answer. I installed the utility z (https://github.com/rupa/z).
This is exactly what you look for, because z learns from your cd commands, and keeps track of the directories according to the frecency principle (frequent & recent). So after you do both cd commands once, you can do somtehing like:
z docs
z ds
to jump to /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/ respectively. The arguments to z are regexes, so you don't even need to type a full folder name.
add a comment |
Update (2016): I now use FASD for this, which allows fuzzy search based on your latest directories.
I've created a tool for this, in Ruby. It allows you to use YAML files to declare your projects.
I've wrote a little article about it here:
http://jrnv.nl/switching-projects-terminal-quickly/
I've also posted the source on GitHub:
https://github.com/jeroenvisser101/project-switcher
add a comment |
I've been using my own utility cdhist to manage this for many years. It aliases your cd command and automatically keeps a directory stack.
add a comment |
You can use export to assign your directory paths to variables and then reference them.
export dir1=/Project/Warnest/docs/
export dir2= ~/Dropbox/Projects/ds/test/
cd $dir1
cd $dir2
Yes, this is sufficient for a few favorite dirs. No need to install any other utilities. Just put theexportstatements in your~/.bashrc, and they'll always be available.
– wisbucky
May 21 '18 at 21:44
add a comment |
Some suggestions here:
Most direct idea, I will add alias in the .profile file
vi ~/.profile
alias dir1='cd /myhome/onedir'
alias dir2='cd /jimmy/anotherdir'
Then use $ dir1 or dir2, can cd
If you are always switching in two dirs only. using cd - will switch between them.
add a comment |
The solution I use for this situation is screen. Start screen and create a window for each directory with C-a c and navigate there. Change between windows/directories with C-a n or C-a p. Name the windows with C-a A. Then you can pop up a list of your windows with C-a " and navigate using the window number or name. Since it is screen, you can detach from the session saving your work space and re-attach later with the same set up.
add a comment |
It seems that what you need is basically a project file for your workflow. With directories that belong to your activity, like in a programming IDE. Try Zsh Navigation Tools and the tool n-cd there. It will allow you to navigate across last visited folders and also define a Hotlist with directories of your choice:

n-cd can be bound to a key combination with:
zle -N znt-cd-widget
bindkey "^T" znt-cd-widget
add a comment |
TL;DR
- Use an
Fishfor interactive shell that empower you immediately (fish>zsh>bash). - Use
POSIX/Bashfor scripting that is the most widely supported syntax (POSIX>Bash>Zsh>Fish).
Shells
Having tested different shells here is my feedback (in order of testing/adoption):
Bash:
- auto-completion: basic ;
- path expansion: no ;
- scripting: excellent.
Zsh+oh-my-zsh:
- auto-completion: good (cycling through);
- path expansion: yes (
cd /e/x1→cd /etc/X11/) ; - scripting: good.
Fish+oh-my-fish(current) is the best out of the box:
- auto-completion: native and supported options;
- path expansion: yes ;
- scripting: too much difference from POSIX-compatible.
Use meaningful aliases
Every shell can be expanded using function and alias, here are the ones I use related to your issue (POSIX-compatible):
back () { # go to previous visited directory
cd - || exit
}
up () { # go to parent directory
cd ..|| exit
}
There are basic, but really meaningful so easy to remember and autocomplete.
Know your shell
Configure CDPATH to add your most used directories (e.g. ~/projects/, /etc/init.d/) so you can quickly jump to them.
See manatwork answer for mroe details on CDPATH.
Hangout and read
- my customization are on github: posix (bash/zsh), fish (PR accepted) ;
- various utilities that might be interesting: tree, k (Directory listings for zsh)
- entry-points to find plugins for your shell:
bucaran/awesome-fish,
unixorn/awesome-zsh-plugins,- alebcay/awesome-shell
bashFAQ ;
Fish documentation ;- for differences between shells, I recommend the excellent hyperpolyglot.org/unix-shells comparison.
- on their IRC: #bash, #zsh, #ohmyzsh, #fish, etc. there is a lot of nice people (you'll need to be patient young padawan).
add a comment |
anc is a cmd line tool (short for anchor), that keeps bookmarks of directories. (so far only tested with bash)
In your case:
anc a /Project/Warnest/docs/ ~/Dropbox/Projects/ds/test/
this adds both directories to the anchor(think bookmarks) list
now if you want to jump to /Project/Warnest/docs/ from anywhere
on your system type:
anc Warn
and if you want to jump to ~/Dropbox/Projects/ds/test/ type:
anc ds test
Apart from matching text against the bookmarked paths anc has many other
convenient ways for jumping around directories.
anc i
starts the interactive mode, that lists all bookmarks by number,
so all you have to type is the number
If you type:
anc Pro[TAB]
a list matching all bookmarks (in your case both bookmarks) gets shown and you can select from it using your arrow keys, this is a very quick and intuitive way.
Get anc at the project's github page:
https://github.com/tobimensch/anc
There's also a README with example usage.
Full disclosure: I'm the author of this script. I hope some people will find it useful.
add a comment |
1 2
next
protected by Kusalananda Feb 1 '18 at 14:48
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
35 Answers
35
active
oldest
votes
35 Answers
35
active
oldest
votes
active
oldest
votes
active
oldest
votes
1 2
next
If you're just switching between two directories, you can use cd - to go back and forth.
13
How this has eluded me for so long is a mystery. Thank you very much for this excellent tip.
– Mr. Shickadance
Feb 9 '12 at 15:21
3
+1 Certainly one of my favorites and one that somehow many experts have 'missed'.
– Michael Durrant
Apr 24 '12 at 2:17
add a comment |
If you're just switching between two directories, you can use cd - to go back and forth.
13
How this has eluded me for so long is a mystery. Thank you very much for this excellent tip.
– Mr. Shickadance
Feb 9 '12 at 15:21
3
+1 Certainly one of my favorites and one that somehow many experts have 'missed'.
– Michael Durrant
Apr 24 '12 at 2:17
add a comment |
If you're just switching between two directories, you can use cd - to go back and forth.
If you're just switching between two directories, you can use cd - to go back and forth.
edited Feb 8 '12 at 10:22
Mat
39.6k8121127
39.6k8121127
answered Feb 8 '12 at 9:45
Chris CardChris Card
2,0161106
2,0161106
13
How this has eluded me for so long is a mystery. Thank you very much for this excellent tip.
– Mr. Shickadance
Feb 9 '12 at 15:21
3
+1 Certainly one of my favorites and one that somehow many experts have 'missed'.
– Michael Durrant
Apr 24 '12 at 2:17
add a comment |
13
How this has eluded me for so long is a mystery. Thank you very much for this excellent tip.
– Mr. Shickadance
Feb 9 '12 at 15:21
3
+1 Certainly one of my favorites and one that somehow many experts have 'missed'.
– Michael Durrant
Apr 24 '12 at 2:17
13
13
How this has eluded me for so long is a mystery. Thank you very much for this excellent tip.
– Mr. Shickadance
Feb 9 '12 at 15:21
How this has eluded me for so long is a mystery. Thank you very much for this excellent tip.
– Mr. Shickadance
Feb 9 '12 at 15:21
3
3
+1 Certainly one of my favorites and one that somehow many experts have 'missed'.
– Michael Durrant
Apr 24 '12 at 2:17
+1 Certainly one of my favorites and one that somehow many experts have 'missed'.
– Michael Durrant
Apr 24 '12 at 2:17
add a comment |
There is a shell variable CDPATH in bash and ksh and cdpath in zsh:
CDPATH The search path for the cd command. This is a colon-separated
list of directories in which the shell looks for destination
directories specified by the cd command.
So you can set in your ~/.bashrc:
export CDPATH=/Project/Warnest:~/Dropbox/Projects/ds
Then cd docs and cd test will take you to the first found such directory. (I mean, even if a directory with the same name will exist in the current directory, CDPATH will still be consulted. If CDPATH will contain more directories having subdirectories with the given name, the first one will be used.)
16
It should be mentioned that in general, you'll want the first entry in$CDPATHto be.(an explicitly entry, i.e.:also works). Otherwise you'll end up with the odd behavior whereCDPATHdirs take precedence over directories in the current working directory, which you probably do not want.
– jw013
Feb 8 '12 at 23:40
4
I do pretty much the same thing, but without theexport. That way,CDPATHis not exported to scripts with potentially weird or harmful effects. See here for more discussion and examples.
– Telemachus
Feb 17 '12 at 12:47
"bash and ksh and cdpath in zsh" ... and in tcsh (just answering a question based on that over on Super User and found this while looking for similar answers on SE).
– Hennes
Nov 13 '13 at 7:36
This is POSIX-specified, I think. At least, the POSIX forcdrefers to it.
– mikeserv
Aug 30 '14 at 17:47
add a comment |
There is a shell variable CDPATH in bash and ksh and cdpath in zsh:
CDPATH The search path for the cd command. This is a colon-separated
list of directories in which the shell looks for destination
directories specified by the cd command.
So you can set in your ~/.bashrc:
export CDPATH=/Project/Warnest:~/Dropbox/Projects/ds
Then cd docs and cd test will take you to the first found such directory. (I mean, even if a directory with the same name will exist in the current directory, CDPATH will still be consulted. If CDPATH will contain more directories having subdirectories with the given name, the first one will be used.)
16
It should be mentioned that in general, you'll want the first entry in$CDPATHto be.(an explicitly entry, i.e.:also works). Otherwise you'll end up with the odd behavior whereCDPATHdirs take precedence over directories in the current working directory, which you probably do not want.
– jw013
Feb 8 '12 at 23:40
4
I do pretty much the same thing, but without theexport. That way,CDPATHis not exported to scripts with potentially weird or harmful effects. See here for more discussion and examples.
– Telemachus
Feb 17 '12 at 12:47
"bash and ksh and cdpath in zsh" ... and in tcsh (just answering a question based on that over on Super User and found this while looking for similar answers on SE).
– Hennes
Nov 13 '13 at 7:36
This is POSIX-specified, I think. At least, the POSIX forcdrefers to it.
– mikeserv
Aug 30 '14 at 17:47
add a comment |
There is a shell variable CDPATH in bash and ksh and cdpath in zsh:
CDPATH The search path for the cd command. This is a colon-separated
list of directories in which the shell looks for destination
directories specified by the cd command.
So you can set in your ~/.bashrc:
export CDPATH=/Project/Warnest:~/Dropbox/Projects/ds
Then cd docs and cd test will take you to the first found such directory. (I mean, even if a directory with the same name will exist in the current directory, CDPATH will still be consulted. If CDPATH will contain more directories having subdirectories with the given name, the first one will be used.)
There is a shell variable CDPATH in bash and ksh and cdpath in zsh:
CDPATH The search path for the cd command. This is a colon-separated
list of directories in which the shell looks for destination
directories specified by the cd command.
So you can set in your ~/.bashrc:
export CDPATH=/Project/Warnest:~/Dropbox/Projects/ds
Then cd docs and cd test will take you to the first found such directory. (I mean, even if a directory with the same name will exist in the current directory, CDPATH will still be consulted. If CDPATH will contain more directories having subdirectories with the given name, the first one will be used.)
edited Feb 9 '12 at 6:59
answered Feb 8 '12 at 11:19
manatworkmanatwork
22k38385
22k38385
16
It should be mentioned that in general, you'll want the first entry in$CDPATHto be.(an explicitly entry, i.e.:also works). Otherwise you'll end up with the odd behavior whereCDPATHdirs take precedence over directories in the current working directory, which you probably do not want.
– jw013
Feb 8 '12 at 23:40
4
I do pretty much the same thing, but without theexport. That way,CDPATHis not exported to scripts with potentially weird or harmful effects. See here for more discussion and examples.
– Telemachus
Feb 17 '12 at 12:47
"bash and ksh and cdpath in zsh" ... and in tcsh (just answering a question based on that over on Super User and found this while looking for similar answers on SE).
– Hennes
Nov 13 '13 at 7:36
This is POSIX-specified, I think. At least, the POSIX forcdrefers to it.
– mikeserv
Aug 30 '14 at 17:47
add a comment |
16
It should be mentioned that in general, you'll want the first entry in$CDPATHto be.(an explicitly entry, i.e.:also works). Otherwise you'll end up with the odd behavior whereCDPATHdirs take precedence over directories in the current working directory, which you probably do not want.
– jw013
Feb 8 '12 at 23:40
4
I do pretty much the same thing, but without theexport. That way,CDPATHis not exported to scripts with potentially weird or harmful effects. See here for more discussion and examples.
– Telemachus
Feb 17 '12 at 12:47
"bash and ksh and cdpath in zsh" ... and in tcsh (just answering a question based on that over on Super User and found this while looking for similar answers on SE).
– Hennes
Nov 13 '13 at 7:36
This is POSIX-specified, I think. At least, the POSIX forcdrefers to it.
– mikeserv
Aug 30 '14 at 17:47
16
16
It should be mentioned that in general, you'll want the first entry in
$CDPATH to be . (an explicitly entry, i.e. : also works). Otherwise you'll end up with the odd behavior where CDPATH dirs take precedence over directories in the current working directory, which you probably do not want.– jw013
Feb 8 '12 at 23:40
It should be mentioned that in general, you'll want the first entry in
$CDPATH to be . (an explicitly entry, i.e. : also works). Otherwise you'll end up with the odd behavior where CDPATH dirs take precedence over directories in the current working directory, which you probably do not want.– jw013
Feb 8 '12 at 23:40
4
4
I do pretty much the same thing, but without the
export. That way, CDPATH is not exported to scripts with potentially weird or harmful effects. See here for more discussion and examples.– Telemachus
Feb 17 '12 at 12:47
I do pretty much the same thing, but without the
export. That way, CDPATH is not exported to scripts with potentially weird or harmful effects. See here for more discussion and examples.– Telemachus
Feb 17 '12 at 12:47
"bash and ksh and cdpath in zsh" ... and in tcsh (just answering a question based on that over on Super User and found this while looking for similar answers on SE).
– Hennes
Nov 13 '13 at 7:36
"bash and ksh and cdpath in zsh" ... and in tcsh (just answering a question based on that over on Super User and found this while looking for similar answers on SE).
– Hennes
Nov 13 '13 at 7:36
This is POSIX-specified, I think. At least, the POSIX for
cd refers to it.– mikeserv
Aug 30 '14 at 17:47
This is POSIX-specified, I think. At least, the POSIX for
cd refers to it.– mikeserv
Aug 30 '14 at 17:47
add a comment |
Something else you might try is a tool called autojump. It keeps a database of calls to it's alias (j by default) and attempts to make intelligent decisions about where you want to go. For example if you frequently type:
j ~/Pictures
You can use the following to get there in a pinch:
j Pic
It is available of Debian and Ubuntu, and included on a per-user basis in ~/.bashrc or ~/.zshrc by default.
5
Autojump is probably the best tool for this, it takes a little while to build up the database of common dirs, but once it does I think you'll find that you can't live without it. I know every time I'm on someone else's computer I feel crippled.
– quodlibetor
Feb 13 '12 at 18:29
1
thanks love this tool! And althoughcd -is handy to know if you don't already know it, I think this is a much better solution than the current top answer.
– User
Oct 13 '14 at 4:49
Installed system-wide on what systems?
– ctrl-alt-delor
Jan 17 '17 at 16:13
1
@richard It is available as a package (e.g.apt-get install autojumpin Ubuntu, but also for many others as documented on their page) for system-wide installation, but each user needs to load it into their shell environment so it can override cd to keep track of where you're going
– nealmcb
Apr 6 '17 at 17:56
Important to saysource /usr/share/autojump/autojump.shshould be added to ~/.bashrc for autojump to work.
– Pablo Bianchi
Jul 10 '17 at 2:10
|
show 1 more comment
Something else you might try is a tool called autojump. It keeps a database of calls to it's alias (j by default) and attempts to make intelligent decisions about where you want to go. For example if you frequently type:
j ~/Pictures
You can use the following to get there in a pinch:
j Pic
It is available of Debian and Ubuntu, and included on a per-user basis in ~/.bashrc or ~/.zshrc by default.
5
Autojump is probably the best tool for this, it takes a little while to build up the database of common dirs, but once it does I think you'll find that you can't live without it. I know every time I'm on someone else's computer I feel crippled.
– quodlibetor
Feb 13 '12 at 18:29
1
thanks love this tool! And althoughcd -is handy to know if you don't already know it, I think this is a much better solution than the current top answer.
– User
Oct 13 '14 at 4:49
Installed system-wide on what systems?
– ctrl-alt-delor
Jan 17 '17 at 16:13
1
@richard It is available as a package (e.g.apt-get install autojumpin Ubuntu, but also for many others as documented on their page) for system-wide installation, but each user needs to load it into their shell environment so it can override cd to keep track of where you're going
– nealmcb
Apr 6 '17 at 17:56
Important to saysource /usr/share/autojump/autojump.shshould be added to ~/.bashrc for autojump to work.
– Pablo Bianchi
Jul 10 '17 at 2:10
|
show 1 more comment
Something else you might try is a tool called autojump. It keeps a database of calls to it's alias (j by default) and attempts to make intelligent decisions about where you want to go. For example if you frequently type:
j ~/Pictures
You can use the following to get there in a pinch:
j Pic
It is available of Debian and Ubuntu, and included on a per-user basis in ~/.bashrc or ~/.zshrc by default.
Something else you might try is a tool called autojump. It keeps a database of calls to it's alias (j by default) and attempts to make intelligent decisions about where you want to go. For example if you frequently type:
j ~/Pictures
You can use the following to get there in a pinch:
j Pic
It is available of Debian and Ubuntu, and included on a per-user basis in ~/.bashrc or ~/.zshrc by default.
edited Apr 6 '17 at 19:11
ctrl-alt-delor
11.9k42260
11.9k42260
answered Feb 8 '12 at 22:13
Kyle SmithKyle Smith
74146
74146
5
Autojump is probably the best tool for this, it takes a little while to build up the database of common dirs, but once it does I think you'll find that you can't live without it. I know every time I'm on someone else's computer I feel crippled.
– quodlibetor
Feb 13 '12 at 18:29
1
thanks love this tool! And althoughcd -is handy to know if you don't already know it, I think this is a much better solution than the current top answer.
– User
Oct 13 '14 at 4:49
Installed system-wide on what systems?
– ctrl-alt-delor
Jan 17 '17 at 16:13
1
@richard It is available as a package (e.g.apt-get install autojumpin Ubuntu, but also for many others as documented on their page) for system-wide installation, but each user needs to load it into their shell environment so it can override cd to keep track of where you're going
– nealmcb
Apr 6 '17 at 17:56
Important to saysource /usr/share/autojump/autojump.shshould be added to ~/.bashrc for autojump to work.
– Pablo Bianchi
Jul 10 '17 at 2:10
|
show 1 more comment
5
Autojump is probably the best tool for this, it takes a little while to build up the database of common dirs, but once it does I think you'll find that you can't live without it. I know every time I'm on someone else's computer I feel crippled.
– quodlibetor
Feb 13 '12 at 18:29
1
thanks love this tool! And althoughcd -is handy to know if you don't already know it, I think this is a much better solution than the current top answer.
– User
Oct 13 '14 at 4:49
Installed system-wide on what systems?
– ctrl-alt-delor
Jan 17 '17 at 16:13
1
@richard It is available as a package (e.g.apt-get install autojumpin Ubuntu, but also for many others as documented on their page) for system-wide installation, but each user needs to load it into their shell environment so it can override cd to keep track of where you're going
– nealmcb
Apr 6 '17 at 17:56
Important to saysource /usr/share/autojump/autojump.shshould be added to ~/.bashrc for autojump to work.
– Pablo Bianchi
Jul 10 '17 at 2:10
5
5
Autojump is probably the best tool for this, it takes a little while to build up the database of common dirs, but once it does I think you'll find that you can't live without it. I know every time I'm on someone else's computer I feel crippled.
– quodlibetor
Feb 13 '12 at 18:29
Autojump is probably the best tool for this, it takes a little while to build up the database of common dirs, but once it does I think you'll find that you can't live without it. I know every time I'm on someone else's computer I feel crippled.
– quodlibetor
Feb 13 '12 at 18:29
1
1
thanks love this tool! And although
cd - is handy to know if you don't already know it, I think this is a much better solution than the current top answer.– User
Oct 13 '14 at 4:49
thanks love this tool! And although
cd - is handy to know if you don't already know it, I think this is a much better solution than the current top answer.– User
Oct 13 '14 at 4:49
Installed system-wide on what systems?
– ctrl-alt-delor
Jan 17 '17 at 16:13
Installed system-wide on what systems?
– ctrl-alt-delor
Jan 17 '17 at 16:13
1
1
@richard It is available as a package (e.g.
apt-get install autojump in Ubuntu, but also for many others as documented on their page) for system-wide installation, but each user needs to load it into their shell environment so it can override cd to keep track of where you're going– nealmcb
Apr 6 '17 at 17:56
@richard It is available as a package (e.g.
apt-get install autojump in Ubuntu, but also for many others as documented on their page) for system-wide installation, but each user needs to load it into their shell environment so it can override cd to keep track of where you're going– nealmcb
Apr 6 '17 at 17:56
Important to say
source /usr/share/autojump/autojump.sh should be added to ~/.bashrc for autojump to work.– Pablo Bianchi
Jul 10 '17 at 2:10
Important to say
source /usr/share/autojump/autojump.sh should be added to ~/.bashrc for autojump to work.– Pablo Bianchi
Jul 10 '17 at 2:10
|
show 1 more comment
If it's a small number of directories, you can use pushd to rotate between them:
# starting point
$ pwd
/Project/Warnest/docs
# add second dir and change to it
$ pushd ~/Dropbox/Projects/ds/test
~/Dropbox/Projects/ds/test /Project/Warnest/docs
# prove we're in the right place
$ pwd
~/Dropbox/Projects/ds/test
# swap directories
$ pushd
/Project/Warnest/docs ~/Dropbox/Projects/ds/test
unlike cd -, you can use this with more than two directories
Following up on Noach's suggestion, I'm now using this:
function pd()
{
if [[ $# -ge 1 ]];
then
choice="$1"
else
dirs -v
echo -n "? "
read choice
fi
if [[ -n $choice ]];
then
declare -i cnum="$choice"
if [[ $cnum != $choice ]];
then #choice is not numeric
choice=$(dirs -v | grep $choice | tail -1 | awk '{print $1}')
cnum="$choice"
if [[ -z $choice || $cnum != $choice ]];
then
echo "$choice not found"
return
fi
fi
choice="+$choice"
fi
pushd $choice
}
example usage:
# same as pushd +1
$ pd 1
# show a prompt, choose by number
$ pd
0 ~/Dropbox/Projects/ds/test
1 /Project/Warnest/docs
2 /tmp
? 2
/tmp ~/Dropbox/Projects/ds/test /Project/Warnest/docs
# or choose by substring match
$ pd
0 /tmp
1 ~/Dropbox/Projects/ds/test
2 /Project/Warnest/docs
? doc
/Project/Warnest/docs /tmp ~/Dropbox/Projects/ds/test
# substring without prompt
$ pd test
~/Dropbox/Projects/ds/test /Project/Warnest/docs /tmp
etc. Obviously this is just for rotating through the stack and doesn't handle adding new paths - maybe I should rename it.
6
Ooh, I knew aboutpushdandpopdfor traversal, but not that pushd could rotate what's been used so far...
– Izkata
Feb 8 '12 at 20:29
add a comment |
If it's a small number of directories, you can use pushd to rotate between them:
# starting point
$ pwd
/Project/Warnest/docs
# add second dir and change to it
$ pushd ~/Dropbox/Projects/ds/test
~/Dropbox/Projects/ds/test /Project/Warnest/docs
# prove we're in the right place
$ pwd
~/Dropbox/Projects/ds/test
# swap directories
$ pushd
/Project/Warnest/docs ~/Dropbox/Projects/ds/test
unlike cd -, you can use this with more than two directories
Following up on Noach's suggestion, I'm now using this:
function pd()
{
if [[ $# -ge 1 ]];
then
choice="$1"
else
dirs -v
echo -n "? "
read choice
fi
if [[ -n $choice ]];
then
declare -i cnum="$choice"
if [[ $cnum != $choice ]];
then #choice is not numeric
choice=$(dirs -v | grep $choice | tail -1 | awk '{print $1}')
cnum="$choice"
if [[ -z $choice || $cnum != $choice ]];
then
echo "$choice not found"
return
fi
fi
choice="+$choice"
fi
pushd $choice
}
example usage:
# same as pushd +1
$ pd 1
# show a prompt, choose by number
$ pd
0 ~/Dropbox/Projects/ds/test
1 /Project/Warnest/docs
2 /tmp
? 2
/tmp ~/Dropbox/Projects/ds/test /Project/Warnest/docs
# or choose by substring match
$ pd
0 /tmp
1 ~/Dropbox/Projects/ds/test
2 /Project/Warnest/docs
? doc
/Project/Warnest/docs /tmp ~/Dropbox/Projects/ds/test
# substring without prompt
$ pd test
~/Dropbox/Projects/ds/test /Project/Warnest/docs /tmp
etc. Obviously this is just for rotating through the stack and doesn't handle adding new paths - maybe I should rename it.
6
Ooh, I knew aboutpushdandpopdfor traversal, but not that pushd could rotate what's been used so far...
– Izkata
Feb 8 '12 at 20:29
add a comment |
If it's a small number of directories, you can use pushd to rotate between them:
# starting point
$ pwd
/Project/Warnest/docs
# add second dir and change to it
$ pushd ~/Dropbox/Projects/ds/test
~/Dropbox/Projects/ds/test /Project/Warnest/docs
# prove we're in the right place
$ pwd
~/Dropbox/Projects/ds/test
# swap directories
$ pushd
/Project/Warnest/docs ~/Dropbox/Projects/ds/test
unlike cd -, you can use this with more than two directories
Following up on Noach's suggestion, I'm now using this:
function pd()
{
if [[ $# -ge 1 ]];
then
choice="$1"
else
dirs -v
echo -n "? "
read choice
fi
if [[ -n $choice ]];
then
declare -i cnum="$choice"
if [[ $cnum != $choice ]];
then #choice is not numeric
choice=$(dirs -v | grep $choice | tail -1 | awk '{print $1}')
cnum="$choice"
if [[ -z $choice || $cnum != $choice ]];
then
echo "$choice not found"
return
fi
fi
choice="+$choice"
fi
pushd $choice
}
example usage:
# same as pushd +1
$ pd 1
# show a prompt, choose by number
$ pd
0 ~/Dropbox/Projects/ds/test
1 /Project/Warnest/docs
2 /tmp
? 2
/tmp ~/Dropbox/Projects/ds/test /Project/Warnest/docs
# or choose by substring match
$ pd
0 /tmp
1 ~/Dropbox/Projects/ds/test
2 /Project/Warnest/docs
? doc
/Project/Warnest/docs /tmp ~/Dropbox/Projects/ds/test
# substring without prompt
$ pd test
~/Dropbox/Projects/ds/test /Project/Warnest/docs /tmp
etc. Obviously this is just for rotating through the stack and doesn't handle adding new paths - maybe I should rename it.
If it's a small number of directories, you can use pushd to rotate between them:
# starting point
$ pwd
/Project/Warnest/docs
# add second dir and change to it
$ pushd ~/Dropbox/Projects/ds/test
~/Dropbox/Projects/ds/test /Project/Warnest/docs
# prove we're in the right place
$ pwd
~/Dropbox/Projects/ds/test
# swap directories
$ pushd
/Project/Warnest/docs ~/Dropbox/Projects/ds/test
unlike cd -, you can use this with more than two directories
Following up on Noach's suggestion, I'm now using this:
function pd()
{
if [[ $# -ge 1 ]];
then
choice="$1"
else
dirs -v
echo -n "? "
read choice
fi
if [[ -n $choice ]];
then
declare -i cnum="$choice"
if [[ $cnum != $choice ]];
then #choice is not numeric
choice=$(dirs -v | grep $choice | tail -1 | awk '{print $1}')
cnum="$choice"
if [[ -z $choice || $cnum != $choice ]];
then
echo "$choice not found"
return
fi
fi
choice="+$choice"
fi
pushd $choice
}
example usage:
# same as pushd +1
$ pd 1
# show a prompt, choose by number
$ pd
0 ~/Dropbox/Projects/ds/test
1 /Project/Warnest/docs
2 /tmp
? 2
/tmp ~/Dropbox/Projects/ds/test /Project/Warnest/docs
# or choose by substring match
$ pd
0 /tmp
1 ~/Dropbox/Projects/ds/test
2 /Project/Warnest/docs
? doc
/Project/Warnest/docs /tmp ~/Dropbox/Projects/ds/test
# substring without prompt
$ pd test
~/Dropbox/Projects/ds/test /Project/Warnest/docs /tmp
etc. Obviously this is just for rotating through the stack and doesn't handle adding new paths - maybe I should rename it.
edited Feb 10 '12 at 9:34
answered Feb 8 '12 at 12:57
UselessUseless
3,4281419
3,4281419
6
Ooh, I knew aboutpushdandpopdfor traversal, but not that pushd could rotate what's been used so far...
– Izkata
Feb 8 '12 at 20:29
add a comment |
6
Ooh, I knew aboutpushdandpopdfor traversal, but not that pushd could rotate what's been used so far...
– Izkata
Feb 8 '12 at 20:29
6
6
Ooh, I knew about
pushd and popd for traversal, but not that pushd could rotate what's been used so far...– Izkata
Feb 8 '12 at 20:29
Ooh, I knew about
pushd and popd for traversal, but not that pushd could rotate what's been used so far...– Izkata
Feb 8 '12 at 20:29
add a comment |
I use alias in bashrc to do those cds.
such as:
alias wdoc='cd ~/Project/Warnest/docs'
alias dstest='cd ~/Dropbox/Projects/ds/test'
is bashrc a file like .profile? in which I need to add those lines?
– saiy2k
Feb 8 '12 at 7:43
~/.bashrcor/etc/bash.bashrc. I did not use.profilebefore, so don't know the relationship between them :-(
– Felix Yan
Feb 8 '12 at 7:45
scripts bashrc will start everytime you open terminal. profile with startup.
– user14517
Feb 8 '12 at 10:42
added those lines to my.bash_profileand it works great.. thx :)
– saiy2k
Feb 8 '12 at 10:56
I have several specific project folders i go to regularly, this is the easiest way to set them up and maintain them. Also, for me, it results in the absolute least number of characters typed of all the solutions here. KISS! :-)
– moodboom
Jun 10 '16 at 12:08
add a comment |
I use alias in bashrc to do those cds.
such as:
alias wdoc='cd ~/Project/Warnest/docs'
alias dstest='cd ~/Dropbox/Projects/ds/test'
is bashrc a file like .profile? in which I need to add those lines?
– saiy2k
Feb 8 '12 at 7:43
~/.bashrcor/etc/bash.bashrc. I did not use.profilebefore, so don't know the relationship between them :-(
– Felix Yan
Feb 8 '12 at 7:45
scripts bashrc will start everytime you open terminal. profile with startup.
– user14517
Feb 8 '12 at 10:42
added those lines to my.bash_profileand it works great.. thx :)
– saiy2k
Feb 8 '12 at 10:56
I have several specific project folders i go to regularly, this is the easiest way to set them up and maintain them. Also, for me, it results in the absolute least number of characters typed of all the solutions here. KISS! :-)
– moodboom
Jun 10 '16 at 12:08
add a comment |
I use alias in bashrc to do those cds.
such as:
alias wdoc='cd ~/Project/Warnest/docs'
alias dstest='cd ~/Dropbox/Projects/ds/test'
I use alias in bashrc to do those cds.
such as:
alias wdoc='cd ~/Project/Warnest/docs'
alias dstest='cd ~/Dropbox/Projects/ds/test'
answered Feb 8 '12 at 7:39
Felix YanFelix Yan
5751513
5751513
is bashrc a file like .profile? in which I need to add those lines?
– saiy2k
Feb 8 '12 at 7:43
~/.bashrcor/etc/bash.bashrc. I did not use.profilebefore, so don't know the relationship between them :-(
– Felix Yan
Feb 8 '12 at 7:45
scripts bashrc will start everytime you open terminal. profile with startup.
– user14517
Feb 8 '12 at 10:42
added those lines to my.bash_profileand it works great.. thx :)
– saiy2k
Feb 8 '12 at 10:56
I have several specific project folders i go to regularly, this is the easiest way to set them up and maintain them. Also, for me, it results in the absolute least number of characters typed of all the solutions here. KISS! :-)
– moodboom
Jun 10 '16 at 12:08
add a comment |
is bashrc a file like .profile? in which I need to add those lines?
– saiy2k
Feb 8 '12 at 7:43
~/.bashrcor/etc/bash.bashrc. I did not use.profilebefore, so don't know the relationship between them :-(
– Felix Yan
Feb 8 '12 at 7:45
scripts bashrc will start everytime you open terminal. profile with startup.
– user14517
Feb 8 '12 at 10:42
added those lines to my.bash_profileand it works great.. thx :)
– saiy2k
Feb 8 '12 at 10:56
I have several specific project folders i go to regularly, this is the easiest way to set them up and maintain them. Also, for me, it results in the absolute least number of characters typed of all the solutions here. KISS! :-)
– moodboom
Jun 10 '16 at 12:08
is bashrc a file like .profile? in which I need to add those lines?
– saiy2k
Feb 8 '12 at 7:43
is bashrc a file like .profile? in which I need to add those lines?
– saiy2k
Feb 8 '12 at 7:43
~/.bashrc or /etc/bash.bashrc. I did not use .profile before, so don't know the relationship between them :-(– Felix Yan
Feb 8 '12 at 7:45
~/.bashrc or /etc/bash.bashrc. I did not use .profile before, so don't know the relationship between them :-(– Felix Yan
Feb 8 '12 at 7:45
scripts bashrc will start everytime you open terminal. profile with startup.
– user14517
Feb 8 '12 at 10:42
scripts bashrc will start everytime you open terminal. profile with startup.
– user14517
Feb 8 '12 at 10:42
added those lines to my
.bash_profile and it works great.. thx :)– saiy2k
Feb 8 '12 at 10:56
added those lines to my
.bash_profile and it works great.. thx :)– saiy2k
Feb 8 '12 at 10:56
I have several specific project folders i go to regularly, this is the easiest way to set them up and maintain them. Also, for me, it results in the absolute least number of characters typed of all the solutions here. KISS! :-)
– moodboom
Jun 10 '16 at 12:08
I have several specific project folders i go to regularly, this is the easiest way to set them up and maintain them. Also, for me, it results in the absolute least number of characters typed of all the solutions here. KISS! :-)
– moodboom
Jun 10 '16 at 12:08
add a comment |
I found a script (typically called acd_funch.sh) that solved this issue for me. With this you can type cd -- to see the last 10 directories that you've used. It'll look something like this:
0 ~/Documents/onedir
1 ~/Music/anotherdir
2 ~/Music/thirddir
3 ~/etc/etc
To go to ~/Music/thirddir just type cd -2
References
- scripts/acd_func.sh
- SkyRocknRoll / acd_func.sh
NOTE: This script was originally published in a linux gazette article which is available here: acd_func.sh -- extends bash's CD to keep, display and access history of visited directory names.
The very same script was also published in the Linux Gazette, Issue #109, December 2004.
– Serge Stroobandt
Jun 20 '13 at 21:12
@Dean The link goes to a music video and says that Geocities has closed.
– somethingSomething
Aug 30 '14 at 15:05
1
@somethingSomething Added alternate links.
– Dean
Aug 30 '14 at 17:42
history | grep cd
– user2180794
Feb 12 at 12:41
add a comment |
I found a script (typically called acd_funch.sh) that solved this issue for me. With this you can type cd -- to see the last 10 directories that you've used. It'll look something like this:
0 ~/Documents/onedir
1 ~/Music/anotherdir
2 ~/Music/thirddir
3 ~/etc/etc
To go to ~/Music/thirddir just type cd -2
References
- scripts/acd_func.sh
- SkyRocknRoll / acd_func.sh
NOTE: This script was originally published in a linux gazette article which is available here: acd_func.sh -- extends bash's CD to keep, display and access history of visited directory names.
The very same script was also published in the Linux Gazette, Issue #109, December 2004.
– Serge Stroobandt
Jun 20 '13 at 21:12
@Dean The link goes to a music video and says that Geocities has closed.
– somethingSomething
Aug 30 '14 at 15:05
1
@somethingSomething Added alternate links.
– Dean
Aug 30 '14 at 17:42
history | grep cd
– user2180794
Feb 12 at 12:41
add a comment |
I found a script (typically called acd_funch.sh) that solved this issue for me. With this you can type cd -- to see the last 10 directories that you've used. It'll look something like this:
0 ~/Documents/onedir
1 ~/Music/anotherdir
2 ~/Music/thirddir
3 ~/etc/etc
To go to ~/Music/thirddir just type cd -2
References
- scripts/acd_func.sh
- SkyRocknRoll / acd_func.sh
NOTE: This script was originally published in a linux gazette article which is available here: acd_func.sh -- extends bash's CD to keep, display and access history of visited directory names.
I found a script (typically called acd_funch.sh) that solved this issue for me. With this you can type cd -- to see the last 10 directories that you've used. It'll look something like this:
0 ~/Documents/onedir
1 ~/Music/anotherdir
2 ~/Music/thirddir
3 ~/etc/etc
To go to ~/Music/thirddir just type cd -2
References
- scripts/acd_func.sh
- SkyRocknRoll / acd_func.sh
NOTE: This script was originally published in a linux gazette article which is available here: acd_func.sh -- extends bash's CD to keep, display and access history of visited directory names.
edited Jul 9 '15 at 12:33
slm♦
253k70534685
253k70534685
answered Feb 9 '12 at 3:30
DeanDean
48637
48637
The very same script was also published in the Linux Gazette, Issue #109, December 2004.
– Serge Stroobandt
Jun 20 '13 at 21:12
@Dean The link goes to a music video and says that Geocities has closed.
– somethingSomething
Aug 30 '14 at 15:05
1
@somethingSomething Added alternate links.
– Dean
Aug 30 '14 at 17:42
history | grep cd
– user2180794
Feb 12 at 12:41
add a comment |
The very same script was also published in the Linux Gazette, Issue #109, December 2004.
– Serge Stroobandt
Jun 20 '13 at 21:12
@Dean The link goes to a music video and says that Geocities has closed.
– somethingSomething
Aug 30 '14 at 15:05
1
@somethingSomething Added alternate links.
– Dean
Aug 30 '14 at 17:42
history | grep cd
– user2180794
Feb 12 at 12:41
The very same script was also published in the Linux Gazette, Issue #109, December 2004.
– Serge Stroobandt
Jun 20 '13 at 21:12
The very same script was also published in the Linux Gazette, Issue #109, December 2004.
– Serge Stroobandt
Jun 20 '13 at 21:12
@Dean The link goes to a music video and says that Geocities has closed.
– somethingSomething
Aug 30 '14 at 15:05
@Dean The link goes to a music video and says that Geocities has closed.
– somethingSomething
Aug 30 '14 at 15:05
1
1
@somethingSomething Added alternate links.
– Dean
Aug 30 '14 at 17:42
@somethingSomething Added alternate links.
– Dean
Aug 30 '14 at 17:42
history | grep cd
– user2180794
Feb 12 at 12:41
history | grep cd
– user2180794
Feb 12 at 12:41
add a comment |
Try the cdable_vars shell option in bash. You switch it on with shopt -s cdable_vars.
Then you need to set your variables export dir1=/some/path. and finally cd dir1, etc.
You can then put it in your ~/.bashrc to make it stick.
add a comment |
Try the cdable_vars shell option in bash. You switch it on with shopt -s cdable_vars.
Then you need to set your variables export dir1=/some/path. and finally cd dir1, etc.
You can then put it in your ~/.bashrc to make it stick.
add a comment |
Try the cdable_vars shell option in bash. You switch it on with shopt -s cdable_vars.
Then you need to set your variables export dir1=/some/path. and finally cd dir1, etc.
You can then put it in your ~/.bashrc to make it stick.
Try the cdable_vars shell option in bash. You switch it on with shopt -s cdable_vars.
Then you need to set your variables export dir1=/some/path. and finally cd dir1, etc.
You can then put it in your ~/.bashrc to make it stick.
edited Feb 9 '12 at 6:21
Mat
39.6k8121127
39.6k8121127
answered Feb 8 '12 at 22:39
Wojtek RzepalaWojtek Rzepala
1,84411222
1,84411222
add a comment |
add a comment |
Use "pushd -n" (assuming you use bash).
Add to your ~/.bashrc:
pushd -n /Project/Warnest/docs/
pushd -n ~/Dropbox/Projects/ds/test/
then,
cd ~ is your home,
cd ~1 is ~/Dropbox/Projects/ds/test/
cd ~2 is /Project/Warnest/docs/
You can use ~1,~2 etc in exactly the same way as ~.
add a comment |
Use "pushd -n" (assuming you use bash).
Add to your ~/.bashrc:
pushd -n /Project/Warnest/docs/
pushd -n ~/Dropbox/Projects/ds/test/
then,
cd ~ is your home,
cd ~1 is ~/Dropbox/Projects/ds/test/
cd ~2 is /Project/Warnest/docs/
You can use ~1,~2 etc in exactly the same way as ~.
add a comment |
Use "pushd -n" (assuming you use bash).
Add to your ~/.bashrc:
pushd -n /Project/Warnest/docs/
pushd -n ~/Dropbox/Projects/ds/test/
then,
cd ~ is your home,
cd ~1 is ~/Dropbox/Projects/ds/test/
cd ~2 is /Project/Warnest/docs/
You can use ~1,~2 etc in exactly the same way as ~.
Use "pushd -n" (assuming you use bash).
Add to your ~/.bashrc:
pushd -n /Project/Warnest/docs/
pushd -n ~/Dropbox/Projects/ds/test/
then,
cd ~ is your home,
cd ~1 is ~/Dropbox/Projects/ds/test/
cd ~2 is /Project/Warnest/docs/
You can use ~1,~2 etc in exactly the same way as ~.
answered Feb 9 '12 at 14:26
EelvexEelvex
536312
536312
add a comment |
add a comment |
There are a lot of good suggestions here. Which to use would depend on whether you have a small fixed list of directories you switch among, or whether you are looking for a more generic solution.
If it's a small fixed list, setting up simple aliases (as Felix Yan suggested) would be easiest to use.
If you're looking for a more generalized solution (i.e. many different directories, changing over time), I'd use pushd and popd (as Useless suggested). I personally find the default pushd/popd to be hard to use, especially as you start switching among many folders; however I wrote a few tweaks that make it much easier for me. Add the following to your bashrc:
alias dirs='dirs -v'
pd ()
{
if [ "$1" ]; then
pushd "${1/#[0-9]*/+$1}";
else
pushd;
fi > /dev/null
}
- Use
pd(as a shorter form ofpushd) to jump to a new folder, remembering where you were. - Use
dirsto see the list of saved directories. - Use
pd 3to jump to directory number 3.
Example Usage:
$ PS1='w$ ' ## just for demo purposes
~$ pd ~/Documents/data
~/Documents/data$ pd ../spec
~/Documents/spec$ pd ~/Dropbox/Public/
~/Dropbox/Public$ pd /tmp
/tmp$ pd /etc/defaults/
/etc/defaults$ dirs
0 /etc/defaults
1 /tmp
2 ~/Dropbox/Public
3 ~/Documents/spec
4 ~/Documents/data
5 ~
/etc/defaults$ pd 2
~/Dropbox/Public$ dirs
0 ~/Dropbox/Public
1 ~/Documents/spec
2 ~/Documents/data
3 ~
4 /etc/defaults
5 /tmp
~/Dropbox/Public$ pd 4
/etc/defaults$ dirs
0 /etc/defaults
1 /tmp
2 ~/Dropbox/Public
3 ~/Documents/spec
4 ~/Documents/data
5 ~
/etc/defaults$ pd 3
~/Documents/spec$ popd
~/Documents/data ~ /etc/defaults /tmp ~/Dropbox/Public
~/Documents/data$
add a comment |
There are a lot of good suggestions here. Which to use would depend on whether you have a small fixed list of directories you switch among, or whether you are looking for a more generic solution.
If it's a small fixed list, setting up simple aliases (as Felix Yan suggested) would be easiest to use.
If you're looking for a more generalized solution (i.e. many different directories, changing over time), I'd use pushd and popd (as Useless suggested). I personally find the default pushd/popd to be hard to use, especially as you start switching among many folders; however I wrote a few tweaks that make it much easier for me. Add the following to your bashrc:
alias dirs='dirs -v'
pd ()
{
if [ "$1" ]; then
pushd "${1/#[0-9]*/+$1}";
else
pushd;
fi > /dev/null
}
- Use
pd(as a shorter form ofpushd) to jump to a new folder, remembering where you were. - Use
dirsto see the list of saved directories. - Use
pd 3to jump to directory number 3.
Example Usage:
$ PS1='w$ ' ## just for demo purposes
~$ pd ~/Documents/data
~/Documents/data$ pd ../spec
~/Documents/spec$ pd ~/Dropbox/Public/
~/Dropbox/Public$ pd /tmp
/tmp$ pd /etc/defaults/
/etc/defaults$ dirs
0 /etc/defaults
1 /tmp
2 ~/Dropbox/Public
3 ~/Documents/spec
4 ~/Documents/data
5 ~
/etc/defaults$ pd 2
~/Dropbox/Public$ dirs
0 ~/Dropbox/Public
1 ~/Documents/spec
2 ~/Documents/data
3 ~
4 /etc/defaults
5 /tmp
~/Dropbox/Public$ pd 4
/etc/defaults$ dirs
0 /etc/defaults
1 /tmp
2 ~/Dropbox/Public
3 ~/Documents/spec
4 ~/Documents/data
5 ~
/etc/defaults$ pd 3
~/Documents/spec$ popd
~/Documents/data ~ /etc/defaults /tmp ~/Dropbox/Public
~/Documents/data$
add a comment |
There are a lot of good suggestions here. Which to use would depend on whether you have a small fixed list of directories you switch among, or whether you are looking for a more generic solution.
If it's a small fixed list, setting up simple aliases (as Felix Yan suggested) would be easiest to use.
If you're looking for a more generalized solution (i.e. many different directories, changing over time), I'd use pushd and popd (as Useless suggested). I personally find the default pushd/popd to be hard to use, especially as you start switching among many folders; however I wrote a few tweaks that make it much easier for me. Add the following to your bashrc:
alias dirs='dirs -v'
pd ()
{
if [ "$1" ]; then
pushd "${1/#[0-9]*/+$1}";
else
pushd;
fi > /dev/null
}
- Use
pd(as a shorter form ofpushd) to jump to a new folder, remembering where you were. - Use
dirsto see the list of saved directories. - Use
pd 3to jump to directory number 3.
Example Usage:
$ PS1='w$ ' ## just for demo purposes
~$ pd ~/Documents/data
~/Documents/data$ pd ../spec
~/Documents/spec$ pd ~/Dropbox/Public/
~/Dropbox/Public$ pd /tmp
/tmp$ pd /etc/defaults/
/etc/defaults$ dirs
0 /etc/defaults
1 /tmp
2 ~/Dropbox/Public
3 ~/Documents/spec
4 ~/Documents/data
5 ~
/etc/defaults$ pd 2
~/Dropbox/Public$ dirs
0 ~/Dropbox/Public
1 ~/Documents/spec
2 ~/Documents/data
3 ~
4 /etc/defaults
5 /tmp
~/Dropbox/Public$ pd 4
/etc/defaults$ dirs
0 /etc/defaults
1 /tmp
2 ~/Dropbox/Public
3 ~/Documents/spec
4 ~/Documents/data
5 ~
/etc/defaults$ pd 3
~/Documents/spec$ popd
~/Documents/data ~ /etc/defaults /tmp ~/Dropbox/Public
~/Documents/data$
There are a lot of good suggestions here. Which to use would depend on whether you have a small fixed list of directories you switch among, or whether you are looking for a more generic solution.
If it's a small fixed list, setting up simple aliases (as Felix Yan suggested) would be easiest to use.
If you're looking for a more generalized solution (i.e. many different directories, changing over time), I'd use pushd and popd (as Useless suggested). I personally find the default pushd/popd to be hard to use, especially as you start switching among many folders; however I wrote a few tweaks that make it much easier for me. Add the following to your bashrc:
alias dirs='dirs -v'
pd ()
{
if [ "$1" ]; then
pushd "${1/#[0-9]*/+$1}";
else
pushd;
fi > /dev/null
}
- Use
pd(as a shorter form ofpushd) to jump to a new folder, remembering where you were. - Use
dirsto see the list of saved directories. - Use
pd 3to jump to directory number 3.
Example Usage:
$ PS1='w$ ' ## just for demo purposes
~$ pd ~/Documents/data
~/Documents/data$ pd ../spec
~/Documents/spec$ pd ~/Dropbox/Public/
~/Dropbox/Public$ pd /tmp
/tmp$ pd /etc/defaults/
/etc/defaults$ dirs
0 /etc/defaults
1 /tmp
2 ~/Dropbox/Public
3 ~/Documents/spec
4 ~/Documents/data
5 ~
/etc/defaults$ pd 2
~/Dropbox/Public$ dirs
0 ~/Dropbox/Public
1 ~/Documents/spec
2 ~/Documents/data
3 ~
4 /etc/defaults
5 /tmp
~/Dropbox/Public$ pd 4
/etc/defaults$ dirs
0 /etc/defaults
1 /tmp
2 ~/Dropbox/Public
3 ~/Documents/spec
4 ~/Documents/data
5 ~
/etc/defaults$ pd 3
~/Documents/spec$ popd
~/Documents/data ~ /etc/defaults /tmp ~/Dropbox/Public
~/Documents/data$
answered Feb 8 '12 at 14:17
NoachNoach
1904
1904
add a comment |
add a comment |
The following appeared to work on the one case I tested it on, and you can just drop your directory names as symlinks in ~/Bookmarks:
mkdir "$HOME/Bookmarks"
ln -s /tmp "$HOME/Bookmarks/testdir"
function ccd() { cd $(readlink "$HOME/Bookmarks/$1") ; }
ccd testdir && echo $PWD
# gives /tmp
that ccd() function need to typed in the terminal prompt or somewhere else? can u pls explain?
– saiy2k
Feb 8 '12 at 8:41
1
@saiy2k: sorry, yes. Thefunctionline goes into your .bashrc (you can type it in your terminal to test, but it'll be gone when you close that window), the lines before set up the test case of "testdir" becoming a name for/tmp, and the last line is the test to see if it works.
– Ulrich Schwarz
Feb 8 '12 at 17:19
add a comment |
The following appeared to work on the one case I tested it on, and you can just drop your directory names as symlinks in ~/Bookmarks:
mkdir "$HOME/Bookmarks"
ln -s /tmp "$HOME/Bookmarks/testdir"
function ccd() { cd $(readlink "$HOME/Bookmarks/$1") ; }
ccd testdir && echo $PWD
# gives /tmp
that ccd() function need to typed in the terminal prompt or somewhere else? can u pls explain?
– saiy2k
Feb 8 '12 at 8:41
1
@saiy2k: sorry, yes. Thefunctionline goes into your .bashrc (you can type it in your terminal to test, but it'll be gone when you close that window), the lines before set up the test case of "testdir" becoming a name for/tmp, and the last line is the test to see if it works.
– Ulrich Schwarz
Feb 8 '12 at 17:19
add a comment |
The following appeared to work on the one case I tested it on, and you can just drop your directory names as symlinks in ~/Bookmarks:
mkdir "$HOME/Bookmarks"
ln -s /tmp "$HOME/Bookmarks/testdir"
function ccd() { cd $(readlink "$HOME/Bookmarks/$1") ; }
ccd testdir && echo $PWD
# gives /tmp
The following appeared to work on the one case I tested it on, and you can just drop your directory names as symlinks in ~/Bookmarks:
mkdir "$HOME/Bookmarks"
ln -s /tmp "$HOME/Bookmarks/testdir"
function ccd() { cd $(readlink "$HOME/Bookmarks/$1") ; }
ccd testdir && echo $PWD
# gives /tmp
answered Feb 8 '12 at 7:48
Ulrich SchwarzUlrich Schwarz
9,87312946
9,87312946
that ccd() function need to typed in the terminal prompt or somewhere else? can u pls explain?
– saiy2k
Feb 8 '12 at 8:41
1
@saiy2k: sorry, yes. Thefunctionline goes into your .bashrc (you can type it in your terminal to test, but it'll be gone when you close that window), the lines before set up the test case of "testdir" becoming a name for/tmp, and the last line is the test to see if it works.
– Ulrich Schwarz
Feb 8 '12 at 17:19
add a comment |
that ccd() function need to typed in the terminal prompt or somewhere else? can u pls explain?
– saiy2k
Feb 8 '12 at 8:41
1
@saiy2k: sorry, yes. Thefunctionline goes into your .bashrc (you can type it in your terminal to test, but it'll be gone when you close that window), the lines before set up the test case of "testdir" becoming a name for/tmp, and the last line is the test to see if it works.
– Ulrich Schwarz
Feb 8 '12 at 17:19
that ccd() function need to typed in the terminal prompt or somewhere else? can u pls explain?
– saiy2k
Feb 8 '12 at 8:41
that ccd() function need to typed in the terminal prompt or somewhere else? can u pls explain?
– saiy2k
Feb 8 '12 at 8:41
1
1
@saiy2k: sorry, yes. The
function line goes into your .bashrc (you can type it in your terminal to test, but it'll be gone when you close that window), the lines before set up the test case of "testdir" becoming a name for /tmp, and the last line is the test to see if it works.– Ulrich Schwarz
Feb 8 '12 at 17:19
@saiy2k: sorry, yes. The
function line goes into your .bashrc (you can type it in your terminal to test, but it'll be gone when you close that window), the lines before set up the test case of "testdir" becoming a name for /tmp, and the last line is the test to see if it works.– Ulrich Schwarz
Feb 8 '12 at 17:19
add a comment |
You could do worse than try j2.
From the README:
Spend a lot of time cd-ing around a complex directory tree?
j keeps track of where you’ve been and how much time you spend there, and provides a convenient way to jump to the directories you actually use.
I use it extensively & recommend it.
add a comment |
You could do worse than try j2.
From the README:
Spend a lot of time cd-ing around a complex directory tree?
j keeps track of where you’ve been and how much time you spend there, and provides a convenient way to jump to the directories you actually use.
I use it extensively & recommend it.
add a comment |
You could do worse than try j2.
From the README:
Spend a lot of time cd-ing around a complex directory tree?
j keeps track of where you’ve been and how much time you spend there, and provides a convenient way to jump to the directories you actually use.
I use it extensively & recommend it.
You could do worse than try j2.
From the README:
Spend a lot of time cd-ing around a complex directory tree?
j keeps track of where you’ve been and how much time you spend there, and provides a convenient way to jump to the directories you actually use.
I use it extensively & recommend it.
edited Feb 17 '12 at 6:07
Mat
39.6k8121127
39.6k8121127
answered Feb 17 '12 at 4:48
phildobbinphildobbin
1614
1614
add a comment |
add a comment |
I'd advice using zsh, that shell as very good TAB completion for directories, files, and even options for most cli programs.
I've been using that shell for years now, and I'd miss the functionality if it was gone.
Scripting the zsh is a lot of fun, too, with a large number of one-liners that can help you every day.
No need to change to zsh for TAB completeion since bash has it all the same. For other functionality maybe but not for this.
– Peer Stritzinger
Feb 9 '12 at 11:14
1
@PeerStritzinger Bash introduced that kind of functionality in BASH 4.0, but compared to zsh, it is still quite far behind. Saying "all the same" is certainly incorrect.
– polemon
Feb 22 '12 at 0:02
Well zsh is ceartainly the übershell but just for tab completion there is no need to change (question was asked for bash). Besides bash 4.0 was introduced about 3 years ago ...
– Peer Stritzinger
Feb 22 '12 at 9:45
add a comment |
I'd advice using zsh, that shell as very good TAB completion for directories, files, and even options for most cli programs.
I've been using that shell for years now, and I'd miss the functionality if it was gone.
Scripting the zsh is a lot of fun, too, with a large number of one-liners that can help you every day.
No need to change to zsh for TAB completeion since bash has it all the same. For other functionality maybe but not for this.
– Peer Stritzinger
Feb 9 '12 at 11:14
1
@PeerStritzinger Bash introduced that kind of functionality in BASH 4.0, but compared to zsh, it is still quite far behind. Saying "all the same" is certainly incorrect.
– polemon
Feb 22 '12 at 0:02
Well zsh is ceartainly the übershell but just for tab completion there is no need to change (question was asked for bash). Besides bash 4.0 was introduced about 3 years ago ...
– Peer Stritzinger
Feb 22 '12 at 9:45
add a comment |
I'd advice using zsh, that shell as very good TAB completion for directories, files, and even options for most cli programs.
I've been using that shell for years now, and I'd miss the functionality if it was gone.
Scripting the zsh is a lot of fun, too, with a large number of one-liners that can help you every day.
I'd advice using zsh, that shell as very good TAB completion for directories, files, and even options for most cli programs.
I've been using that shell for years now, and I'd miss the functionality if it was gone.
Scripting the zsh is a lot of fun, too, with a large number of one-liners that can help you every day.
answered Feb 8 '12 at 11:17
polemonpolemon
5,80964278
5,80964278
No need to change to zsh for TAB completeion since bash has it all the same. For other functionality maybe but not for this.
– Peer Stritzinger
Feb 9 '12 at 11:14
1
@PeerStritzinger Bash introduced that kind of functionality in BASH 4.0, but compared to zsh, it is still quite far behind. Saying "all the same" is certainly incorrect.
– polemon
Feb 22 '12 at 0:02
Well zsh is ceartainly the übershell but just for tab completion there is no need to change (question was asked for bash). Besides bash 4.0 was introduced about 3 years ago ...
– Peer Stritzinger
Feb 22 '12 at 9:45
add a comment |
No need to change to zsh for TAB completeion since bash has it all the same. For other functionality maybe but not for this.
– Peer Stritzinger
Feb 9 '12 at 11:14
1
@PeerStritzinger Bash introduced that kind of functionality in BASH 4.0, but compared to zsh, it is still quite far behind. Saying "all the same" is certainly incorrect.
– polemon
Feb 22 '12 at 0:02
Well zsh is ceartainly the übershell but just for tab completion there is no need to change (question was asked for bash). Besides bash 4.0 was introduced about 3 years ago ...
– Peer Stritzinger
Feb 22 '12 at 9:45
No need to change to zsh for TAB completeion since bash has it all the same. For other functionality maybe but not for this.
– Peer Stritzinger
Feb 9 '12 at 11:14
No need to change to zsh for TAB completeion since bash has it all the same. For other functionality maybe but not for this.
– Peer Stritzinger
Feb 9 '12 at 11:14
1
1
@PeerStritzinger Bash introduced that kind of functionality in BASH 4.0, but compared to zsh, it is still quite far behind. Saying "all the same" is certainly incorrect.
– polemon
Feb 22 '12 at 0:02
@PeerStritzinger Bash introduced that kind of functionality in BASH 4.0, but compared to zsh, it is still quite far behind. Saying "all the same" is certainly incorrect.
– polemon
Feb 22 '12 at 0:02
Well zsh is ceartainly the übershell but just for tab completion there is no need to change (question was asked for bash). Besides bash 4.0 was introduced about 3 years ago ...
– Peer Stritzinger
Feb 22 '12 at 9:45
Well zsh is ceartainly the übershell but just for tab completion there is no need to change (question was asked for bash). Besides bash 4.0 was introduced about 3 years ago ...
– Peer Stritzinger
Feb 22 '12 at 9:45
add a comment |
In my experience, the greatest speedup in navigating in a shell is to use its history search functionality. In Bash you can search backwards in your history of commands by pressing Ctrl+R and type in some pattern. That pattern is then matched against previous entries in your history -- may it be cd commands or other operations -- and suggestions are made as you type. Simply hit enter to run the suggested command again. This is called reverse-search-history in Bash and I love it. It saves me a lot of keystrokes and spares my internal memory.
It's a good thing because you only have to remember some smaller part of a command, like Drop or Wa to distinguish between the two history entries cd ~/Dropbox/Projects/ds/test/ and cd /Project/Warnest/docs/.
add a comment |
In my experience, the greatest speedup in navigating in a shell is to use its history search functionality. In Bash you can search backwards in your history of commands by pressing Ctrl+R and type in some pattern. That pattern is then matched against previous entries in your history -- may it be cd commands or other operations -- and suggestions are made as you type. Simply hit enter to run the suggested command again. This is called reverse-search-history in Bash and I love it. It saves me a lot of keystrokes and spares my internal memory.
It's a good thing because you only have to remember some smaller part of a command, like Drop or Wa to distinguish between the two history entries cd ~/Dropbox/Projects/ds/test/ and cd /Project/Warnest/docs/.
add a comment |
In my experience, the greatest speedup in navigating in a shell is to use its history search functionality. In Bash you can search backwards in your history of commands by pressing Ctrl+R and type in some pattern. That pattern is then matched against previous entries in your history -- may it be cd commands or other operations -- and suggestions are made as you type. Simply hit enter to run the suggested command again. This is called reverse-search-history in Bash and I love it. It saves me a lot of keystrokes and spares my internal memory.
It's a good thing because you only have to remember some smaller part of a command, like Drop or Wa to distinguish between the two history entries cd ~/Dropbox/Projects/ds/test/ and cd /Project/Warnest/docs/.
In my experience, the greatest speedup in navigating in a shell is to use its history search functionality. In Bash you can search backwards in your history of commands by pressing Ctrl+R and type in some pattern. That pattern is then matched against previous entries in your history -- may it be cd commands or other operations -- and suggestions are made as you type. Simply hit enter to run the suggested command again. This is called reverse-search-history in Bash and I love it. It saves me a lot of keystrokes and spares my internal memory.
It's a good thing because you only have to remember some smaller part of a command, like Drop or Wa to distinguish between the two history entries cd ~/Dropbox/Projects/ds/test/ and cd /Project/Warnest/docs/.
edited Feb 28 '13 at 17:12
answered Feb 28 '13 at 17:04
user13742
add a comment |
add a comment |
I also use these aliases (add them to ~/.bashrc):
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
It's much quicker to go to the upper directory with them (yet it only solves half of the navigation).
1
These are helpful aliases, but I'm not entirely sure that they will match the OP's needs. You might consider expanding on your answer to suggest how these might be directly helpful for the OP's issue.
– HalosGhost
Jul 11 '14 at 18:36
add a comment |
I also use these aliases (add them to ~/.bashrc):
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
It's much quicker to go to the upper directory with them (yet it only solves half of the navigation).
1
These are helpful aliases, but I'm not entirely sure that they will match the OP's needs. You might consider expanding on your answer to suggest how these might be directly helpful for the OP's issue.
– HalosGhost
Jul 11 '14 at 18:36
add a comment |
I also use these aliases (add them to ~/.bashrc):
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
It's much quicker to go to the upper directory with them (yet it only solves half of the navigation).
I also use these aliases (add them to ~/.bashrc):
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
It's much quicker to go to the upper directory with them (yet it only solves half of the navigation).
edited Jul 11 '14 at 18:47
answered Jul 11 '14 at 18:13
reimaireimai
5114
5114
1
These are helpful aliases, but I'm not entirely sure that they will match the OP's needs. You might consider expanding on your answer to suggest how these might be directly helpful for the OP's issue.
– HalosGhost
Jul 11 '14 at 18:36
add a comment |
1
These are helpful aliases, but I'm not entirely sure that they will match the OP's needs. You might consider expanding on your answer to suggest how these might be directly helpful for the OP's issue.
– HalosGhost
Jul 11 '14 at 18:36
1
1
These are helpful aliases, but I'm not entirely sure that they will match the OP's needs. You might consider expanding on your answer to suggest how these might be directly helpful for the OP's issue.
– HalosGhost
Jul 11 '14 at 18:36
These are helpful aliases, but I'm not entirely sure that they will match the OP's needs. You might consider expanding on your answer to suggest how these might be directly helpful for the OP's issue.
– HalosGhost
Jul 11 '14 at 18:36
add a comment |
if you're using zsh:
you don't have to type
cd, just type directory path (/foo/bar/baz<Enter>equals tocd /foo/bar/baz<Enter>)
requires
auto_cdoption to be set
- you can expand abbreviated paths with
Tabkey (/u/sh/pi<Tab>expands to/usr/share/pixmaps; works for file names as well)
3
Bash 4 has gainedshopt -s autocd, so it's no longer a zsh-only goodness.
– Gilles
Feb 8 '12 at 23:44
add a comment |
if you're using zsh:
you don't have to type
cd, just type directory path (/foo/bar/baz<Enter>equals tocd /foo/bar/baz<Enter>)
requires
auto_cdoption to be set
- you can expand abbreviated paths with
Tabkey (/u/sh/pi<Tab>expands to/usr/share/pixmaps; works for file names as well)
3
Bash 4 has gainedshopt -s autocd, so it's no longer a zsh-only goodness.
– Gilles
Feb 8 '12 at 23:44
add a comment |
if you're using zsh:
you don't have to type
cd, just type directory path (/foo/bar/baz<Enter>equals tocd /foo/bar/baz<Enter>)
requires
auto_cdoption to be set
- you can expand abbreviated paths with
Tabkey (/u/sh/pi<Tab>expands to/usr/share/pixmaps; works for file names as well)
if you're using zsh:
you don't have to type
cd, just type directory path (/foo/bar/baz<Enter>equals tocd /foo/bar/baz<Enter>)
requires
auto_cdoption to be set
- you can expand abbreviated paths with
Tabkey (/u/sh/pi<Tab>expands to/usr/share/pixmaps; works for file names as well)
answered Feb 8 '12 at 14:00
Andrei DziahelAndrei Dziahel
21617
21617
3
Bash 4 has gainedshopt -s autocd, so it's no longer a zsh-only goodness.
– Gilles
Feb 8 '12 at 23:44
add a comment |
3
Bash 4 has gainedshopt -s autocd, so it's no longer a zsh-only goodness.
– Gilles
Feb 8 '12 at 23:44
3
3
Bash 4 has gained
shopt -s autocd, so it's no longer a zsh-only goodness.– Gilles
Feb 8 '12 at 23:44
Bash 4 has gained
shopt -s autocd, so it's no longer a zsh-only goodness.– Gilles
Feb 8 '12 at 23:44
add a comment |
There is a rather nice tool for quick directory changes:
xd - eXtra fast Directory changer
http://xd-home.sourceforge.net/xdman.html
a bit awkward is that you need to map it in bash profile or similar as it only outputs the directory
# function to do `cd` using `xd`
# -g turns generalized directory search command processing on
# which improves the whole thing a bit
f()
{
cd `/usr/bin/xd -g $*`
}
you can do things like:
# change to /var/log/a* (gives you a list to choose from)
f vla
# to skip the list and go directly to /var/log/apache2
f vlapach
add a comment |
There is a rather nice tool for quick directory changes:
xd - eXtra fast Directory changer
http://xd-home.sourceforge.net/xdman.html
a bit awkward is that you need to map it in bash profile or similar as it only outputs the directory
# function to do `cd` using `xd`
# -g turns generalized directory search command processing on
# which improves the whole thing a bit
f()
{
cd `/usr/bin/xd -g $*`
}
you can do things like:
# change to /var/log/a* (gives you a list to choose from)
f vla
# to skip the list and go directly to /var/log/apache2
f vlapach
add a comment |
There is a rather nice tool for quick directory changes:
xd - eXtra fast Directory changer
http://xd-home.sourceforge.net/xdman.html
a bit awkward is that you need to map it in bash profile or similar as it only outputs the directory
# function to do `cd` using `xd`
# -g turns generalized directory search command processing on
# which improves the whole thing a bit
f()
{
cd `/usr/bin/xd -g $*`
}
you can do things like:
# change to /var/log/a* (gives you a list to choose from)
f vla
# to skip the list and go directly to /var/log/apache2
f vlapach
There is a rather nice tool for quick directory changes:
xd - eXtra fast Directory changer
http://xd-home.sourceforge.net/xdman.html
a bit awkward is that you need to map it in bash profile or similar as it only outputs the directory
# function to do `cd` using `xd`
# -g turns generalized directory search command processing on
# which improves the whole thing a bit
f()
{
cd `/usr/bin/xd -g $*`
}
you can do things like:
# change to /var/log/a* (gives you a list to choose from)
f vla
# to skip the list and go directly to /var/log/apache2
f vlapach
answered Mar 25 '12 at 11:50
nullnull
411
411
add a comment |
add a comment |
You never ever should type full path in shell anyway. You always can use:
soffice /P*/W*/*/mydoc*
instead of
soffice /Project/Warnest/docs/mydoc.odt
This is like tab-completing, but worse in every way
– Michael Mrozek♦
May 14 '16 at 18:41
You can't do this with tab completing with euqal amount of keypressing unless Project is only file starting with P, etc. Also you have to wait for completion each time, using * you have no need to wait.
– gena2x
Nov 23 '16 at 12:08
I think you have it backwards -- you can't doP*unless Project is the only file starting with P. Tab completion can cycle (by default in most shells; you need to rebind tab tomenu-completein bash), and resolves instantly in simple cases like this, there's no waiting around for it
– Michael Mrozek♦
Nov 23 '16 at 15:47
Regarding 'you can't do it' - you can, try it, you missing whole point if you think you can't. Try echo /u*/b*/g++
– gena2x
Nov 23 '16 at 17:26
1
I understand what you mean, it's faster as long as you're sure you've typed an unambiguous path, but something like/P*/W*/*/mydoc*sounds like it would work fine until one day you happened to make another file that matches that glob, and suddenly you end up opening both at once./u*/*/g++is impressively few characters, but hopefully nothing else in any of the subfolders of any of my root folders starting withuis namedg++. (As a nice compromise, in some shells you can use tab to expand globs in-place as you go)
– Michael Mrozek♦
Nov 23 '16 at 17:42
|
show 3 more comments
You never ever should type full path in shell anyway. You always can use:
soffice /P*/W*/*/mydoc*
instead of
soffice /Project/Warnest/docs/mydoc.odt
This is like tab-completing, but worse in every way
– Michael Mrozek♦
May 14 '16 at 18:41
You can't do this with tab completing with euqal amount of keypressing unless Project is only file starting with P, etc. Also you have to wait for completion each time, using * you have no need to wait.
– gena2x
Nov 23 '16 at 12:08
I think you have it backwards -- you can't doP*unless Project is the only file starting with P. Tab completion can cycle (by default in most shells; you need to rebind tab tomenu-completein bash), and resolves instantly in simple cases like this, there's no waiting around for it
– Michael Mrozek♦
Nov 23 '16 at 15:47
Regarding 'you can't do it' - you can, try it, you missing whole point if you think you can't. Try echo /u*/b*/g++
– gena2x
Nov 23 '16 at 17:26
1
I understand what you mean, it's faster as long as you're sure you've typed an unambiguous path, but something like/P*/W*/*/mydoc*sounds like it would work fine until one day you happened to make another file that matches that glob, and suddenly you end up opening both at once./u*/*/g++is impressively few characters, but hopefully nothing else in any of the subfolders of any of my root folders starting withuis namedg++. (As a nice compromise, in some shells you can use tab to expand globs in-place as you go)
– Michael Mrozek♦
Nov 23 '16 at 17:42
|
show 3 more comments
You never ever should type full path in shell anyway. You always can use:
soffice /P*/W*/*/mydoc*
instead of
soffice /Project/Warnest/docs/mydoc.odt
You never ever should type full path in shell anyway. You always can use:
soffice /P*/W*/*/mydoc*
instead of
soffice /Project/Warnest/docs/mydoc.odt
answered May 27 '14 at 14:05
gena2xgena2x
1,836618
1,836618
This is like tab-completing, but worse in every way
– Michael Mrozek♦
May 14 '16 at 18:41
You can't do this with tab completing with euqal amount of keypressing unless Project is only file starting with P, etc. Also you have to wait for completion each time, using * you have no need to wait.
– gena2x
Nov 23 '16 at 12:08
I think you have it backwards -- you can't doP*unless Project is the only file starting with P. Tab completion can cycle (by default in most shells; you need to rebind tab tomenu-completein bash), and resolves instantly in simple cases like this, there's no waiting around for it
– Michael Mrozek♦
Nov 23 '16 at 15:47
Regarding 'you can't do it' - you can, try it, you missing whole point if you think you can't. Try echo /u*/b*/g++
– gena2x
Nov 23 '16 at 17:26
1
I understand what you mean, it's faster as long as you're sure you've typed an unambiguous path, but something like/P*/W*/*/mydoc*sounds like it would work fine until one day you happened to make another file that matches that glob, and suddenly you end up opening both at once./u*/*/g++is impressively few characters, but hopefully nothing else in any of the subfolders of any of my root folders starting withuis namedg++. (As a nice compromise, in some shells you can use tab to expand globs in-place as you go)
– Michael Mrozek♦
Nov 23 '16 at 17:42
|
show 3 more comments
This is like tab-completing, but worse in every way
– Michael Mrozek♦
May 14 '16 at 18:41
You can't do this with tab completing with euqal amount of keypressing unless Project is only file starting with P, etc. Also you have to wait for completion each time, using * you have no need to wait.
– gena2x
Nov 23 '16 at 12:08
I think you have it backwards -- you can't doP*unless Project is the only file starting with P. Tab completion can cycle (by default in most shells; you need to rebind tab tomenu-completein bash), and resolves instantly in simple cases like this, there's no waiting around for it
– Michael Mrozek♦
Nov 23 '16 at 15:47
Regarding 'you can't do it' - you can, try it, you missing whole point if you think you can't. Try echo /u*/b*/g++
– gena2x
Nov 23 '16 at 17:26
1
I understand what you mean, it's faster as long as you're sure you've typed an unambiguous path, but something like/P*/W*/*/mydoc*sounds like it would work fine until one day you happened to make another file that matches that glob, and suddenly you end up opening both at once./u*/*/g++is impressively few characters, but hopefully nothing else in any of the subfolders of any of my root folders starting withuis namedg++. (As a nice compromise, in some shells you can use tab to expand globs in-place as you go)
– Michael Mrozek♦
Nov 23 '16 at 17:42
This is like tab-completing, but worse in every way
– Michael Mrozek♦
May 14 '16 at 18:41
This is like tab-completing, but worse in every way
– Michael Mrozek♦
May 14 '16 at 18:41
You can't do this with tab completing with euqal amount of keypressing unless Project is only file starting with P, etc. Also you have to wait for completion each time, using * you have no need to wait.
– gena2x
Nov 23 '16 at 12:08
You can't do this with tab completing with euqal amount of keypressing unless Project is only file starting with P, etc. Also you have to wait for completion each time, using * you have no need to wait.
– gena2x
Nov 23 '16 at 12:08
I think you have it backwards -- you can't do
P* unless Project is the only file starting with P. Tab completion can cycle (by default in most shells; you need to rebind tab to menu-complete in bash), and resolves instantly in simple cases like this, there's no waiting around for it– Michael Mrozek♦
Nov 23 '16 at 15:47
I think you have it backwards -- you can't do
P* unless Project is the only file starting with P. Tab completion can cycle (by default in most shells; you need to rebind tab to menu-complete in bash), and resolves instantly in simple cases like this, there's no waiting around for it– Michael Mrozek♦
Nov 23 '16 at 15:47
Regarding 'you can't do it' - you can, try it, you missing whole point if you think you can't. Try echo /u*/b*/g++
– gena2x
Nov 23 '16 at 17:26
Regarding 'you can't do it' - you can, try it, you missing whole point if you think you can't. Try echo /u*/b*/g++
– gena2x
Nov 23 '16 at 17:26
1
1
I understand what you mean, it's faster as long as you're sure you've typed an unambiguous path, but something like
/P*/W*/*/mydoc* sounds like it would work fine until one day you happened to make another file that matches that glob, and suddenly you end up opening both at once. /u*/*/g++ is impressively few characters, but hopefully nothing else in any of the subfolders of any of my root folders starting with u is named g++. (As a nice compromise, in some shells you can use tab to expand globs in-place as you go)– Michael Mrozek♦
Nov 23 '16 at 17:42
I understand what you mean, it's faster as long as you're sure you've typed an unambiguous path, but something like
/P*/W*/*/mydoc* sounds like it would work fine until one day you happened to make another file that matches that glob, and suddenly you end up opening both at once. /u*/*/g++ is impressively few characters, but hopefully nothing else in any of the subfolders of any of my root folders starting with u is named g++. (As a nice compromise, in some shells you can use tab to expand globs in-place as you go)– Michael Mrozek♦
Nov 23 '16 at 17:42
|
show 3 more comments
There's also OLDPWD, an environment variable which, according to IEEE 1003.1 (POSIX), should be updated with the previous working directory each time cd changes the working directory (for the curious ones, line 80244 of page 2506 of IEEE 1003.1-2008).
add a comment |
There's also OLDPWD, an environment variable which, according to IEEE 1003.1 (POSIX), should be updated with the previous working directory each time cd changes the working directory (for the curious ones, line 80244 of page 2506 of IEEE 1003.1-2008).
add a comment |
There's also OLDPWD, an environment variable which, according to IEEE 1003.1 (POSIX), should be updated with the previous working directory each time cd changes the working directory (for the curious ones, line 80244 of page 2506 of IEEE 1003.1-2008).
There's also OLDPWD, an environment variable which, according to IEEE 1003.1 (POSIX), should be updated with the previous working directory each time cd changes the working directory (for the curious ones, line 80244 of page 2506 of IEEE 1003.1-2008).
answered Feb 8 '12 at 13:12
njsgnjsg
8,89411825
8,89411825
add a comment |
add a comment |
There is also a "wcd" app created specifically for this (also ported to cygwin, since I am on that). You can create shortcuts, bookmarks of dirs with it. Also supports wild cards. Reading the man page & docs in /usr/share/wcd should help a lot.
http://manpages.ubuntu.com/manpages/hardy/man7/wcd.7.html
add a comment |
There is also a "wcd" app created specifically for this (also ported to cygwin, since I am on that). You can create shortcuts, bookmarks of dirs with it. Also supports wild cards. Reading the man page & docs in /usr/share/wcd should help a lot.
http://manpages.ubuntu.com/manpages/hardy/man7/wcd.7.html
add a comment |
There is also a "wcd" app created specifically for this (also ported to cygwin, since I am on that). You can create shortcuts, bookmarks of dirs with it. Also supports wild cards. Reading the man page & docs in /usr/share/wcd should help a lot.
http://manpages.ubuntu.com/manpages/hardy/man7/wcd.7.html
There is also a "wcd" app created specifically for this (also ported to cygwin, since I am on that). You can create shortcuts, bookmarks of dirs with it. Also supports wild cards. Reading the man page & docs in /usr/share/wcd should help a lot.
http://manpages.ubuntu.com/manpages/hardy/man7/wcd.7.html
answered Feb 10 '12 at 4:33
samsam
311
311
add a comment |
add a comment |
cdargs is the most efficient tool for bookmarking a directory: http://www.youtube.com/watch?v=uWB2FIQlzZg
Is this a product you are associated with?
– Kazark
Feb 27 '13 at 19:21
Thanks for pointing me to cdargs. Simplysudo apt-get cdargson ubuntu. BTW the youtube video is really bad but the tool is great.
– DavidG
Jul 21 '14 at 16:00
add a comment |
cdargs is the most efficient tool for bookmarking a directory: http://www.youtube.com/watch?v=uWB2FIQlzZg
Is this a product you are associated with?
– Kazark
Feb 27 '13 at 19:21
Thanks for pointing me to cdargs. Simplysudo apt-get cdargson ubuntu. BTW the youtube video is really bad but the tool is great.
– DavidG
Jul 21 '14 at 16:00
add a comment |
cdargs is the most efficient tool for bookmarking a directory: http://www.youtube.com/watch?v=uWB2FIQlzZg
cdargs is the most efficient tool for bookmarking a directory: http://www.youtube.com/watch?v=uWB2FIQlzZg
answered Feb 27 '13 at 18:57
EmonEmon
611
611
Is this a product you are associated with?
– Kazark
Feb 27 '13 at 19:21
Thanks for pointing me to cdargs. Simplysudo apt-get cdargson ubuntu. BTW the youtube video is really bad but the tool is great.
– DavidG
Jul 21 '14 at 16:00
add a comment |
Is this a product you are associated with?
– Kazark
Feb 27 '13 at 19:21
Thanks for pointing me to cdargs. Simplysudo apt-get cdargson ubuntu. BTW the youtube video is really bad but the tool is great.
– DavidG
Jul 21 '14 at 16:00
Is this a product you are associated with?
– Kazark
Feb 27 '13 at 19:21
Is this a product you are associated with?
– Kazark
Feb 27 '13 at 19:21
Thanks for pointing me to cdargs. Simply
sudo apt-get cdargs on ubuntu. BTW the youtube video is really bad but the tool is great.– DavidG
Jul 21 '14 at 16:00
Thanks for pointing me to cdargs. Simply
sudo apt-get cdargs on ubuntu. BTW the youtube video is really bad but the tool is great.– DavidG
Jul 21 '14 at 16:00
add a comment |
Try fastcd (https://github.com/frazenshtein/fastcd)
It sets hook that records visited directories from bash. And sets script as "j" alias, that shows you the last visited directories, with the ability to quickly cd (start typing to filter directories).
Modification of .bashrc is required to make the "j" alias.
Getting tool
cd ~; mkdir Soft; cd Soft
git clone https://github.com/frazenshtein/fastcd
Install required modules
pip install --user urwid
Source the set.sh file into your bashrc
echo -e "nsource /home/$USER/Soft/fastcd/set.shn" >> ~/.bashrc
And update bashrc
source ~/.bashrc
Then just type "j" in console
How does this work? If it's aliases, what does this tool do for you that you can't do by manually editing.bashrc?
– G-Man
Nov 3 '14 at 22:55
It launches daemon that records visited directories in ~/.fastcd for launched shells(bash). "j" launches tool that shows you the last visited directories, with the ability to quickly cd. Modification of .bashrc is required to make the "j" alias. You can see source code for more information, i guess
– Sam Toliman
Nov 3 '14 at 23:36
Thanks for your quick response. This is the sort of information that should be in the answer. Please edit your answer to include this info.
– G-Man
Nov 4 '14 at 15:21
add a comment |
Try fastcd (https://github.com/frazenshtein/fastcd)
It sets hook that records visited directories from bash. And sets script as "j" alias, that shows you the last visited directories, with the ability to quickly cd (start typing to filter directories).
Modification of .bashrc is required to make the "j" alias.
Getting tool
cd ~; mkdir Soft; cd Soft
git clone https://github.com/frazenshtein/fastcd
Install required modules
pip install --user urwid
Source the set.sh file into your bashrc
echo -e "nsource /home/$USER/Soft/fastcd/set.shn" >> ~/.bashrc
And update bashrc
source ~/.bashrc
Then just type "j" in console
How does this work? If it's aliases, what does this tool do for you that you can't do by manually editing.bashrc?
– G-Man
Nov 3 '14 at 22:55
It launches daemon that records visited directories in ~/.fastcd for launched shells(bash). "j" launches tool that shows you the last visited directories, with the ability to quickly cd. Modification of .bashrc is required to make the "j" alias. You can see source code for more information, i guess
– Sam Toliman
Nov 3 '14 at 23:36
Thanks for your quick response. This is the sort of information that should be in the answer. Please edit your answer to include this info.
– G-Man
Nov 4 '14 at 15:21
add a comment |
Try fastcd (https://github.com/frazenshtein/fastcd)
It sets hook that records visited directories from bash. And sets script as "j" alias, that shows you the last visited directories, with the ability to quickly cd (start typing to filter directories).
Modification of .bashrc is required to make the "j" alias.
Getting tool
cd ~; mkdir Soft; cd Soft
git clone https://github.com/frazenshtein/fastcd
Install required modules
pip install --user urwid
Source the set.sh file into your bashrc
echo -e "nsource /home/$USER/Soft/fastcd/set.shn" >> ~/.bashrc
And update bashrc
source ~/.bashrc
Then just type "j" in console
Try fastcd (https://github.com/frazenshtein/fastcd)
It sets hook that records visited directories from bash. And sets script as "j" alias, that shows you the last visited directories, with the ability to quickly cd (start typing to filter directories).
Modification of .bashrc is required to make the "j" alias.
Getting tool
cd ~; mkdir Soft; cd Soft
git clone https://github.com/frazenshtein/fastcd
Install required modules
pip install --user urwid
Source the set.sh file into your bashrc
echo -e "nsource /home/$USER/Soft/fastcd/set.shn" >> ~/.bashrc
And update bashrc
source ~/.bashrc
Then just type "j" in console
edited Dec 31 '14 at 20:23
answered Nov 3 '14 at 22:38
Sam TolimanSam Toliman
313
313
How does this work? If it's aliases, what does this tool do for you that you can't do by manually editing.bashrc?
– G-Man
Nov 3 '14 at 22:55
It launches daemon that records visited directories in ~/.fastcd for launched shells(bash). "j" launches tool that shows you the last visited directories, with the ability to quickly cd. Modification of .bashrc is required to make the "j" alias. You can see source code for more information, i guess
– Sam Toliman
Nov 3 '14 at 23:36
Thanks for your quick response. This is the sort of information that should be in the answer. Please edit your answer to include this info.
– G-Man
Nov 4 '14 at 15:21
add a comment |
How does this work? If it's aliases, what does this tool do for you that you can't do by manually editing.bashrc?
– G-Man
Nov 3 '14 at 22:55
It launches daemon that records visited directories in ~/.fastcd for launched shells(bash). "j" launches tool that shows you the last visited directories, with the ability to quickly cd. Modification of .bashrc is required to make the "j" alias. You can see source code for more information, i guess
– Sam Toliman
Nov 3 '14 at 23:36
Thanks for your quick response. This is the sort of information that should be in the answer. Please edit your answer to include this info.
– G-Man
Nov 4 '14 at 15:21
How does this work? If it's aliases, what does this tool do for you that you can't do by manually editing
.bashrc?– G-Man
Nov 3 '14 at 22:55
How does this work? If it's aliases, what does this tool do for you that you can't do by manually editing
.bashrc?– G-Man
Nov 3 '14 at 22:55
It launches daemon that records visited directories in ~/.fastcd for launched shells(bash). "j" launches tool that shows you the last visited directories, with the ability to quickly cd. Modification of .bashrc is required to make the "j" alias. You can see source code for more information, i guess
– Sam Toliman
Nov 3 '14 at 23:36
It launches daemon that records visited directories in ~/.fastcd for launched shells(bash). "j" launches tool that shows you the last visited directories, with the ability to quickly cd. Modification of .bashrc is required to make the "j" alias. You can see source code for more information, i guess
– Sam Toliman
Nov 3 '14 at 23:36
Thanks for your quick response. This is the sort of information that should be in the answer. Please edit your answer to include this info.
– G-Man
Nov 4 '14 at 15:21
Thanks for your quick response. This is the sort of information that should be in the answer. Please edit your answer to include this info.
– G-Man
Nov 4 '14 at 15:21
add a comment |
I had the same question, and first found this answer. I installed the utility z (https://github.com/rupa/z).
This is exactly what you look for, because z learns from your cd commands, and keeps track of the directories according to the frecency principle (frequent & recent). So after you do both cd commands once, you can do somtehing like:
z docs
z ds
to jump to /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/ respectively. The arguments to z are regexes, so you don't even need to type a full folder name.
add a comment |
I had the same question, and first found this answer. I installed the utility z (https://github.com/rupa/z).
This is exactly what you look for, because z learns from your cd commands, and keeps track of the directories according to the frecency principle (frequent & recent). So after you do both cd commands once, you can do somtehing like:
z docs
z ds
to jump to /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/ respectively. The arguments to z are regexes, so you don't even need to type a full folder name.
add a comment |
I had the same question, and first found this answer. I installed the utility z (https://github.com/rupa/z).
This is exactly what you look for, because z learns from your cd commands, and keeps track of the directories according to the frecency principle (frequent & recent). So after you do both cd commands once, you can do somtehing like:
z docs
z ds
to jump to /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/ respectively. The arguments to z are regexes, so you don't even need to type a full folder name.
I had the same question, and first found this answer. I installed the utility z (https://github.com/rupa/z).
This is exactly what you look for, because z learns from your cd commands, and keeps track of the directories according to the frecency principle (frequent & recent). So after you do both cd commands once, you can do somtehing like:
z docs
z ds
to jump to /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/ respectively. The arguments to z are regexes, so you don't even need to type a full folder name.
edited Apr 13 '17 at 12:36
Community♦
1
1
answered Jan 11 '16 at 8:34
saroelesaroele
1585
1585
add a comment |
add a comment |
Update (2016): I now use FASD for this, which allows fuzzy search based on your latest directories.
I've created a tool for this, in Ruby. It allows you to use YAML files to declare your projects.
I've wrote a little article about it here:
http://jrnv.nl/switching-projects-terminal-quickly/
I've also posted the source on GitHub:
https://github.com/jeroenvisser101/project-switcher
add a comment |
Update (2016): I now use FASD for this, which allows fuzzy search based on your latest directories.
I've created a tool for this, in Ruby. It allows you to use YAML files to declare your projects.
I've wrote a little article about it here:
http://jrnv.nl/switching-projects-terminal-quickly/
I've also posted the source on GitHub:
https://github.com/jeroenvisser101/project-switcher
add a comment |
Update (2016): I now use FASD for this, which allows fuzzy search based on your latest directories.
I've created a tool for this, in Ruby. It allows you to use YAML files to declare your projects.
I've wrote a little article about it here:
http://jrnv.nl/switching-projects-terminal-quickly/
I've also posted the source on GitHub:
https://github.com/jeroenvisser101/project-switcher
Update (2016): I now use FASD for this, which allows fuzzy search based on your latest directories.
I've created a tool for this, in Ruby. It allows you to use YAML files to declare your projects.
I've wrote a little article about it here:
http://jrnv.nl/switching-projects-terminal-quickly/
I've also posted the source on GitHub:
https://github.com/jeroenvisser101/project-switcher
edited Mar 29 '16 at 20:48
answered Feb 16 '15 at 18:56
jeroenvisser101jeroenvisser101
1313
1313
add a comment |
add a comment |
I've been using my own utility cdhist to manage this for many years. It aliases your cd command and automatically keeps a directory stack.
add a comment |
I've been using my own utility cdhist to manage this for many years. It aliases your cd command and automatically keeps a directory stack.
add a comment |
I've been using my own utility cdhist to manage this for many years. It aliases your cd command and automatically keeps a directory stack.
I've been using my own utility cdhist to manage this for many years. It aliases your cd command and automatically keeps a directory stack.
edited Jun 1 '16 at 15:51
agc
4,71111137
4,71111137
answered May 27 '14 at 13:00
bulletmarkbulletmark
211
211
add a comment |
add a comment |
You can use export to assign your directory paths to variables and then reference them.
export dir1=/Project/Warnest/docs/
export dir2= ~/Dropbox/Projects/ds/test/
cd $dir1
cd $dir2
Yes, this is sufficient for a few favorite dirs. No need to install any other utilities. Just put theexportstatements in your~/.bashrc, and they'll always be available.
– wisbucky
May 21 '18 at 21:44
add a comment |
You can use export to assign your directory paths to variables and then reference them.
export dir1=/Project/Warnest/docs/
export dir2= ~/Dropbox/Projects/ds/test/
cd $dir1
cd $dir2
Yes, this is sufficient for a few favorite dirs. No need to install any other utilities. Just put theexportstatements in your~/.bashrc, and they'll always be available.
– wisbucky
May 21 '18 at 21:44
add a comment |
You can use export to assign your directory paths to variables and then reference them.
export dir1=/Project/Warnest/docs/
export dir2= ~/Dropbox/Projects/ds/test/
cd $dir1
cd $dir2
You can use export to assign your directory paths to variables and then reference them.
export dir1=/Project/Warnest/docs/
export dir2= ~/Dropbox/Projects/ds/test/
cd $dir1
cd $dir2
edited Jan 17 '17 at 17:06
andcoz
12.7k33139
12.7k33139
answered Jan 17 '17 at 15:58
Fahad NaeemFahad Naeem
138116
138116
Yes, this is sufficient for a few favorite dirs. No need to install any other utilities. Just put theexportstatements in your~/.bashrc, and they'll always be available.
– wisbucky
May 21 '18 at 21:44
add a comment |
Yes, this is sufficient for a few favorite dirs. No need to install any other utilities. Just put theexportstatements in your~/.bashrc, and they'll always be available.
– wisbucky
May 21 '18 at 21:44
Yes, this is sufficient for a few favorite dirs. No need to install any other utilities. Just put the
export statements in your ~/.bashrc, and they'll always be available.– wisbucky
May 21 '18 at 21:44
Yes, this is sufficient for a few favorite dirs. No need to install any other utilities. Just put the
export statements in your ~/.bashrc, and they'll always be available.– wisbucky
May 21 '18 at 21:44
add a comment |
Some suggestions here:
Most direct idea, I will add alias in the .profile file
vi ~/.profile
alias dir1='cd /myhome/onedir'
alias dir2='cd /jimmy/anotherdir'
Then use $ dir1 or dir2, can cd
If you are always switching in two dirs only. using cd - will switch between them.
add a comment |
Some suggestions here:
Most direct idea, I will add alias in the .profile file
vi ~/.profile
alias dir1='cd /myhome/onedir'
alias dir2='cd /jimmy/anotherdir'
Then use $ dir1 or dir2, can cd
If you are always switching in two dirs only. using cd - will switch between them.
add a comment |
Some suggestions here:
Most direct idea, I will add alias in the .profile file
vi ~/.profile
alias dir1='cd /myhome/onedir'
alias dir2='cd /jimmy/anotherdir'
Then use $ dir1 or dir2, can cd
If you are always switching in two dirs only. using cd - will switch between them.
Some suggestions here:
Most direct idea, I will add alias in the .profile file
vi ~/.profile
alias dir1='cd /myhome/onedir'
alias dir2='cd /jimmy/anotherdir'
Then use $ dir1 or dir2, can cd
If you are always switching in two dirs only. using cd - will switch between them.
edited Feb 29 '12 at 3:38
Kevin
27.6k1065102
27.6k1065102
answered Feb 29 '12 at 2:40
DanDan
12614
12614
add a comment |
add a comment |
The solution I use for this situation is screen. Start screen and create a window for each directory with C-a c and navigate there. Change between windows/directories with C-a n or C-a p. Name the windows with C-a A. Then you can pop up a list of your windows with C-a " and navigate using the window number or name. Since it is screen, you can detach from the session saving your work space and re-attach later with the same set up.
add a comment |
The solution I use for this situation is screen. Start screen and create a window for each directory with C-a c and navigate there. Change between windows/directories with C-a n or C-a p. Name the windows with C-a A. Then you can pop up a list of your windows with C-a " and navigate using the window number or name. Since it is screen, you can detach from the session saving your work space and re-attach later with the same set up.
add a comment |
The solution I use for this situation is screen. Start screen and create a window for each directory with C-a c and navigate there. Change between windows/directories with C-a n or C-a p. Name the windows with C-a A. Then you can pop up a list of your windows with C-a " and navigate using the window number or name. Since it is screen, you can detach from the session saving your work space and re-attach later with the same set up.
The solution I use for this situation is screen. Start screen and create a window for each directory with C-a c and navigate there. Change between windows/directories with C-a n or C-a p. Name the windows with C-a A. Then you can pop up a list of your windows with C-a " and navigate using the window number or name. Since it is screen, you can detach from the session saving your work space and re-attach later with the same set up.
edited Feb 28 '13 at 18:50
answered Feb 28 '13 at 16:22
David R. McWilliamsDavid R. McWilliams
1363
1363
add a comment |
add a comment |
It seems that what you need is basically a project file for your workflow. With directories that belong to your activity, like in a programming IDE. Try Zsh Navigation Tools and the tool n-cd there. It will allow you to navigate across last visited folders and also define a Hotlist with directories of your choice:

n-cd can be bound to a key combination with:
zle -N znt-cd-widget
bindkey "^T" znt-cd-widget
add a comment |
It seems that what you need is basically a project file for your workflow. With directories that belong to your activity, like in a programming IDE. Try Zsh Navigation Tools and the tool n-cd there. It will allow you to navigate across last visited folders and also define a Hotlist with directories of your choice:

n-cd can be bound to a key combination with:
zle -N znt-cd-widget
bindkey "^T" znt-cd-widget
add a comment |
It seems that what you need is basically a project file for your workflow. With directories that belong to your activity, like in a programming IDE. Try Zsh Navigation Tools and the tool n-cd there. It will allow you to navigate across last visited folders and also define a Hotlist with directories of your choice:

n-cd can be bound to a key combination with:
zle -N znt-cd-widget
bindkey "^T" znt-cd-widget
It seems that what you need is basically a project file for your workflow. With directories that belong to your activity, like in a programming IDE. Try Zsh Navigation Tools and the tool n-cd there. It will allow you to navigate across last visited folders and also define a Hotlist with directories of your choice:

n-cd can be bound to a key combination with:
zle -N znt-cd-widget
bindkey "^T" znt-cd-widget
edited Nov 8 '15 at 6:15
answered Nov 7 '15 at 17:19
Adam LissonAdam Lisson
112
112
add a comment |
add a comment |
TL;DR
- Use an
Fishfor interactive shell that empower you immediately (fish>zsh>bash). - Use
POSIX/Bashfor scripting that is the most widely supported syntax (POSIX>Bash>Zsh>Fish).
Shells
Having tested different shells here is my feedback (in order of testing/adoption):
Bash:
- auto-completion: basic ;
- path expansion: no ;
- scripting: excellent.
Zsh+oh-my-zsh:
- auto-completion: good (cycling through);
- path expansion: yes (
cd /e/x1→cd /etc/X11/) ; - scripting: good.
Fish+oh-my-fish(current) is the best out of the box:
- auto-completion: native and supported options;
- path expansion: yes ;
- scripting: too much difference from POSIX-compatible.
Use meaningful aliases
Every shell can be expanded using function and alias, here are the ones I use related to your issue (POSIX-compatible):
back () { # go to previous visited directory
cd - || exit
}
up () { # go to parent directory
cd ..|| exit
}
There are basic, but really meaningful so easy to remember and autocomplete.
Know your shell
Configure CDPATH to add your most used directories (e.g. ~/projects/, /etc/init.d/) so you can quickly jump to them.
See manatwork answer for mroe details on CDPATH.
Hangout and read
- my customization are on github: posix (bash/zsh), fish (PR accepted) ;
- various utilities that might be interesting: tree, k (Directory listings for zsh)
- entry-points to find plugins for your shell:
bucaran/awesome-fish,
unixorn/awesome-zsh-plugins,- alebcay/awesome-shell
bashFAQ ;
Fish documentation ;- for differences between shells, I recommend the excellent hyperpolyglot.org/unix-shells comparison.
- on their IRC: #bash, #zsh, #ohmyzsh, #fish, etc. there is a lot of nice people (you'll need to be patient young padawan).
add a comment |
TL;DR
- Use an
Fishfor interactive shell that empower you immediately (fish>zsh>bash). - Use
POSIX/Bashfor scripting that is the most widely supported syntax (POSIX>Bash>Zsh>Fish).
Shells
Having tested different shells here is my feedback (in order of testing/adoption):
Bash:
- auto-completion: basic ;
- path expansion: no ;
- scripting: excellent.
Zsh+oh-my-zsh:
- auto-completion: good (cycling through);
- path expansion: yes (
cd /e/x1→cd /etc/X11/) ; - scripting: good.
Fish+oh-my-fish(current) is the best out of the box:
- auto-completion: native and supported options;
- path expansion: yes ;
- scripting: too much difference from POSIX-compatible.
Use meaningful aliases
Every shell can be expanded using function and alias, here are the ones I use related to your issue (POSIX-compatible):
back () { # go to previous visited directory
cd - || exit
}
up () { # go to parent directory
cd ..|| exit
}
There are basic, but really meaningful so easy to remember and autocomplete.
Know your shell
Configure CDPATH to add your most used directories (e.g. ~/projects/, /etc/init.d/) so you can quickly jump to them.
See manatwork answer for mroe details on CDPATH.
Hangout and read
- my customization are on github: posix (bash/zsh), fish (PR accepted) ;
- various utilities that might be interesting: tree, k (Directory listings for zsh)
- entry-points to find plugins for your shell:
bucaran/awesome-fish,
unixorn/awesome-zsh-plugins,- alebcay/awesome-shell
bashFAQ ;
Fish documentation ;- for differences between shells, I recommend the excellent hyperpolyglot.org/unix-shells comparison.
- on their IRC: #bash, #zsh, #ohmyzsh, #fish, etc. there is a lot of nice people (you'll need to be patient young padawan).
add a comment |
TL;DR
- Use an
Fishfor interactive shell that empower you immediately (fish>zsh>bash). - Use
POSIX/Bashfor scripting that is the most widely supported syntax (POSIX>Bash>Zsh>Fish).
Shells
Having tested different shells here is my feedback (in order of testing/adoption):
Bash:
- auto-completion: basic ;
- path expansion: no ;
- scripting: excellent.
Zsh+oh-my-zsh:
- auto-completion: good (cycling through);
- path expansion: yes (
cd /e/x1→cd /etc/X11/) ; - scripting: good.
Fish+oh-my-fish(current) is the best out of the box:
- auto-completion: native and supported options;
- path expansion: yes ;
- scripting: too much difference from POSIX-compatible.
Use meaningful aliases
Every shell can be expanded using function and alias, here are the ones I use related to your issue (POSIX-compatible):
back () { # go to previous visited directory
cd - || exit
}
up () { # go to parent directory
cd ..|| exit
}
There are basic, but really meaningful so easy to remember and autocomplete.
Know your shell
Configure CDPATH to add your most used directories (e.g. ~/projects/, /etc/init.d/) so you can quickly jump to them.
See manatwork answer for mroe details on CDPATH.
Hangout and read
- my customization are on github: posix (bash/zsh), fish (PR accepted) ;
- various utilities that might be interesting: tree, k (Directory listings for zsh)
- entry-points to find plugins for your shell:
bucaran/awesome-fish,
unixorn/awesome-zsh-plugins,- alebcay/awesome-shell
bashFAQ ;
Fish documentation ;- for differences between shells, I recommend the excellent hyperpolyglot.org/unix-shells comparison.
- on their IRC: #bash, #zsh, #ohmyzsh, #fish, etc. there is a lot of nice people (you'll need to be patient young padawan).
TL;DR
- Use an
Fishfor interactive shell that empower you immediately (fish>zsh>bash). - Use
POSIX/Bashfor scripting that is the most widely supported syntax (POSIX>Bash>Zsh>Fish).
Shells
Having tested different shells here is my feedback (in order of testing/adoption):
Bash:
- auto-completion: basic ;
- path expansion: no ;
- scripting: excellent.
Zsh+oh-my-zsh:
- auto-completion: good (cycling through);
- path expansion: yes (
cd /e/x1→cd /etc/X11/) ; - scripting: good.
Fish+oh-my-fish(current) is the best out of the box:
- auto-completion: native and supported options;
- path expansion: yes ;
- scripting: too much difference from POSIX-compatible.
Use meaningful aliases
Every shell can be expanded using function and alias, here are the ones I use related to your issue (POSIX-compatible):
back () { # go to previous visited directory
cd - || exit
}
up () { # go to parent directory
cd ..|| exit
}
There are basic, but really meaningful so easy to remember and autocomplete.
Know your shell
Configure CDPATH to add your most used directories (e.g. ~/projects/, /etc/init.d/) so you can quickly jump to them.
See manatwork answer for mroe details on CDPATH.
Hangout and read
- my customization are on github: posix (bash/zsh), fish (PR accepted) ;
- various utilities that might be interesting: tree, k (Directory listings for zsh)
- entry-points to find plugins for your shell:
bucaran/awesome-fish,
unixorn/awesome-zsh-plugins,- alebcay/awesome-shell
bashFAQ ;
Fish documentation ;- for differences between shells, I recommend the excellent hyperpolyglot.org/unix-shells comparison.
- on their IRC: #bash, #zsh, #ohmyzsh, #fish, etc. there is a lot of nice people (you'll need to be patient young padawan).
edited Apr 13 '17 at 12:36
Community♦
1
1
answered Dec 20 '15 at 15:17
Édouard LopezÉdouard Lopez
332213
332213
add a comment |
add a comment |
anc is a cmd line tool (short for anchor), that keeps bookmarks of directories. (so far only tested with bash)
In your case:
anc a /Project/Warnest/docs/ ~/Dropbox/Projects/ds/test/
this adds both directories to the anchor(think bookmarks) list
now if you want to jump to /Project/Warnest/docs/ from anywhere
on your system type:
anc Warn
and if you want to jump to ~/Dropbox/Projects/ds/test/ type:
anc ds test
Apart from matching text against the bookmarked paths anc has many other
convenient ways for jumping around directories.
anc i
starts the interactive mode, that lists all bookmarks by number,
so all you have to type is the number
If you type:
anc Pro[TAB]
a list matching all bookmarks (in your case both bookmarks) gets shown and you can select from it using your arrow keys, this is a very quick and intuitive way.
Get anc at the project's github page:
https://github.com/tobimensch/anc
There's also a README with example usage.
Full disclosure: I'm the author of this script. I hope some people will find it useful.
add a comment |
anc is a cmd line tool (short for anchor), that keeps bookmarks of directories. (so far only tested with bash)
In your case:
anc a /Project/Warnest/docs/ ~/Dropbox/Projects/ds/test/
this adds both directories to the anchor(think bookmarks) list
now if you want to jump to /Project/Warnest/docs/ from anywhere
on your system type:
anc Warn
and if you want to jump to ~/Dropbox/Projects/ds/test/ type:
anc ds test
Apart from matching text against the bookmarked paths anc has many other
convenient ways for jumping around directories.
anc i
starts the interactive mode, that lists all bookmarks by number,
so all you have to type is the number
If you type:
anc Pro[TAB]
a list matching all bookmarks (in your case both bookmarks) gets shown and you can select from it using your arrow keys, this is a very quick and intuitive way.
Get anc at the project's github page:
https://github.com/tobimensch/anc
There's also a README with example usage.
Full disclosure: I'm the author of this script. I hope some people will find it useful.
add a comment |
anc is a cmd line tool (short for anchor), that keeps bookmarks of directories. (so far only tested with bash)
In your case:
anc a /Project/Warnest/docs/ ~/Dropbox/Projects/ds/test/
this adds both directories to the anchor(think bookmarks) list
now if you want to jump to /Project/Warnest/docs/ from anywhere
on your system type:
anc Warn
and if you want to jump to ~/Dropbox/Projects/ds/test/ type:
anc ds test
Apart from matching text against the bookmarked paths anc has many other
convenient ways for jumping around directories.
anc i
starts the interactive mode, that lists all bookmarks by number,
so all you have to type is the number
If you type:
anc Pro[TAB]
a list matching all bookmarks (in your case both bookmarks) gets shown and you can select from it using your arrow keys, this is a very quick and intuitive way.
Get anc at the project's github page:
https://github.com/tobimensch/anc
There's also a README with example usage.
Full disclosure: I'm the author of this script. I hope some people will find it useful.
anc is a cmd line tool (short for anchor), that keeps bookmarks of directories. (so far only tested with bash)
In your case:
anc a /Project/Warnest/docs/ ~/Dropbox/Projects/ds/test/
this adds both directories to the anchor(think bookmarks) list
now if you want to jump to /Project/Warnest/docs/ from anywhere
on your system type:
anc Warn
and if you want to jump to ~/Dropbox/Projects/ds/test/ type:
anc ds test
Apart from matching text against the bookmarked paths anc has many other
convenient ways for jumping around directories.
anc i
starts the interactive mode, that lists all bookmarks by number,
so all you have to type is the number
If you type:
anc Pro[TAB]
a list matching all bookmarks (in your case both bookmarks) gets shown and you can select from it using your arrow keys, this is a very quick and intuitive way.
Get anc at the project's github page:
https://github.com/tobimensch/anc
There's also a README with example usage.
Full disclosure: I'm the author of this script. I hope some people will find it useful.
edited Jun 5 '16 at 15:47
JigglyNaga
3,922934
3,922934
answered Jun 5 '16 at 14:42
tobimenschtobimensch
111
111
add a comment |
add a comment |
1 2
next
protected by Kusalananda Feb 1 '18 at 14:48
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
Symbolic links could also be useful for this. en.wikipedia.org/wiki/…
– user606723
Feb 9 '12 at 15:11