Note: history displays like this for me
20622 2023-02-18 16:41:23 ls
I don't know if that's because I set HISTTIMEFORMAT='%F %T ' in .bashrc, or if it's like that for everyone.
If it's different for you change -f 5 to target the command. Use -f 5-7 to include flags and arguments.
My top 5 (since last install)
2002 ls
1296 cd
455 hx
427 g
316 find
g is an alias for gitui. When I include flags and arguments most of the top commands are aliases, often shortcuts to a project directory.
Not to ramble, but after doing this I figured I should alias the longest, most-used commands (even aliasing ls to l could have saved 2002 keystrokes :P) So I wrote another one-liner to check for available single characters to alias with:
for c in a b c d e f g h i j k l m n o p q r s t u v w x y z; do [[ ! $(command -v $c) ]] && echo $c; done
In .bash_aliases I've added alias b='hx ${HOME}/.bash_aliases' to quickly edit aliases and alias r='source ${HOME}/.bashrc' to reload them.
Yup! Migrated from VSCodium; wanted to learn a modal editor but didn't have the time or confidence to configure vim or neovim. It's been my go-to editor for 2+ years now.
I've been using vi (just the basics) for ~4 years, I don't think I could be arsed to pick up the keybindings the other way around lol. I've heard very good things about Helix, of course
speaking of saving keystrokes, the initial sort is entirely redundant. I'm guessing you orignally tried to do something like sort -u before realizing that sort couldn't count occurences, but uniq can. Anyway, understandable, have a nice day!