My top 10 commands
──────────────────────────────────────────────────────────────────────
“Show me what you type and I'll tell you who you are„

This week, my shell command history hit 10000 lines ! To celebrate, I 
decided to check what are the 10 commands I use the most:

    $ history|awk '{print $2}'|sort|uniq -c|sort -rn|head -n 10
    1550 v
    1492 ll
    870 make
    787 cd
    503 git
    426 pwd
    372 fg
    245 ssh
    206 doas
    192 man

1. v (alias « vis »)

Fortunately, I was smart enough to alias my most used command to a 
single letter ! "v" is an alias for "vis", my text editor of choice. I 
use my computer mostly for programming, and editing server configs, and 
the fact my editor is the first command of the list proves it ! Nothing 
really interesting here after all...

2. ll (alias « ls -l »)

If I could only have a single-key keyboard, then I'll pick the « L » 
as the only letter. I call this one my stress-ball. Whenever I think or 
need to relieve stress, I type « LL <enter> », immediately followed 
by « <control> L » to clear the screen, so I can run « LL » again.

3. make

Now this is getting interesting ! Do I do this much C programming that 
I use « make » so often ? Actually no. I use « make » for another 
purpose: server configuration. I own multiple servers online, and 
configure them with drist [0], which is similar to ansible. To simplify 
the configuration deployment, I use a Makefile, so I just need to type 
« make » to reconfigure  a server. Everytime I change a config file, 
add a DNS name, or username, I run « make » to apply my changes, 
which is why I run it so often.

I also build a lot of C programs too, but configuration management is 
certainly my main usage these days.

4. cd

There is one thing that frustrate me when I look at other people using 
a terminal :

    cd /var
    cd log
    less messages

When people do that, I want to take the keyboard away from them, and 
beat them up with the keyboard !!
Ok I'm weird. But seriously, I hate monkeying around in my filesystem. 
If I want to read the logs, I'll just

    less /var/log/messages

It works, it's elegant, it makes « cd » only appear 4th in you 
command history rather than first 😉

5. git

Well, I didn't know I used git that much. It shouldn't surprise me 
though, because I constantly search new cool projects to try, and git 
clone them.
Another big use I have for git, is updating my port tree, as I run the 
crux distro [1], with a lot of git based ports.

6. pwd

I get lost quite often in all these gigabytes !

7. fg (and its friend ^Z)

This is certainly the most idiomatic command of my programming 
workflow. I mostly write shell scripts and C programs, which I 
test/build manually at the shell prompt. I could use a terminal 
multiplexer, but I like having a single place to focus my attention on. 
A typical programming session would look like this:

    v file.c   # see command number 1 
    ^Z
    make
    [...] outpout omitted
    fg
    ^Z
    make
    ./file
    git add file.c; git commit -m "WOW it works !"
    fg
    man 3 gethostbyname
    ^Z
    fg %1
    ^Z
    fg %2
    ...

I put my editor to the foreground all the time. Even though it has 
support for splitting windows, I run it multiple times when editing 
multiple files, and play with job ids to call them back. It might sound 
slow, but I'm really used to it and feel like I'm pretty efficient. I 
must admit that sometimes when I'm tired, I might end up with the same 
file opened 3 times in 3 different jobs... This is usually a good sign 
that I need some sleep ! 

8. ssh

What would be life without exploration ?

I use it mostly to administer my servers, or connect to my IRC session, 
which is hosted on one of these servers. Nothing fancy here.

9. doas

This is the OpenBSD equivalent to « sudo ». Since I reinstalled all 
my servers to OpenBSD, I started using « doas » to administer them (I 
never log in as root). I got so used to it, that I started typng « 
doas » instead of « sudo » on my own machine. And as crux doesn't 
come with « sudo » installed by default, I eventually replaced it 
with « doas ». The same phenomena is happening with « rcctl » vs. 
« systemctl » on my work laptop. I might add an alias someday !

10. man

To be honest, I'm proud to see it in this list. I love man pages, and 
prefer them over stackoverflow answers. With OpenBSD, I learnt to use 
them more, and took the habit to read the manual instead of searching 
the internet. This helped me a lot when programming in planes or 
trains, where you must work offline. I'm proud to finally have a proof  
that I RTFM !




What started as a bored question ended up in a good introspection of my 
terminal habits. This was a funny exercise, and I would recommend it to 
everyone that uses a terminal often.

Now what are YOUR top 10 commands ? 
--  
~wgs

[0]: gopher://phlog.z3bra.org/0/configuration-management.txt
[1]: https://crux.nu

20201027.2336