TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Nice commandline directory bookmarker. (Saves you typing and tabbing too much)

14 pointsby BjornWover 15 years ago

8 comments

char_pointerover 15 years ago
Hey! I'm the writer of these tools and was kind of surprised to run into it here, since I have not posted about this before — the submitter must have been an adventurous PyPI visitor ;)<p>This particular tool was mostly written to replace all the ad-hoc aliases and symlinks with something that could be easily maintained and brought to other commands (eg. cdbm, lsbm, mvbm, cpbm, etc.). To speed things up some more there's also tab completion and prefix matching, which is pretty convenient IMO.
评论 #858722 未加载
silentbicycleover 15 years ago
Instead of needing to have bookmark-aware commands in the first place ("commands that are available are and bookmark-aware: lsbm, cpbm, mvbm, mkbm, ...") , it would probably be better to use backtick:<p><pre><code> cd `bm shortcutname` </code></pre> Forking loads of common utilities is going to add lots of superfluous complexity. Of course, at that point you could replace the whole bm suite with shell aliases or a script that contains<p><pre><code> #!/bin/sh # find relevant line by key, get the second field grep "$1 " ~/.bms | cut -d " " -f 2 </code></pre> . Put that in your path, chmod u+x bm, and there you go. In this case, the bookmarks file is hardcoded to ~/.bms and you edit it by hand, but that's probably good enough. If you want to add from the shell, here's bm-add:<p><pre><code> #!/bin/sh echo $1 $2 &#62;&#62; ~/.bms </code></pre> Put it in your path, chmod u+x bm-add, good to go.<p>If you'd rather have the bookmark file separated by tabs, just remove the -d " " from bm, change the grep to "$1\\t", and change bm-add to echo $1\\t$2 &#62;&#62; ~/.bms. Simple.<p>For an excellent intro on how to work with Unix's strengths, read _The Unix Programming Environment_ by Kernighan and Pike.
bluishgreenover 15 years ago
I have these functions in my .bashrc<p>addpi() { echo "cd `pwd` $1" &#62;&#62; ~/.pi; echo }<p>pi() { `cat ~/.pi | grep $1`; }<p>Usage: when you are in a dir that you want to bookmark say addpi &#60;name&#62;<p>when you want to return to that dir from anywhere say pi &#60;name&#62;<p>Ofcourse you need some kind of resolution if you have 2 matches in the grep, but it works for me.
评论 #857513 未加载
iamalekseyover 15 years ago
There is also autojump <a href="http://wiki.github.com/joelthelion/autojump" rel="nofollow">http://wiki.github.com/joelthelion/autojump</a>
评论 #858974 未加载
DannoHungover 15 years ago
The blogging and animated gif stuff seems pretty out of place in this package...
stcredzeroover 15 years ago
Actually, this is one of the things I used to use <i>screen</i> for.
vijaydevover 15 years ago
how is this different from using aliases?
评论 #857507 未加载
CamperBobover 15 years ago
I've done this for years in my DOS sessions. A small program called qcd ("quick cd") reads the current working directory and writes a corresponding "cd" command to a batch file in c:\windows:<p>------------------<p>c:\foo\bar\bat&#62;qcd 1<p>(creates file called c:\windows\1.bat containing "cd \foo\bar\bat")<p>c:\foo\bar\bat&#62;cd \frotz\ozmoo<p>c:\frotz\ozmoo&#62;1<p>c:\foo\bar\bat&#62;