Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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:

alias
Cons:
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).

links
Cons:
Clutter directory make ls a headache.

pushd/popd
Cons:
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
show 5 more comments

4 Answers 4

cdargs is the best tool for bookmarking a directory : http://www.youtube.com/watch?v=uWB2FIQlzZg

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

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

share|improve this answer
add comment

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
add comment

Just to add my 2 cents.

qwe

Usage:
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
add comment

Your Answer

 
discard

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

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