|
|
|
|
|
by ColinWright
4774 days ago
|
|
Quick hack - you can include the commands you pipe to with this: history \
| sed "s/^[0-9 ]*//" \
| sed "s/ *| */\n/g \
| awk '{print $1}' \
| sort \
| uniq -c \
| sort -rn \
| head -n 100 \
> commands.txt
I haven't tried to account for pipe symbols inside strings - it didn't seem work it.In case there are commands you want then to exclude (which I do) then you might want to "head -200", remove the commands you don't want to provide, and then trim to 100. Added in edit - having done this a good half of my top 100 are actually scripts, so this is pretty pointless for me unless I rummage through them to find the common commands. Added in edit again: OK, here's a version that only includes actual system commands, and hence filters out all my personal scripts and commands: history \
| sed "s/^[0-9 ]*//" \
| sed "s/ *| */\n/g" \
| awk '{print $1}' \
| xargs which \
| sed "s.^/usr.." \
| grep ^.bin \
| sed "s/^.*\///" \
| sort \
| uniq -c \
| sort -rn \
> commands.txt
|
|