How to get the top most used CLI apps ?
I am trying to have information about my usage of tools, programs, apps, .. as I am preparing myself to upgrade from Ubuntu 24.04.3 LTS to Ubuntu 26.04 LTS once it lands in the near future. I already wrote about what I do after installing Ubuntu as a SWE .
Almost all what I will do can be done on macOS and Ubuntu Linux (and all other Linux distributions), because I will focus on Fish shell.
I am a curious programmer. I often research and analyze workflows and statistics and patterns for insights and meaning. I once compared GUI vs. CLI and now I prefer CLI. After I learned Go language, I tend to use it more often. But people on X (Twitter) always yelling “Rust is better”. I got curious and researched the realworld data to know if Go is used in production more than Rust or not .
Let’s reseach my history of commands in Fish shell!
list all commands I historically ran ๐
I can list the whole history of commands I entered in Fish shell via:
history
filter the list of commands ๐
I can filter the history to only show commands that start with “sudo” using grep:
history | grep "^sudo*"
But history program has this as a native functionality via a flag. Let’s use it!
history --prefix "sudo"
But what if I want to list all the commands that contain a specific program, not just starts with it?
history has a flag that do that too:
history --contains "find"
sort the list of history commands ๐
But I want to sort these listed commands to have similar ones below each other. So, I can pipe those listed commands into sort program like this.
history --contains "find" | sort
save the list of commands ๐
I want to save these sorted list of commands that contain (prefix/start with) ‘find’ into a plain text file. So, we’ll use command line redirection via > (replace contents of a file with it) or >> (append to the end of a file).
I prefer using >> when outputing into a file to avoid accidentally replace the whole text saved previously in the file.
The command will be like this:
history --contains "find" | sort >> find.txt
I can do the same thing with tesseract:
history --contains "tesseract" | sort >> tesseract.txt
The command will list all history commands that contain ’tesseract’ then sort them alphabetically, then direct the output to append at the end of this text file tesseract.txt. The plain text file will be created if it does not exist.
I can have all commands that starts with a specific program, or contains a specific program (or word), but what about have the top 50 uniq commands of the whole history?
Top 50 most used commands ๐
I can list history, pipe it into awk to print only the first 3 columns (words), then pipe it to sort, then make sure it is uniq and counted, then re-sort it by the counts, then get the first 50 lines/commands only.
Here is the commands and the output on my laptop:
$ history | awk '{print $1 " " $2 " " $3 }' | sort | uniq -c | sort -nr | head -50
356 sudo apt install
155 git commit -m
100 sudo apt info
78 go run .
76 history | grep
64 apt search --names-only
54 sudo apt remove
50 sudo snap install
46 git clone --depth
45 sudo apt search
41 history | awk
35 sudo snap info
34 eza -l --color=always
32 sudo snap remove
32 ping -q -c
32 git remote add
29 gitp "content: +
25 gitp "build: upgrade
23 gitp "feature: +
22 gitp "docs: +
21 find . -name
21 du -hd 1
20 gitc "docs: +
19 sudo systemctl status
19 sudo rm -r
19 sudo apt-get install
18 pnpx @tailwindcss/cli -i
18 apt list --installed
17 sudo snap connect
17 sudo apt upgrade
16 grep -rnw .
16 go build -o
15 go mod init
15 gitp "ui: +
15 find ~ -name
15 docker run --rm
14 sudo systemctl restart
14 gitp "ui: show
13 sudo chown -R
13 sudo apt update
13 gitp "refactor: use
13 gitp "refactor: remove
13 gitc "feature: support
12 sudo snap refresh
12 sudo apt list
12 git config --global
12 ffmpeg -i Screencast\
11 sudo snap search
11 go run main.go
11 go mod tidy
deciphering what these 50 commands mean ๐
So, I can conclude that I mostly use:
apt (system package manager)
- to install programs/packages:
sudo apt install vim - to show information/details about a package:
sudo apt info vim - to search for a package:
apt search --names-only "vim"orsudo apt search "vim" - to remove/uninstall a program/package:
sudo apt remove vim - to list all installed programs/packages:
apt list --installed - to upgrade a program
sudo apt upgrade google-chrome-stable - to update local index (indeces):
sudo apt update sudo apt list
- to install programs/packages:
git (source version control)
git commit -m "docs: blah blah"git clone --depth 1 --recursive -b main https://github.com/abanoubha/UbuntuSetup.gitgit remote add origin https://github.com/abanoubha/UbuntuSetup.gitgit config --global pull.rebase false
gitp (a git wrapper function I wrote in Fish)
gitp "feature: chat system"gitp "build: upgrade libs"gitp "content: + post"gitp "docs: + commands"gitp "ui: + CTA at the bottom"gitp "refactor: use x instead of y"
gitc (a git wrapper function I wrote in Fish)
gitc "docs: + cmds"gitc "feature: support Arabic language in UI as display language"
Go (programming language)
- run the program from inside the project:
go run . - build executable program:
go build -o main ./...orgo build -o main .orgo build -o prog . - initialize Go project:
go mod init github.com/abanoubha/timetracker - run a specific file:
go run main.go - get and update libraries/dependencies:
go mod tidy
- run the program from inside the project:
history (list of all commands executed)
history | grep "^sudo*"history | awk '{print $1 " " $2}' | sort | uniq -c | sort -nr | head -50
grep
grep -rnw . -e "@AndroidEntryPoint"
snap (universal system package manager by Canonical)
- install a program:
sudo snap install nvim - show information about a program:
sudo snap info nvim - remove/uninstall a program:
sudo snap remove nvim - connect snaps:
sudo snap connect obs-studio:removable-media - upgrade all snap packages/programs:
sudo snap refresh - search for snap packages/programs:
sudo snap search vim
- install a program:
eza
eza -l --color=always --group-directories-first
ping
ping -q -c 12 google.com
find
find . -name "*kitty*" 2> /dev/nullfind ~ -name "*resolve*" 2> /dev/null
du
du -hd 1 2> /dev/null | sort -hr
systemctl
sudo systemctl status tailscaledsudo systemctl restart tailscaled
rm
sudo rm -r ~/blah
apt-get
sudo apt-get install vim
pnpx
pnpx @tailwindcss/cli -i ./src/input.css -o ./public/style.css --minify
docker
docker run --rm -p 7860:7860 dia-cpu
chown
sudo chown -R $USER:$USER ~/sampleDir
ffmpeg
ffmpeg -i Screencast\ from\ 2025-06-08\ 03-32-34.webm -vf "scale=iw*4:ih*4" card-color-themes-4x.webm
I hope you enjoyed reading this post as much as I enjoyed writing it. If you know a person who can benefit from this information, send them a link of this post. If you want to get notified about new posts, follow me on YouTube , Twitter (x) , LinkedIn , and GitHub .