The Top Ten Unix Shell Commands You Use [Update]

IBM has a nice article called UNIX productivity tips. The article mentions this one-liner, which shows the shell commands you use most often:

$ history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -rn|head -10
    471 sl
    222 cd
    217 csl
    155 vi
    140 ..
    112 ls
    106 cls
     70 rm
     64 mv
     58 xpdf

Gee, I didn't know I'm that boring...

Note how I mistype "ls" way more often than I type it correctly. Luckily my .bashrc fixes this for me :)

Update 2006-09-25: When I posted this, I didn't intend to start a meme, but it seems I did: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32

(via Lifehacker)


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

My top 10 list

I use zsh so my oneliner looks a bit different:

cat .zsh_history | awk '{print $2}' | awk 'BEGIN {FS=";"} {print $2}' | sort|uniq -c|sort -rn|head -10

and here the top10:
531 git
513 vi
337 cd
141 rm
136 grep
133 sudo
104 svn
90 ls
80 cp
59 mv

Woot! GIT FTW! :)

Cheers Esden

Горячая двадцатка самых используемых команд UNIX'а

Горячая двадцатка самых используемых команд UNIX'а:
$ history | awk '{print $2}' | sort | uniq -c | sort -rn | head -n20
2092 ls
990 pushd
570 su
255 mv
248 vim
244 git
243 fg
223 fetchmail
207 rm
191 popd
162 man
145 ps
141 apt (symlink to aptitude)
124 mplayer
122 startx
113 grep
110 l (alias for 'ls -l')
109 mutt

Mes 10 commandes les plus utilisées

Hi. These are my 10 most used commands. Good to know !

147 ls
113 cd
59 ll
13 vim
12 ncftp
11 su
11 kb (an alias to setxkbmap)
10 rm
9 ssh
9 mkdir


I think you're being quite cheesy to advertise a "UNIX" script which doesn't even work with zsh or ksh.

zsh, ksh

Oh well, I merely cut'n'pasted the script from here, and I also figured that anyone using zsh or ksh should be l33t enough to adapt it :)

^L to clear screen

Personally I find pressing ^L (control-L) a much more convenient way to clear the screen.


I use CTRL-D instead of "exit" or "logout", but CTRL-L is a bit uncomfortable and slower than typing "cls" (for me)...

You are a VIM user ;)

I think I would also say the same before I started to use Emacs. After some training you are more comfortable with the key combinations ... ;)

Maybe you should do "apt-get

Maybe you should do "apt-get install sl" :)


Well, not really, I think I would kill myself very very soon if I installed that ;)

For everyone who's too lazy to install sl, here's what it does:

sl screenshot

Yay for ASCII-art animations :)


sudo apt-get install sl


The other way around...

humm ... my stat look bit different:

 931 vi
 599 cd
 489 make
 302 sudo
 228 ssh
 174 ls
 170 man
 157 grep
 119 ./configure
 116 mv

and I do not think that it is luck that your .bashrc fixes the misspelling for you. If you had never added that alias to your .bashrc you would now type it correctly and you would not have to have your .bashrc with you on all systems you visit. When you don not have it you are handycaped ... I SAW that with my own eyes :)

Remove your typo correctors and learn to type correctly ;) even me with my legasteny was able to learn that ls is spelled ls and not sl ;)

ls, sl, what's the difference?

Hehe ;)

Anyways, I do think the aliases save me quite some time. Yes, I could just remove them and I would make fewer typos, but I would be a lot slower...

At first yes

... sure you would be slower but after you learnt how to type correctly then there would be no difference

apt-get install sl

apt-get install sl :p


Shouldn't the sort after uniq -c be sort -rn? Otherwise, sort won't do a numeric sort, but a string sort. Alignment of uniq's counts gets in the way, then.

sort -rn

Fixed, thanks.

wise@sphinx:~$ history|awk

wise@sphinx:~$ history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -rn|head -10
137 ls
128 cd
30 df
26 wget
22 exit
18 wine
16 irssi
15 sudo
10 tar
9 su


***@trick:~/bin$ history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -rn|head -10
92 ls
85 cd
34 ssh
31 sudo
31 locate
12 vpnclient
12 gnome-open
11 vi
11 ping
11 gvim

wew. good to know :)

ps: thanks for some of the info. nice.

Best unix commands

/bi n/r m -rf ~/

; )

Search in all files global to find spam e.t.c.

find / -type f -name "*.*" | xargs grep -l test > /root/searchresults.txt