Results tagged “shell” from Mechanix
People have been posting in their blogs about what command they run, based on their shell histories. The command that I've seen looks like this:
history|awk '{a[$2]++} END{for(i in a){ \
printf "%5d\t%s \n",a[i],i}}'|sort -rn|head
That works, of course, but who wants to use awk and the shell? I pulled out the old Data::Hash::Totals module I wrote a while back, along with Perl's built-in awk simulation:
$ history | perl -MData::Hash::Totals -ane'$x{$F[1]}++;' \
-e'END{print as_table(\%x, comma => 1)}' | head
207 vim
143 svn
125 make
90 ack
77 cd
45 sdvx
34 ssq
31 ls
25 ./login-fixup
19 tail
alester:~ : cat `which sdvx`
#!/bin/sh
svn diff -x -w $* | view -
and ssq is just an alias for svn status -q.
dotfiles.org is a site that collects dotfiles for various shells and editors. If you've ever read someone else's .bashrc and said "Oh, THAT'S a cool trick", this is the site for you. If you haven't, now's the time to start. If you don't know what a dotfile is, or haven't modified the dotfile for your editor and shell, now is definitely the time to start.
Popular dotfiles include:
- .vimrc
- .screenrc
- .zshrc
- .bashrc
- .irbrc
- .Xdefaults
- .conkyrc
- .bash_profile
- .xinitrc
- .emacs
I've only put my .vimrc up on my personal wiki, but I can see I'll need to put it up here as well.