what is your 10 common linux commands?
October 27th, 2007 mysurface Posted in awk, column, Common, grep, head, history, nl, sort | Hits: 133100 | 47 Comments »
Dear command line ninjas, Mr CLI and keyboard pianist:
What is your regular command you use? I am sure you must thinking of ls and cd. Yeah, they are common for every users, but how about the rest of them? I have construct a combos of commands to help you identify your top ten linux command.
The idea is simple, we gather info from history, lets look at the command combo’s now.
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
The command line above may looks complected, let me briefly explain it part by part. Awk is the most important part in line above, It simply store the command and count the occurrence in history ( column 2, $2), at the end of operation, it prints the result accordingly. Check out awk examples for more illustration on awk.
With the result output it then passes to grep -v to filter out “./”, because ./something is not a linux command. After that, arrange the data in columns and sort it numerically. List only the top ten with numbers using head and nl.
I have also created a script, so you can download it and run.
The results might vary based on your daily activities and Linux distribution. I have two laptop, one i use it at home and another one I use it at office. Ok, here is my 10 common linux commands.
Linux Distro: kubuntu 7.10
Desc: My personal laptop.
Activities: Online, Blogging, and leisure stuff.
1 97 19.4% ls
2 78 15.6% cd
3 46 9.2% vi
4 27 5.4% sudo
5 25 5% apt-get
6 15 3% ps
7 13 2.6% rm
8 13 2.6% ll
9 11 2.2% man
10 8 1.6% mv
Linux Distro: Ubuntu 7.04
Desc: Office Laptop
Activities: coding in c/c++, testing on the modules coded.
1 94 18.8% vi
2 83 16.6% g++
3 77 15.4% ls
4 69 13.8% cd
5 11 2.2% ps
6 10 2% man
7 8 1.6% sudo
8 6 1.2% apt-get
9 5 1% cp
10 4 0.8% vis
From the result above, you may realized that, I use vi and g++ more than cd and ls during working.
p.s. vis is alias vis=’sudo vi’
Share with us your top ten command :)
Best Regards,
mysurface.
October 27th, 2007 at 2:38 pm
Interesting, by a fair margin, ssh is top on my list
1 34 25.9542% ssh
Which goes to show that when I go to the CLI that it’s to do work on servers which is how I have setup my environment. On those servers real or virtual then, by a wide margin also, is screen(1) which most remote (or even CLI) users should run first.
October 27th, 2007 at 2:50 pm
wine on a suprisingly high position here since i tried to get a small program working in a real os. sudo is very much apt-get. ping is because of problems with my connection….
1 83 16.6% cd
2 77 15.4% ls
3 67 13.4% sudo
4 23 4.6% exit
5 20 4% df
6 19 3.8% cat
7 14 2.8% wine
8 13 2.6% ping
9 11 2.2% ssh
10 10 2% java
October 27th, 2007 at 8:40 pm
Mine is probably quite strange to a lot of people; ls isn’t even on the list because I have my shell (zsh) set up to automatically run “ls” after every “cd”. So I don’t end up typing “ls” unless I want to do something odd, like sort by size.
1 328 32.4111% python
2 204 20.1581% vi
3 150 14.8221% less
4 67 6.62055% cd
5 39 3.85375% cp
6 26 2.56917% grep
7 24 2.37154% sudo
8 17 1.67984% cat
9 9 0.896414% wc
10 8 0.795229% find
You might also be able to tell that I do a lot of Python development. :)
October 28th, 2007 at 4:58 am
1 222 44.4% sudo
2 48 9.6% ping
3 43 8.6% cd
4 20 4% dir
5 17 3.4% audacious
6 12 2.4% compiz
7 10 2% killall
8 8 1.6% make
9 7 1.4% wget
10 6 1.2% opera
October 28th, 2007 at 10:46 am
1 99 19.8% cd
2 95 19% ls
3 30 6% less
4 23 4.6% sudo
5 22 4.4% vim
6 17 3.4% exit
7 16 3.2% man
8 15 3% df
9 13 2.6% fg
10 10 2% mv
Nice. I just realize I should simply type ‘vi’ instead of ‘vim’. And you can tell who worrying about the disk space recently. ;-)
October 28th, 2007 at 5:52 pm
1 275 27.5% ssh
2 99 9.9% sudo
3 61 6.1% ping
4 55 5.5% cd
5 50 5% ls
6 43 4.3% host
7 24 2.4% less
8 21 2.1% wget
9 20 2% route
10 20 2% cat
October 30th, 2007 at 10:48 am
[…] 转载 & 修改自:https://linux.byexamples.com/archives/332/what-is-your-10-common-linux-commands/ […]
November 3rd, 2007 at 8:32 pm
so what do you to get this output? I’m dying to find out what my results will be.
November 3rd, 2007 at 10:22 pm
Did you even read the article blackbelt_jones? It’s the command right under: The idea is simple, we gather info from history, lets look at the command combo’s now.
November 4th, 2007 at 2:25 am
No, I didn’t read the article, sorry, but if there’s a link up there somewhere, it’s real easy to miss.
November 4th, 2007 at 2:27 am
oooooooh, there it is. Thanks.
November 4th, 2007 at 2:29 am
1 36 25.7143% sudo
2 24 17.1429% ls
3 21 15% cd
4 12 8.57143% startx
5 10 7.14286% mplayer
6 6 4.28571% emacs
7 5 3.57143% cp
8 4 2.85714% date
9 2 1.42857% su
10 2 1.42857% man
November 12th, 2007 at 9:34 am
1 101 20.2811% cd
2 85 17.0683% ls
3 57 11.4458% sudo
4 28 5.62249% javac
5 27 5.42169% java
6 22 4.41767% mencoder
7 15 3.01205% make
8 13 2.61044% wine
9 11 2.20884% svn
10 10 2.00803% md5sum
Yeah, I do a lot of Java programming in the command line
November 15th, 2007 at 10:47 am
1 42 19.4444% cd
2 37 17.1296% ls
3 32 14.8148% sudo
4 18 8.33333% rm
5 12 5.55556% mplayer
6 7 3.24074% mv
7 6 2.77778% cat
8 5 2.31481% df
9 5 2.31481% clear
10 4 1.85185% man
Currently watching too much anime. Need a lot of space for that
November 18th, 2007 at 7:32 pm
In a recently installed debian:
1 93 25.4098% cd
2 86 23.4973% ls
3 28 7.65027% su
4 18 4.91803% sudo
5 15 4.09836% exit
6 12 3.27869% cat
7 10 2.73224% make
8 10 2.73224% gksudo
9 9 2.45902% ping
10 7 1.91257% traceroute
January 6th, 2008 at 2:22 pm
1 395 39.5% ls
2 110 11% cd
3 50 5% vim
4 44 4.4% ll
5 40 4% exit
6 30 3% view
7 29 2.9% clear
8 20 2% su
9 20 2% ps
10 19 1.9% echo
January 10th, 2008 at 7:34 pm
I am an entry level C programmer. Therefore the gcc command is very much in use at the moment.
1 110 22% gcc
2 64 12.8% cd
3 56 11.2% ls
4 50 10% emacs
5 18 3.6% make
6 14 2.8% sudo
7 12 2.4% exit
8 11 2.2% mv
9 9 1.8% fisygradis
10 6 1.2% ftp
January 26th, 2008 at 6:40 am
basicly i use my laptop for everything…programming admining my server blogs mail everything so here is my list
1 134 26.8% sudo
2 47 9.4% exit
3 36 7.2% ssh
4 28 5.6% vi
5 19 3.8% mutt
6 19 3.8% ls
7 17 3.4% startx
8 17 3.4% cd
9 13 2.6% screen
10 13 2.6% mplayer
startx is there because i prefere to not have some kind of login manager but rather login and start it i just think it makes it easyer
February 20th, 2008 at 5:46 am
Interesting, thanks ;)
Recently installed Debian Etch as a server test field (as root) :
1 50 23.1481% vim
2 30 13.8889% ls
3 25 11.5741% apt-get
4 13 6.01852% ifconfig
5 9 4.16667% mount
6 9 4.16667% aptitude
7 7 3.24074% cp
8 6 2.77778% mkdir
9 6 2.77778% chmod
10 5 2.31481% exit
Mandriva personnal desktop (also as root) :
1 115 11,5% urpmi
2 76 7,6% vim
3 62 6,2% urpmq
4 60 6% mount
5 48 4,8% e2fsck
6 46 4,6% service
7 46 4,6% exit
8 42 4,2% umount
9 42 4,2% ls
10 37 3,7% tail
urpmi is to install while urpmq is to search anything about any package
mount/umount coz’ I sometime like to mount external devices by hand
e2fsck as a result after lots of issue with removable devices (eSata Sata2 & IDE HDDs) that causes freezes untill I shifted from Sata2 to IDE setting in the Bios (Asrock Dual s939)
service might be for activating/deactivating of the display manager
March 1st, 2008 at 12:22 pm
Nice little script. Here’s mine
1 105 21% l
2 60 12% cd
3 57 11.4% sudo
4 32 6.4% rm
5 21 4.2% ..
6 19 3.8% ssh
7 19 3.8% la
8 16 3.2% ping
9 14 2.8% emacs
10 10 2% ps
These are aliases:
l = ls
la = ls -la
.. = cd ..
August 19th, 2008 at 1:18 pm
1 747 37.35% w
2 381 19.05% tail
3 97 4.85% mailq
4 84 4.2% iftop
5 76 3.8% df
6 75 3.75% dmesg
7 61 3.05% netstat
8 50 2.5% cd
9 46 2.3% screen
10 45 2.25% mc
January 26th, 2009 at 1:37 am
1 94 18.8% gcc
2 47 9.4% man
3 25 5% sudo
4 25 5% ls
5 22 4.4% watch
6 21 4.2% vi
7 21 4.2% grep
8 20 4% ps
9 19 3.8% cd
10 9 1.8% find
with watch i am monitoring my system like:
watch -n 5 netstat -l
watch -n 5 netstat -nl
watch -n 5 netstat -plantu
Nice blog ;). Keep it up!
April 14th, 2009 at 11:50 pm
Its awesome :)
Mine is as follows (in professional offshore linux machine — Red Hat on VMWare).
1 399 39.9% ls
2 187 18.7% cd
3 59 5.9% java
4 58 5.8% javac
5 43 4.3% rm
6 31 3.1% vi
7 22 2.2% mv
8 20 2% chmod
9 17 1.7% jar
10 17 1.7% cp
Cheers!!!
April 17th, 2009 at 7:52 pm
To run properly on Arch linux need a very small modification of the command
history | awk ‘{CMD[$4]++;count++;}END { for (a in CMD)print CMD[a] ” ” CMD[a]/count*100 “% ” a;}’ | grep -v “./” | column -c3 -s ” ” -t | sort -nr | nl | head -n10
1 121 16.759% git
2 64 8.86427% ls
3 63 8.72576% sudo
4 47 6.5097% emacs
5 46 6.37119% vim
6 34 4.70914% cat
7 30 4.15512% less
8 27 3.73961% yu
9 23 3.1856% echo
10 22 3.04709% ys
April 17th, 2009 at 8:58 pm
Thanks OP for the simple analysis/opportunity to share and compare!
I ran it in my cygwin bash shell:
1 80 16% cd
2 62 12.4% ls
3 62 12.4% ll
4 48 9.6% cvs
5 32 6.4% rm
6 18 3.6% less
7 17 3.4% ssh-add
8 16 3.2% screen
9 16 3.2% pskill
10 15 3% cvsfwd
I spend about half of my commandline time in a 4NT window, and I’ve got a huge cmd history saved up from that. I’m going to have to figure out an equivalent procedure to analyze the frequency of the commands I run in that shell. I’ll post here if I ever actually get around to it.
May 11th, 2009 at 1:57 pm
reply 1
May 11th, 2009 at 2:01 pm
newone reply 1
July 19th, 2009 at 11:22 pm
Mine is here:
1 114 22.8% vim
2 74 14.8% gcc
3 55 11% cd
4 27 5.4% exit
5 25 5% sudo
6 17 3.4% chmod
7 17 3.4% cat
8 12 2.4% python
9 10 2% ls
10 10 2% g++
March 11th, 2011 at 6:09 pm
rua vietnam
July 26th, 2011 at 5:23 pm
Hey that looks awesome
October 31st, 2011 at 2:13 pm
Hello, Hi, Hey, great article, post, blog, I, we love, like, loved, liked it !!!
August 28th, 2012 at 12:00 am
[…] I just saw this post on https://linux.byexamples.com/ […]
March 21st, 2013 at 8:18 pm
Great command. Lets see what we have at office box:
1 190 18.8492% ls
2 182 18.0556% sudo
3 157 15.5754% cd
4 64 6.34921% vim
5 39 3.86905% ssh
6 25 2.48016% rm
7 16 1.5873% cat
8 15 1.4881% yes
9 13 1.28968% tmux
10 13 1.28968% scp
March 29th, 2014 at 6:51 am
[…] might be a good idea to search your history for your most commonly used commands. A one-liner from here allows us to see our most used […]
July 4th, 2014 at 10:01 am
This paragraph is actually a fastidious one it helps new net visitors, who
are wishing for blogging.
July 9th, 2014 at 3:51 pm
If you are going for finest contents like myself, simply visit this site daily as
it offers quality contents, thanks
August 16th, 2014 at 7:05 pm
Thwre is definately a great deal to find out about this issue.
I love all of the points you have made.
September 28th, 2014 at 1:44 am
[…] (source) […]
October 12th, 2014 at 12:52 pm
Hello to all, it’s truly a fastidious for me to go to see this web site,
it contains useful Information.
November 14th, 2014 at 7:48 pm
[…] might be a good idea to search your history for your most commonly used commands. A one-liner from here allows us to see our most used […]
February 11th, 2015 at 10:14 am
[…] this is modified from what is your 10 common linux commands? » Linux by Example and I changed it to expand command that starts with […]
May 24th, 2015 at 5:15 pm
Great blog you’ve got here.. It’s hard to find quality writing like yours these days.
I seriously appreciate individuals like you! Take care!!
April 24th, 2016 at 6:25 pm
[…] might be a good idea to search your history for your most commonly used commands. A one-liner from here allows us to see our most used […]
September 26th, 2016 at 3:11 am
not trying to bring this post back to life but I notice that when I try to make this an executable file it doesnt work. anyone know why? new to linux here
November 27th, 2016 at 10:54 pm
[…] might be a good idea to search your history for your most commonly used commands. A one-liner from here allows us to see our most used […]
May 18th, 2017 at 6:33 pm
[…] might be a good idea to search your history for your most commonly used commands. A one-liner from here allows us to see our most used […]
June 12th, 2017 at 2:06 pm
Hi, Very good article.Thanks for sharing useful tips. Provided exact and very useful information about the Linux command.
Regards,
Linux Online Training