Thursday, August 03, 2006

Frequent commands

To get the 10 commands I used most often on linux, I typed in some ruby.

#!/usr/bin/env ruby
f = File.open('#{ENV["HOME"]}/.bash_history')
counts = {}
counts.default = 0
f.each { |line|
command = line.split[0]
counts[command] += 1
}
((counts.sort_by {|x, y| -y} ).first 10).each {|x, y| puts "#{x}: #{y}"}
This last line is how I tend to end a program if I'm not using it again. I keep adding code to one line 'till it doesn't fit in my screen anymore.

Anyway here's the result
  1. ls: 79, the main use is file browsing on the command line. Often when I am downloading a file and want to see if it's ready yet, I type ls a lot of time I could use the command watch ls more often.
  2. emacs: 34, that's a text editor ;)
  3. less: 32, less is actually quite useful for different files. It can be used for directories, pdf's, binaries, etc...
  4. make: 28, that's for building things
  5. grep: 24, usualy with -R
  6. su: 22, should use sudo more often.
  7. ./configure: 19, this is what you type before make.
  8. equery: 18, that's part of the portage system on gentoo
  9. cd: 17, it's good to change things.
  10. autoreconf: 15, this is for developing with autoconf

0 Comments:

Post a Comment

<< Home