How to get a list of most used terminal commands

There are a bunch of terminal commands to be used everyday. But I just want to have a rough impression which are most used?

How to get the list of the commands?

My solution is as below:

history | awk '{$1="";print}' - | sort | uniq -c | sort -r > all_terminal_commands_history.txt

This roughly means that get the commands history, print all columns except first one, sort, count, descendent sort and send the result into a file.

The result of the file likes below:

1124  git status
 400  ll
 367  git log --oneline
 204  task
 154  git log
 141  pwd
 137  git branch
 126  ..
 116  git push
 102  git remote -v
  81  git add .
  61  git branch -r
  57  j terminal
  55  git checkout master
  54  git checkout main

References

Sort and count number of occurrence of lines - Unix & Linux Stack Exchange
How to print all columns except first column in Linux bash shell ? | New Generation Enterprise Linux

本作品采用《CC 协议》,转载必须注明作者和本文链接
日拱一卒
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!
未填写
文章
93
粉丝
85
喜欢
153
收藏
121
排名:71
访问:11.4 万
私信
所有博文
社区赞助商