View your terminal history

I’ve seen a whole bunch of people’s terminal history at various different areas which is neat to keep a tab on all your activities and find out what other people use alot. I guess I’ll pitch in with mine:

niko@home:~$ history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
244 sudo
78 cd
56 bzr
35 apt-cache
12 cowsay
8 ./teeworlds_srv
6 niko@home:~/Desktop/
5 ./teewars_srv
4 firefox
3 man

It shows I use sudo quite a bit and am very addicted to the terminal in general. Anyways, the person who started all of this is here and I think it’s neat to keep a tab on all that I do. I’m sorry for the absence of posts, but I’ve been having lots of company over lately and it’s been hard to fit it in.

I’ll have a real post tomorrow I hope, and I can only hope that I’m not as busy as I have been lately quite occupied with other things. If you want to find out your own usage of different please add it in the comments after running this command:
history | sed -e 's/ / /g' | cut -d " " -f3 | sort | uniq -c | sort -n | tail | sort -nr

Have fun,


~ by nikopsk on April 11, 2008.

6 Responses to “View your terminal history”

  1. Hay this is a cool idea, but the string of code you gave doesn’t seem to work like it did for you.


  2. Well I went to the site you game and I used this

    history|awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head

    and it gave me this:

    jon@cortana:~$ history|awk ‘{a[$2]++ } END{for(i in a){print a[i] ” ” i}}’|sort -rn|head
    111 sudo
    59 cd
    57 ls
    30 ps
    18 ./configure
    17 pkill
    17 clear
    13 make
    13 gedit
    12 chmod

    Very cool niko 😉

  3. Ok, here is my top ones:

    41 vim
    34 exit
    28 sudo
    21 man
    20 gpg
    19 telnet
    16 whois
    16 ./ipmailer
    15 ls
    12 ./whoowns

    But I still want to study that command and figure out the counting part about it 🙂

  4. Sometimes it doesn’t seem to work… I added the pipes and it work on Nathan’s machine, and mine. The one shown in my example works for me.

  5. Well, one of the problems is, if you copied it directly from the blog, it had those funky substitute apostrophes and quotations, that WordPress adds in to the post.

    Generally it is for security, because apostrophes and such are used in SQL injections, but it makes it harder on the end user when copying a command or some code.

  6. Hrm; yes, WordPress does have those weird additions… 😦

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: