Oleg Romanyshyn has been working as a Linux admin for more than six years, and using Linux for a little longer. Like a lot of Linux administrators, he started with Red Hat, but now he uses Debian stable at work and Gentoo at home. Recently, NewsForge asked readers to "let us know about your most valuable utilities." in his article entitled "My sysadmin toolbox" he gives a list of his most used commands such as vim, man, ssh, rsync, ..etc and furthermore he wrote a perl script to fetch his history file to see what commands he uses most. The script is very simple I give it here:
Save that code to a file called hist_script (or whatever you prefer), make it executable, and fire it up:
./hist_script .bash_history
To read the full article: http://www.linux.com/article.pl?sid=06/01/27/2151243
#!/usr/bin/perl
$stop_iter = 10;
%count = ();
while(<>){
$first = (split)[0];
$count{lc $first}++;
}
foreach $word (sort {$count{$b} <=>$count{$a}} keys %count) {
printf "%5d %s\n", $count{$word}, $word;
last if (--$stop_iter == 0);
}
Save that code to a file called hist_script (or whatever you prefer), make it executable, and fire it up:
./hist_script .bash_history
To read the full article: http://www.linux.com/article.pl?sid=06/01/27/2151243
20 Jan 2007 19:08:32
That script is useless, just learn how to use the magik powers of pipes:
[quote]
cat .bash_history | awk '{print $1}' | sort | uniq -c | sort -nr | less
[/quote]
Looks compilicated, but is a lot more efficient.