使用頻度の高いコマンドを表示する

#!/bin/sh
#cmd_best10.sh

H_FILE="$HOME/.bash_history"

if [ ! -f "${H_FILE}" ]; then
    echo " Command history does not exist."
    exit 1
fi

cat "${H_FILE}" \
    | awk '{print $1}' \
    | sort -f \
    | uniq -c \
    | sort -nr \
    | head -10

unset H_FILE
$ ./cmd_best10.sh 
     97 ls
     60 vi
     55 cd
     26 .
     22 convert_size
     14 echo
     11 ./str_special.sh
     10 ./str_replace.sh
     10 ./DirCmp.sh
      7 rm