Last active
April 23, 2021 19:44
-
-
Save Adobe-Android/848dfec18152f4969b8d3a855e55b67b to your computer and use it in GitHub Desktop.
A simple way to check your most frequently used Linux commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Reads from specified shell history file. | |
HISTFILE=~/.bash_history | |
# Enable history. Disabled by default in a non-interactive shell (e.g. scripts like this). | |
# Uses awk to get just the command name from shell history, sorts list by command name, filters out non-unique data, sorts by frequency, grabs top 5. | |
set -o history | |
history | awk '{print $2}' | sort | uniq -c | sort -nr | head -5 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/fish | |
# Uses awk to get just the command name from shell history, sorts list by command name, filters out non-unique data, sorts by frequency, grabs top 5. | |
history | awk '{print $1}' | sort | uniq -c | sort -nr | head -5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment