Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Console productivity hack: Discover the frequent; then make it the easy (might.net)
34 points by icey on Oct 10, 2010 | hide | past | favorite | 13 comments


I find it difficult to believe an efficiency article that tells me that 'e' is shorter than 'emacs' but to write a 15-line perl script to replace 'uniq -c'. Add to that the cdto script, which replaces pushd crudely and without recursion.

Premature optimization. Spend more time learning about the tools you already have, then figure out how to shave whole seconds (over the course of a year) off using them.


The comments in this post made me finally switch from bash to zsh (including integrating it with autojump).

After a few hours of cobbling together a decent config, I found http://bitbucket.org/Josh/oh-my-zsh/src/ to be a way better starting point. All the defaults make a bash user feel right at home (keyboard shortcuts etc), plus it organizes all the bazillion zsh options in a sane configuration layout.


He should just use Zsh, rather than wasting his time rewriting shell one liners in Perl.


Fish is also an excellent alternative to the Perl one-liners proposed. Typing in part of a previously entered command then pressing up performs a substring search on the history. It's easy and adapted to your current usage habits.


Zsh does that. Actually even Bash can do that, but its implementation is a bit weak.


One handy tool that I came across recently is "autojump." It lets you jump to directories by typing in a short pattern, which is matched against the names of the directories you use the most. I still use cd for short, direct changes, but autojump is nice for switching between top-level project folders and the like.

Source: http://github.com/joelthelion/autojump/wiki


I've always felt that autojump's "jump" command could be hit or miss when you had directories with similar paths. Because of this, I wrote a tool for myself to quickly jump around to commonly used folders by using short named aliases.

The manual directory alias naming means that you can target the folder that you want much more accurately. Combined with tab-completion, this thing has become a huge productivity booster for me.

link: http://www.huyng.com/bashmarks-directory-bookmarks-for-the-s...


The `cdto` functionality (and then some) already exists in many shells, even the Windows shell.

`pushd` switches directories and maintains a stack of visited directories. `popd` pops the previous directory off the stack and then switches to it.

In zsh, it seems that `cd` is an alias for `pushd`. You can `cd` to a directory, then `popd` to go back.

In Windows, `pushd` seems to the easiest/only way to navigate to network directories on the command-line.


You can also say `cd -` on Bourne shells to go back to the previously visited directory. If you move from A to B in this manner and then run it again, then you will go back to A.

Also, `alias cd=pushd` to get that same zsh functionality in other Bourne shells.


I often find this idiomatic as well, both in scripts and on the command line:

  dostuff
  ( cd $directory && otherstuff )
  morestuff


I would suggest autojump for quickly switching to frequently used folders.

http://github.com/joelthelion/autojump/wiki


isn't the "frequency" perl script the same as "sort | uniq -c" ?


    sort .bash_history | uniq -c | sort -n | tail -3
      8 la
     48 ..
    106 d
So they're already pretty compressed. ".." is "cd ..", d is "ls --color=auto", and la is the same with -a.

Very diminishing returns after these.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: