DEV Community

What are the most used commands in your shell history?

Abhinav Kumar on July 04, 2018

Recently I came across a thread on reddit which asked users the most used command in their shell history. My results: 1 419 13.0489% ...
Collapse
 
dmfay profile image
Dian Fay •
     1  179  17.9179%   git
     2  88   8.80881%   ls
     3  86   8.60861%   cd
     4  79   7.90791%   rm
     5  74   7.40741%   cat
     6  57   5.70571%   vi
     7  44   4.4044%    pacman
     8  37   3.7037%    mocha
     9  28   2.8028%    sudo
    10  25   2.5025%    tree

Outside the usual suspects, pacman is the Arch Linux package manager and mocha is a JavaScript test framework. I'm actually a little surprised the latter made the top 10.

Collapse
 
rhymes profile image
rhymes •

for a moment I thought you had a version of Pacman installed in the terminal

Collapse
 
dmfay profile image
Dian Fay •

I mean, it exists, but I was never any good at Pacman :D

a command-line implementation of the Pacman game

Thread Thread
 
rhymes profile image
rhymes •

ahhahaha me neither.

I'm more of a Space Invaders person.

Collapse
 
rhymes profile image
rhymes •
     1  355  35.5355%   git
     2  106  10.6106%   yarn
     3  48   4.8048%    pipenv
     4  28   2.8028%    brew
     5  26   2.6026%    rm
     6  25   2.5025%    zgrep
     7  25   2.5025%    cd
     8  22   2.2022%    curl
     9  19   1.9019%    pyenv
    10  18   1.8018%    redis-cli
Collapse
 
abhinav profile image
Abhinav Kumar •

How is pipenv working out for you? Is it comparable to yarn or cargo in your experience?

Collapse
 
rhymes profile image
rhymes • • Edited

I use pyenv (to have multiple Python versions installed) and pipenv a lot.

I don't know about cargo but pipenv is not that different from yarn. It has a file with the list of dependencies and a lock file. It tends to consume less resources than yarn because Python dependencies trees are usually much smaller than those of JS libraries.

Collapse
 
val_baca profile image
Valentin Baca •

No surprise here. git, cd, ls, vim, build, search

     1  3663  36.6337%   g
     2  938   9.38094%   cd
     3  534   5.34053%   igs        # inall git status (runs 'git status' in each dir in pwd)
     4  516   5.16052%   ..
     5  277   2.77028%   vim        # <3
     6  258   2.58026%   ls
     7  216   2.16022%   <redacted> # company build command, aliased to be 2 letters :)
     8  200   2.0002%    ws         # alias to cd to my workspace dir
     9  175   1.75018%   <redacted> # company workspace information command, aliased to be 2 letters
    10  167   1.67017%   ag         # the silver searcher > (grep or awk or find)
Collapse
 
abhinav profile image
Abhinav Kumar • • Edited

You might want to look into autojump or autojump-rs to quickly jump to your workspace directories.

Also, ripgrep is a competent (not drop-in though) alternative to ag/grep.

Collapse
 
val_baca profile image
Valentin Baca •

Thanks. I've found that autojump and the like are too non-determistic to be reliable.

ripgrep is missing two very critical features: -G (--file-search-regex) and the ability to grep gzip'd files. The ripgrep vim plugin is also sub-par to ag's.

ripgrep is certainly faster, but they're both so fast their difference is often in ms.

Collapse
 
simov profile image
simo •
     1  301  30.1%  g
     2  162  16.2%  cd
     3  105  10.5%  ll
     4  87   8.7%   npm
     5  43   4.3%   s
     6  32   3.2%   sudo
     7  30   3%     rm
     8  20   2%     node
     9  19   1.9%   mocha
    10  17   1.7%   nvm

g - git, s - sublime

Collapse
 
abhinav profile image
Abhinav Kumar •

Are you using self-defined aliases for git or the ones defined by a bash/zsh framework?

Collapse
 
simov profile image
simo •

I've manually added the following lines in my .bashrc file:

# git alias and autocomplete
alias g='git'
source /usr/share/bash-completion/completions/git
complete -o default -o nospace -F _git g
Collapse
 
igormp profile image
Igor Moura •
     1  997  12.7023%    exit
     2  992  12.6386%    git
     3  916  11.6703%    sudo
     4  295  3.75844%    ping
     5  266  3.38897%    cd
     6  261  3.32526%    yaourt
     7  212  2.70098%    ls
     8  138  1.75819%    startx
     9  126  1.6053%     cat
    10  110  1.40145%    qemu-system-x86_64

I honestly didn't expect qemu to be there lol

Collapse
 
nmcain profile image
Noah Cain •

     1  43  17.0635%   cd
     2  37  14.6825%   flutter
     3  31  12.3016%   ls
     4  27  10.7143%   git
     5  22  8.73016%   webdev
     6  14  5.55556%   nano
     7  11  4.36508%   sudo
     8  10  3.96825%   adb
     9  8   3.1746%    pub
    10  7   2.77778%   rm

Flutter, am I right?

Collapse
 
fynn_it profile image
Fynn •
     1  378  6.77784%    ga (git add .)
     2  358  6.41922%    gc (git commit -m)
     3  346  6.20405%    gulp
     4  319  5.71992%    ls
     5  292  5.23579%    gpll (git pull && echo ' --pulled -- ' && git push && echo ' --pushed -- ')
     6  232  4.15994%    gs (git status)
     7  202  3.62202%    npm
     8  182  3.2634%     ..
     9  178  3.19168%    git
    10 156  2.7972%     gpl (git pull)
Collapse
 
shreyasminocha profile image
Shreyas Minocha •
     1  1179  11.77%       git
     2  1119  11.171%      cd
     3  556   5.55056%     npm
     4  537   5.36089%     ls
     5  439   4.38255%     gstt
     6  362   3.61386%     rm
     7  311   3.10472%     mv
     8  242   2.41589%     sudo
     9  242   2.41589%     cat
    10  216   2.15633%     brew

Where gstt is my alias for git status

Collapse
 
tilman profile image
Til •

if the terminal is your IDE:

1   2749                             14.3633%    vim
2   2414                             12.613%     git
3   1808                             9.44668%    ll
4   1392                             7.27311%    curl
5   1154                             6.02957%    cd
6   1127                             5.8885%     node
7   469                              2.45049%    npm
8   262                              1.36893%    cat
9   245                              1.28011%    rm
10  232                              1.21218%    docker
Collapse
 
mjb2kmn profile image
MN Mark •
 1  169  33.8%  ssh
 2  58   11.6%  git
 3  45   9%     cd
 4  44   8.8%   ll
 5  26   5.2%   vim
 6  23   4.6%   dig
 7  22   4.4%   exit
 8  17   3.4%   vi
 9  15   3%     clear
10  8    1.6%   ping

I might be a software engineer by title, but really a sysadmin by necessity.
I didn't expect to see exit and clear so much but I suppose it makes sense with all the tmux panes being created and destroyed and my habit of clearing the screen when switching between tasks.

Collapse
 
abhinav profile image
Abhinav Kumar •

Ctrl+D and Ctrl+L?

Collapse
 
leojpod profile image
leojpod •
     1  536  20.727%     gcam
     2  312  12.065%     gco
     3  124  4.79505%    npm
     4  124  4.79505%    gc
     5  121  4.67904%    ga
     6  111  4.29234%    git
     7  105  4.06032%    elm
     8  97   3.75097%    rm
     9  75   2.90023%    docker-compose
    10  54   2.08817%    g

aka a bunch of git shortcuts, the infamouse npm for npm start on all my projects, yet more git stuff
number 11 is nvim with 51 :D

Collapse
 
tsia profile image
tsia •
     1  1073  10.73%  sudo
     2  852   8.52%   cd
     3  795   7.95%   ssh
     4  522   5.22%   dig
     5  455   4.55%   curl
     6  412   4.12%   vi
     7  368   3.68%   git
     8  304   3.04%   rm
     9  283   2.83%   ls
    10  249   2.49%   cat

I'm more of a sysadmin guy as you might have guessed by git being only on 7 :D

Collapse
 
vlasales profile image
Vlastimil Pospichal •
     1  117  12.4468%   ll
     2  113  12.0213%   xmllint
     3  92   9.78723%   vim
     4  45   4.78723%   php
     5  39   4.14894%   cd
     6  36   3.82979%   mv
     7  34   3.61702%   git
     8  28   2.97872%   cat
     9  27   2.87234%   docker
    10  24   2.55319%   mongo
Collapse
 
andy profile image
Andy Zhao (he/him) •
     1  137  27.4%  git
     2  50   10%    cd
     3  47   9.4%   ls
     4  43   8.6%   brew
     5  26   5.2%   br (bin/rails)
     6  24   4.8%   brg (bin/rails guard)
     7  13   2.6%   heroku
     8  12   2.4%   pg_upgrade
     9  12   2.4%   pg_restore
    10  11   2.2%   rm

Surprised that brew,pg_upgrade, and pg_restore are there. Wonder if it take your most recent commands from the previous week.

Collapse
 
ferricoxide profile image
Thomas H Jones II •

Probably depends on how your shell history is set up. Things like whether concurrent sessions are set up to aggregate history, whether session's shell-history is configured to save to disk at all, how large you've set your HISTSIZE, etc. will all play in.

Collapse
 
null_abe profile image
Antoine B. •
     1  350  32.3475%    sudo
     2  214  19.7782%    git
     3  89   8.22551%    cd
     4  62   5.73013%    docker
     5  41   3.78928%    rm
     6  25   2.31054%    docker-compose
     7  19   1.75601%    mkdir
     8  18   1.66359%    chmod
     9  15   1.38632%    vim
    10  15   1.38632%    tar

sudo won this

Collapse
 
nirebu profile image
Nicolò Rebughini •

On my main VM lots of DNS queries, talking to other machines and inline loops; and oh, some heavy ansible testing made its way to the top 10

     1  192  19.2%  dig
     2  153  15.3%  ssh
     3  107  10.7%  cd
     4  104  10.4%  sudo
     5  52   5.2%   rm
     6  50   5%     for
     7  46   4.6%   split
     8  44   4.4%   scp
     9  39   3.9%   ansible-playbook
    10  20   2%     ll
Collapse
 
ferricoxide profile image
Thomas H Jones II • • Edited

Depending on your distribution, the "only X number of lines of history are printed" is the default behavior. For bash and ksh, subbing fc -l 1 for history usually suffices.

Collapse
 
eddinn profile image
Edvin Dunaway • • Edited
 1  274  27.4%  ssh
 2  118  11.8%  ping
 3  56   5.6%   ls
 4  55   5.5%   vim
 5  52   5.2%   cd
 6  47   4.7%   cat
 7  46   4.6%   sudo
 8  38   3.8%   grep
 9  31   3.1%   find
10  24   2.4%   gf
11  21   2.1%   ll
12  21   2.1%   less
13  16   1.6%   gp
14  15   1.5%   rm
15  15   1.5%   la
16  15   1.5%   dnfd
17  11   1.1%   git
18  10   1%     cpp
19  9    0.9%   diff
20  8    0.8%   chmod

I mainly work via ssh, so my total commands differ there.

Collapse
 
c0il profile image
Vernet Loïc •

Git also wins for me. :) php would be second when combining php and sf.

 1  393  23.632%     git
 2  128  7.69693%    cd
 3  120  7.21587%    sf
 4  75   4.50992%    php
 5  54   3.24714%    rm
 6  54   3.24714%    kf.preprod3
 7  52   3.12688%    grep
 8  49   2.94648%    redis-cli
 9  46   2.76609%    composer
10  42   2.52556%    ping
  • sf is an alias for php app/console
  • kf.preprod3 is a ssh alias