7

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?

9
  • 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, 2012 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, 2012 at 20:41
  • 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. Apr 25, 2012 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, 2012 at 20:50
  • Pretty much identical to the example above... tried it with $HOME and it still didn't work. e.g. COMMAND 1: CDPATH=$HOME/<dir>/<dir>/tools COMMAND 2:echo $CDPATH (displays full verbose path correctly) COMMAND 3:cd tools (yields bash: cd: tools: No such file or directory) Apr 25, 2012 at 21:00

6 Answers 6

0

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.

2

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

1
  • And is available from cdargs package Mar 6, 2013 at 23:30
2

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
1

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

0

Apparix is a pure command-line implementation (that is, not menu-driven) for both bash and zsh of bookmarks. It is possible to jump to subdirectories of the bookmarks and tab-complete on those subdirectories. This is what gives it the most oomph.

0

Maybe not terminal, but mc :) https://midnight-commander.org/ feature > The Directory Hotlist

I use it and love it

1
  • 1
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Nov 15, 2021 at 7:46

You must log in to answer this question.

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