LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (https://www.linuxquestions.org/questions/general-10/)
-   -   What's Your 20 Most Used Commands As normal user and root? (https://www.linuxquestions.org/questions/general-10/what%27s-your-20-most-used-commands-as-normal-user-and-root-4175579957/)

Ryan3 05-16-2016 03:33 PM

What's Your 20 Most Used Commands As normal user and root?
 
Code:

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 -n20
Code:

User:

    1  115  11.8191%  mplayer
    2  76  7.81089%  cat
    3  64  6.5776%    ffmpeg
    4  54  5.54985%  find
    5  52  5.3443%    bcwipe
    6  42  4.31655%  for
    7  41  4.21377%  cd
    8  32  3.2888%    axel
    9  30  3.08325%  youtube-dl
    10  29  2.98047%  rm
    11  27  2.77492%  nice
    12  25  2.56937%  ps
    13  25  2.56937%  ls
    14  22  2.26105%  rename
    15  20  2.0555%    display
    16  17  1.74717%  echo
    17  15  1.54162%  adb
    18  14  1.43885%  mv
    19  12  1.2333%    vi
    20  12  1.2333%    firefox

Root:

    1  107  10.7%  ls
    2  76  7.6%  exit
    3  52  5.2%  df
    4  50  5%    mount
    5  50  5%    cryptsetup
    6  41  4.1%  cd
    7  32  3.2%  vi
    8  30  3%    umount
    9  28  2.8%  rm
    10  26  2.6%  netstat
    11  25  2.5%  chmod
    12  24  2.4%  freshclam
    13  22  2.2%  fdisk
    14  16  1.6%  youtube-dl
    15  16  1.6%  echo
    16  16  1.6%  cp
    17  15  1.5%  tcpdump
    18  13  1.3%  rkhunter
    19  13  1.3%  find
    20  13  1.3%  bash

I found this command on the net.

Wells 05-16-2016 04:11 PM

Hrm... interesting...

At work, my normal user account looks like this...
Code:

    1  233  23.3%  ls
    2  179  17.9%  cd
    3  63  6.3%  git
    4  54  5.4%  module
    5  46  4.6%  ssh
    6  34  3.4%  rm
    7  24  2.4%  more
    8  22  2.2%  fg
    9  21  2.1%  emacs
    10  18  1.8%  i
    11  15  1.5%  sh
    12  14  1.4%  squeue
    13  12  1.2%  sbatch
    14  12  1.2%  r
    15  11  1.1%  lspci
    16  10  1%    firefox
    17  10  1%    cat
    18  9    0.9%  chmod
    19  8    0.8%  mv
    20  8    0.8%  mkdir

Actually, looking through that list, it isn't all that surprising. The 'i' and 'r' commands are aliases for an ssh and sudo command.

Ryan3 05-16-2016 04:52 PM

Quote:

Originally Posted by Wells (Post 5546447)
Actually, looking through that list, it isn't all that surprising. The 'i' and 'r' commands are aliases for an ssh and sudo command.

That's ok too. Aliases and shell scripts count as well.

I have an aliases called connect which connects me to my ssh server.

Myk267 05-16-2016 10:31 PM

Code:

user:
    1  229  9.81569%
    2  95  4.07201%    aptitude
    3  52  2.22889%    show
    4  52  2.22889%    -f
    5  51  2.18603%    apt
    6  42  1.80026%    search
    7  38  1.6288%    -Wall
    8  32  1.37162%    -e
    9  29  1.24303%    install
    10  24  1.02872%    -r
    11  23  0.985855%  apt-get
    12  17  0.728676%  new
    13  12  0.514359%  -v
    14  12  0.514359%  oh
    15  12  0.514359%  -h
    16  12  0.514359%  -bg
    17  11  0.471496%  clone
    18  11  0.471496%  -c
    19  10  0.428633%  vim
    20  10  0.428633%  -s

root:
    1  25  10.1215%  cat
    2  24  9.7166%    aptitude
    3  23  9.31174%  vi
    4  18  7.28745%  vim
    5  18  7.28745%  apt
    6  16  6.47773%  ls
    7  14  5.66802%  systemctl
    8  13  5.26316%  echo
    9  11  4.45344%  tlp
    10  11  4.45344%  cp
    11  7  2.83401%  l
    12  6  2.42915%  mv
    13  5  2.02429%  cd
    14  4  1.61943%  hdparm
    15  4  1.61943%  apt-get
    16  3  1.21457%  exit
    17  3  1.21457%  enable
    18  3  1.21457%  apt-key
    19  3  1.21457%  %
    20  2  0.809717%  wget

Looks like my root spends a lot of time uselessly using cat and can't decide between vi or vim. I've got a lot of faith in him.

What's the empty string from my user account?

Turbocapitalist 05-17-2016 01:07 AM

Interesting idea. The history for this one account does not go back too far, but it is this:

Code:

    1  180  14.1176%    ls
    2  169  13.2549%    cd
    3  82  6.43137%    echo
    4  63  4.94118%    man
    5  52  4.07843%    fg
    6  44  3.45098%    vi
    7  35  2.7451%    find
    8  34  2.66667%    ssh
    9  31  2.43137%    sed
    10  29  2.27451%    less
    11  25  1.96078%    cp
    12  22  1.72549%    echo;
    13  21  1.64706%    chmod
    14  20  1.56863%    rm
    15  20  1.56863%    qemu-system-x86_64
    16  19  1.4902%    eog
    17  17  1.33333%    stat
    18  17  1.33333%    mkdir
    19  15  1.17647%    evince
    20  15  1.17647%    date


hazel 05-17-2016 01:42 AM

As myself:
Code:

  1        303  30.3%  ls
    2        175  17.5%  cd
    3        59  5.9%  cat
    4        57  5.7%  exit
    5        47  4.7%  less
    6        41  4.1%  find
    7        29  2.9%  cdd
    8        25  2.5%  sudo
    9        22  2.2%  man
    10        21  2.1%  mv
    11        19  1.9%  rm
    12        18  1.8%  mount
    13        16  1.6%  dmesg|grep
    14        12  1.2%  grep
    15        9    0.9%  vim
    16        9    0.9%  ps
    17        8    0.8%  umount
    18        7    0.7%  xlinks2
    19        7    0.7%  rmdir
    20        6    0.6%  which

As root:
Code:

  1        96  19.2%  ls
    2        63  12.6%  cd
    3        37  7.4%  vboxmanage
    4        31  6.2%  rm
    5        25  5%    man
    6        20  4%    mount
    7        20  4%    less
    8        18  3.6%  vboxsdl
    9        13  2.6%  exit
    10        13  2.6%  cat
    11        10  2%    aplay
    12        9  1.8%  xl
    13        9  1.8%  umount
    14        9  1.8%  rmdir
    15        9  1.8%  ps
    16        8  1.6%  vim
    17        8  1.6%  systemctl
    18        8  1.6%  locate
    19        7  1.4%  mv
    20        7  1.4%  chown

The vbox stuff is Debian only and I'm not doing it any more. I'd get different results on my other distros.

cnamejj 05-17-2016 02:38 AM

I have an irrational dislike for long pipelines of commands that can be shortened with liberal use of "awk". Yes, I know it's ridiculous when taken to extremes. But I think learning just a little "awk" is well worth it to avoid running 6+ processes in a pipeline, possible with multiple "awk" calls, when 2 might work with a just a little more code added.

So here's a rework of that commandline that's just "history" and one "awk" for your amusement.

Code:

history | awk '{CMD[$2]++;count++;} END { spot=1; for (a in CMD) { apc=CMD[a]/count*100; if(apc>TOP[spot]) { TOP[spot]=apc; DESC[spot]=sprintf("%5d %5.2f%% %s", CMD[a], apc, a); for(ii=20;ii>=1;ii--) if(TOP[ii] < TOP[spot]) spot=ii } } for(ii=1; ii<=20; ii++) { spot=1; for(jj=1; jj<=20; jj++) if(TOP[jj]>TOP[spot]) spot=jj; printf "%2d %s\n", ii, DESC[spot]; TOP[spot]=0 } }'
I'm not saying is the right way to do it, but I do think the original was pretty awful.

And as long as I'm posting, here's what I got on my Ubuntu desktop.

Code:

1  160 16.00% ls
 2    77  7.70% cd
 3    59  5.90% find
 4    48  4.80% jove
 5    45  4.50% less
 6    38  3.80% ./scan-proc-net-tcp
 7    33  3.30% exec
 8    30  3.00% clear
 9    27  2.70% slogin
10    27  2.70% gconftool-2
11    26  2.60% netstat
12    24  2.40% gnome-terminal
13    19  1.90% cat
14    18  1.80% gsettings
15    18  1.80% ddate
16    17  1.70% man
17    17  1.70% pylint
18    16  1.60% grep
19    14  1.40% service
20    13  1.30% .

And yes, "." a command a use regularly to update environment variables in my shell.

Also, no idea why the original commandline was filtering out anything that started with "./". That seems odd to me. Yes, those are probably local scripts, but it's still interesting IMO.

Habitual 05-17-2016 06:24 AM

Person shows up and asks for your root and user top 10 bash commands?

No way. No how.
Code:

1        666  6.95253%    nacho
 2        666  6.95253%    nunya


rtmistler 05-17-2016 06:59 AM

It is so bad that my top command is sudo? :D

I cut the " | head -n20" off of that to find out how many commands it requires to fulfill 100% of my commands. Well ... I didn't add it up to validate that it was 100%, but the list ran out to 57 total commands.

Interesting, and "whatever". I figured that ls, cd, cat, vi, tar, and man would be some of my tops. Just didn't think that sudo and echo would also be there.

Glad to see that exit was up there though! Means I properly quit my terminal sessions, heh-heh!

jamison20000e 05-17-2016 07:01 AM

LOL, at home(\media:)
Code:

    1        33  40.2439%  sudo
    2        12  14.6341%  vlc
    3        6  7.31707%  ls
    4        6  7.31707%  cd
    5        2  2.43902%  uname
    6        2  2.43902%  su
    7        2  2.43902%  cal
    8        2  2.43902%  alsamixer
    9        1  1.21951%  The
    10        1  1.21951%  sud
    11        1  1.21951%  Stereophonics
    12        1  1.21951%  randomplay
    13        1  1.21951%  pwd
    14        1  1.21951%  Pink
    15        1  1.21951%  pactl
    16        1  1.21951%  man
    17        1  1.21951%  "less
    18        1  1.21951%  less
    19        1  1.21951%  inxi
    20        1  1.21951%  history

"Pink"? :scratch:
Code:

    1        8  57.1429%  apt-get
    2        2  14.2857%  reboot
    3        1  7.14286%  vi
    4        1  7.14286%  pactl
    5        1  7.14286%  history
    6        1  7.14286%  adduser

And my laptop I will post next...

Michael Uplawski 05-17-2016 07:07 AM

I do not keep a history.

1.) ls
2.) cd
(...)
i.) vi/gvim
(...)

The rest, I do not know.

jamison20000e 05-17-2016 07:12 AM

My laptop 75% of the time is this VM:
Code:

    1        73  27.037%    sudo
    2        40  14.8148%  conky
    3        17  6.2963%    xclip
    4        13  4.81481%  df
    5        12  4.44444%  find
    6        10  3.7037%    vlc
    7        10  3.7037%    top
    8        9  3.33333%  ls
    9        8  2.96296%  su
    10        7  2.59259%  vi
    11        7  2.59259%  man
    12        7  2.59259%  cat
    13        6  2.22222%  cal
    14        5  1.85185%  feh
    15        4  1.48148%  exit
    16        3  1.11111%  yeahconsole
    17        3  1.11111%  stalonetray
    18        3  1.11111%  cd
    19        2  0.740741%  wget
    20        2  0.740741%  kill

Code:

    1        1  100%  history
and when trying to save battery:
Code:

    1  99  22.8111%  sudo
    2  29  6.68203%  cd
    3  24  5.52995%  ls
    4  23  5.29954%  startx
    5  16  3.68664%  mplayer
    6  15  3.45622%  vi
    7  12  2.76498%  man
    8  12  2.76498%  exit
    9  9  2.07373%  su
    10  9  2.07373%  kill
    11  9  2.07373%  acpi
    12  8  1.84332%  conky
    13  7  1.6129%    wget
    14  7  1.6129%    top
    15  7  1.6129%    ratpoison
    16  7  1.6129%    clear
    17  7  1.6129%    alsamixer
    18  6  1.38249%  randomplay
    19  5  1.15207%  dolphin
    20  5  1.15207%  cal

Code:

    1  6  18.1818%  apt-get
    2  5  15.1515%  alsamixer
    3  4  12.1212%  exit
    4  4  12.1212%  acpi
    5  2  6.06061%  vi
    6  2  6.06061%  man
    7  2  6.06061%  ls
    8  2  6.06061%  cd
    9  1  3.0303%  y
    10  1  3.0303%  volname
    11  1  3.0303%  reboot
    12  1  3.0303%  history
    13  1  3.0303%  aptitude
    14  1  3.0303%  adduser

interesting, we can see what a great typist I am... :D

rtmistler 05-17-2016 07:13 AM

Quote:

Originally Posted by jamison20000e (Post 5546676)
"Pink"? :scratch:

Heh-heh! Had a few, but I knew what they were. It's a testament to how long my system has been running? Untrue because I rebooted yesterday as a matter of fact, so that's full of water. Either case, I know I haven't run some build scripts in years, but they showed up and in my top 20.

jamison20000e 05-17-2016 07:22 AM

;)

I was just coming back to post that, home has had the same install for years and the laptop a few months.

Wells 05-17-2016 08:56 AM

Quote:

Originally Posted by Habitual (Post 5546662)
Person shows up and asks for your root and user top 10 bash commands?

No way. No how.
Code:

1        666  6.95253%    nacho
 2        666  6.95253%    nunya


Meh. I looked at what kind of information was being given out, and it isn't a big deal. cd and ls are of course the big top two commands for just about everyone so far, and since any real information is stripped except for the command itself, self-identifying information is not there. Oooh... you know that I use emacs rather than vi... big whoop.


All times are GMT -5. The time now is 04:28 PM.