codeblog code is freedom — patching my itch

August 4, 2008

(late to the) history meme

Filed under: Blogging,Ubuntu — kees @ 11:27 am

My history isn’t entirely interesting, but does seem to show the single-mindedness of my terminals:

$ history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}' | sort -rn | head
73 cd
68 vi
39 ls
24 bzr
18 exit
18 cat
13 u-build
13 sudo
13 am
10 echo

Random details:

  • I use a lot of terminals, and have only just recently gotten into the habit of using Ctrl-D to close them — as seen above, I use exit.
  • am is a script that takes apt-cache madison "$@" and shows only the most recent version from each release.
  • u-build is a script that prepares and performs a build in my sbuild/schroot/lvm environments.
  • echo snuck onto this list because I was verifying some x86 machine code, and kept typo-ing it as I ran “variations” of (the correct command line) echo -ne '\x33\xdb\x68\x70\x77\x6e\x0a\x8b\xcc\x8d\x43\x04\x43\x8b\xd0\xcd\x80\xeb\xfa' | ndisasm -u -
  • It seems I’m in need of the same thing helix noted from Greg KH’s terminal-tied-to-Twitter: an alias for cd "$@" && ls instead of constantly typing cd followed by ls.

© 2008, Kees Cook. This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Creative Commons License


  1. Egads! Am I ever a creature of habit:
    79 ls
    77 cd
    68 git
    53 vi

    How ’bout that alias, eh?

    Comment by Greg — August 4, 2008 @ 9:09 pm

  2. I think this should do the trick:
    alias cd='cd "$@" && ls'

    Comment by kees — August 4, 2008 @ 9:29 pm

  3. I too am a creature of habit:

    246 vim
    224 sudo
    222 ls
    191 cd
    115 qu
    106 bzr
    72 apt-cache

    (‘qu’ is an alias for ‘quilt’.) I had to modify the recipe slightly to work on my history, as I’ve changed the reported format slightly to include human readable datestamps by setting HISTTIMEFORMAT='%a %Y-%m-%d %H:%M '; this format required changing $2 to $5 in the awk bits.

    Other settings I’ve tweaked include:

    shopt -s histreedit
    shopt -s histappend

    the details of all of which are findable in the bash(1) manpage.

    Comment by Steve Beattie — August 6, 2008 @ 5:04 am

  4. Here is mine (I am using HISTFILESIZE=80000 so I can Ctrl-R for complicated commands long past):
    3002 ls
    1475 cd
    639 svn
    480 mutt
    407 vim
    355 rm
    300 less
    254 t
    233 mv
    223 apt-cache

    t is a translation program english/german

    Comment by maxy — August 8, 2008 @ 9:59 pm

Powered by WordPress