Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Aside from aliasing and links, is there an easy way in Linux to tag commonly used directories and to navigate to a commonly used directory from the terminal.

To be clear the disadvantages I see with alternative approaches, and why I want a bookmark/favorites like system:

Too specific (every new favorite requires a new alias...although you could in theory make an alias that echo append your dir as a new alias, which would be sort of clever). Can't nest favorites in folders (can't think of a simple solution to this outside of heavy config scripting).

Clutter directory make ls a headache.

Non-permanent (without shell config file scripting), can't nest favorites in directories, etc.

Granted I have multiple ideas for making my own non-standard solution, but before I have at it I wanted to get some perspective on what's out there and if there is nothing, what is a recommended approach.

Does anyone know of such a favorites/bookmark-like terminal solution?

share|improve this question
Many shells also have a $CDPATH; this could be combined with one or more of the other solutions, for example to reduce the clutter from links. by hiding them in a dot-directory and putting that in $CDPATH. – geekosaur Apr 25 '12 at 20:31
set doesn't do what you think it does. (Try echo $1 in the shell where you did that.) It's just CDPATH=whatever. – geekosaur Apr 25 '12 at 20:41
Ah, thanks... dumb moment. – Jason R. Mick Apr 25 '12 at 20:44
How to use that var, though? I thought it might allow me to say cd tools if I had a folder named ~/<dir>/<dir>/tools/, but no luck. – Jason R. Mick Apr 25 '12 at 20:45
What exactly did you set CDPATH to, for that? (Beware that ~ is not always expanded in such cases; you may want to use $HOME instead.) – geekosaur Apr 25 '12 at 20:50
up vote 0 down vote accepted

Just to add my 2 cents.


qwe name : Traverse to directory tagged name
qwe -h : Help
qwe -l : List of saved tag
qwe -a name : Add a tag called name with the current folder"
qwe -d name : Remove a tag called name
qwe -p name : Print the directory tagged with name

To install, just store the script somewhere and source it in your .bashrc file.

share|improve this answer

cdargs is the best tool for bookmarking a directory :

share|improve this answer
And is available from cdargs package – Jakub Narębski Mar 6 '13 at 23:30

I use one-letter variables for temporal bookmarking, and properly named symlinks for permanent storage.

share|improve this answer

There is also bashmarks project (for bash shell), which uses one-letter commands for managing directory bookmarks:

s <bookmark_name> - Saves the current directory as "bookmark_name"
g <bookmark_name> - Goes (cd) to the directory associated with "bookmark_name"
p <bookmark_name> - Prints the directory associated with "bookmark_name"
d <bookmark_name> - Deletes the bookmark
l                 - Lists all available bookmarks
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .