6 ms·
Teleportation on the command line
- damaru 13y agoWell I though it was nice, but the script if quite buggy! works well when cleaned up
- scribu 13y agoI'm quite happy with https://github.com/huyng/bashmarks https://github.com/huyng/bashmarks Also, the built-in pushd and popd commands are enough sometimes.
- vezzy-fnord 13y agoAlso, the built-in pushd and popd commands are enough sometimes. I came here to say this. A small wrapper around these commands would make for a sufficient script.
- res0nat0r 13y agoJust use auto jump https://github.com/joelthelion/autojump https://github.com/joelthelion/autojump
- rohansingh 13y agoFor those who aren't familiar with it, autojump learns directories that you use often. This eliminates the need to add specific bookmarks.
- deleted 13y ago[deleted]
- deleted 13y ago[deleted]
- gaving 13y agolighter (non python) alternative to autojump https://github.com/rupa/z https://github.com/rupa/z
- aristidesfl 13y agoI also use z
- mtrn 13y agoSince I discovered `z` I haven't typed in cd, except for changing into $HOME quickly.
- secoif 13y agoauto jump (or z) is so incredibly useful it should be built into the terminal. changed my life.
- JelteF 13y agoFish[1] sort of has this built in. I explained more in another comment[2]. [1] http://fishshell.com/ http://fishshell.com/ [2] https://news.ycombinator.com/item?id=7043719 https://news.ycombinator.com/item?id=7043719
- jck 13y agoWith zsh, you could just do w/c/p/w/s<TAB>
- sreejithr 13y agoDid anybody try the script in ZSH?
- akerl_ 13y agoI use a similar method, which I based on a previous HN post: https://github.com/akerl/dotfiles/blob/master/.bundles/marks https://github.com/akerl/dotfiles/blob/master/.bundles/marks I'm addicted to one/two-letter aliases, and between that and ZSH completion (https://github.com/akerl/dotfiles/blob/master/.completions/_marks https://github.com/akerl/dotfiles/blob/master/.completions/_...), the mark functions get me super-simple bookmarks I also wish people would stop providing "curl this into .bashrc" as the primarily installation method. That's a really bad habit to get into, especially with a file like .bashrc. It's a bit less risky than piping the curl into bash, but still not a great plan.
- ses4j 13y agoDoes any flavor of this functionality exist for Windows command prompt?
- elarkin 13y agoWindows makes this a little easier than bash does. batch scripts in windows behave like scripts on unix do when you source them. That means that you can write a batch script called "foo.bat" with the contents of "cd \whatever\directory\you\please" and it will change your current directory when run. From there, it would not be difficult to write a batch script that in turn wrote batch scripts like "foo.bat" above. With bash, you would have to create functions or aliases to get the same effect.
- shurcooL 13y ago> Nobody types an entire URL like https://example.com/example-page?input=sample&another-input=2 https://example.com/example-page?input=sample&another-input=.... We bookmark it and give it a keyword like ex or something. From then, we just type ex and hit return to access the website. I don't wanna sound negative, but just being realistic. I don't rely on bookmarks primarily. I rely on "most frequently visited gets auto-completed first" and fuzzy search of Chrome Omnibox. If I do bookmark something, it's to indicate to the algorithm "I care about this, make it easier to fuzzy find it later". But it's a good step in the right direction, good job! Edit: From the description, it sounds like autojump does something close.
- JelteF 13y agoYou should try out fish[1], one of the features that makes it great is that it does exactly what the chrome omnibox does, just with commands. It shows what it will complete after you press ^F and it is a lot of times correct. It also has lots of other features, like tab completion that tells you what the options of commands do. So reading the manpages or typing -h is generally not needed. If you do try it, also try one of the themes of oh-my-fish[2], most of them have a git thing that lets you know if you have uncommitted stuff and on what branch you are. [1] http://fishshell.com/ http://fishshell.com/ [2] https://github.com/bpinto/oh-my-fish https://github.com/bpinto/oh-my-fish
- dmourati 13y agoTab works for me.
- euank 13y agoIt looks like no one has posted what, in my opinion, is the most powerful of the "jump" programs: fasd. My workflow for getting around is just to type "z <fragment of directory name>" and I almost always end up where I want. If I just want to edit a file, not a project, I do vim `f <filename fragment>` and likewise get the file I want typically. The readme makes it pretty clear how awesome it is and I've stuck with it after using autojump, z, and others. https://github.com/clvv/fasd https://github.com/clvv/fasd
- coley 13y agoI made a tool a year ago to do the same thing, Metis: https://github.com/srcoley/metis https://github.com/srcoley/metis I like a solution that goes where ever your dotfiles go, instead of having to install a fuzzy search on each system. Metis will list all of your currently saved Metis aliases as well, just by typing "metis". You can also tell Metis which dotfile you want to save your aliases.
- ClayFerguson 13y agoThis is sort of why I always just put everything in a shell script. Creating a text file with .sh extension is not that difficult, and I almost never use the command line interactively. Plus I use a GUI and just mount folders I need to browse. It boggles the mind how so many people still equate "Linux==Command Line Hacking". I actually had a boss once who said to me: "If you don't use the command line that much why do you use Linux instead of Windows?" You see, in his mind Linux was all about the command line. Yeah maybe in 1990 it was, but nowadays it's a normal OS like any other.
- Morgawr 13y agoInteresting scripts are being posted in the comments, really neat tricks guys. One thing I'd like to add, if you're like me and don't want to install too much "extra" stuff on your machines: Bash has native commands called pushd and popd[0]. They work as a stack, pushd will push the current directory onto the stack and jump to the new target, then you're free to move around, do whatever you want and then call popd to pop the latest directory from the stack. I find these very useful, especially if I'm on a machine without additional installed software and just want to do my thing effortlessly. [0] http://en.wikipedia.org/wiki/Pushd_and_popd http://en.wikipedia.org/wiki/Pushd_and_popd
- anon4 13y agoFor a one-level undo there's always cd - Passing a single dash as a parameter to cd takes you back to $OLDPWD and each invocation of cd sets OLDPWD to the directory you were in.
- sgs1370 13y agoThanks - all of the alternatives look interesting but this one seems to be the shortest of them, and since "mark" installed after a simple cut & paste into my profile, I'll try it out for a while.
- MattFlower 13y agoSome time ago I put my directory changing tools up on GitHub at https://github.com/mattflower/bashcd https://github.com/mattflower/bashcd In addition to the bookmarking style capabilities other people have already mentioned it also includes integration with the locate database, the mac spotlight/mds database, and the plain old find command. It can switch to a sub directory containing a particular file. It also supports bash completion.
- ehm_may 13y agoI don't get it. Why not just use aliases? alias <name>='cd path/to/<name>' Then you can just type: $ <name> You can even set up an alias to add a new alias -> alias ea='vim ~/bash/alias'
- csense 13y agoWhy not just use a symlink? ln -s ~/super/long/nested/directory/name ~/short If you don't want to dump them in your home directory, just make a directory with a single-letter name for your links: ln -s ~/super/long/nested/directory/name ~/l/short
- biscarch 13y agoPersonally I do something similar. I set up an alias in .zshrc from project names to commands. This allows me to do things like source environments as well. alias proj="cd /this/that/foo/projects/myproject/ && source .hsenv/bin/activate"
- Webster 13y agoWhy not just use the CDPATH variable in your shell? If the directory is one you go to frequently, add it to CDPATH, then just cd to it.
- bnegreve 13y agoNice. This quick and dirty trick has been in my .bashrc forever and I still use it: function md(){ pwd > /tmp/md_tmp function gomd(){ cd `cat /tmp/md_tmp` so `md` marks the current directory and `gomd`go to the marked directory. Unlike bash builtins like pushd and popd, it uses the file system to store the marked directory so you can pop up a new terminal and just do gomd. (you can't with pushd/popd since the bash processes of the old and the new terminal are not related) Edit: I see that your script uses links, I'll check this out.
- rasengan0 13y agoI enjoy posts like this because it brings out timtowtdi: pushd, cdpath, ln and aliases