Live data from Hacker News

Show HN: Unix tool that visualizes shell commands usage

github.com

11–20 of 25 posts

Re: Show HN: Unix tool that visualizes shell commands usage

#11
Pretty cool terminal visualizations, but tbh straight unix tools allow you to do this (might be different than 4th column for you depending on history format):

`history | awk '{print $4}' | sort | uniq -c | sort`

      56 tree
      58 make
      59 youtube-dl
      69 cmake
      71 which
      76 docker
      78 scala
      80 drive
      80 wget
      96 curl
      99 head
     102 echo
     105 pip
     114 scp
     119 ssh
     131 open
     135 conda
     135 kubectl
     141 man
     181 sudo
     298 mkdir
     350 grep
     378 ls
     409 find
     415 mv
     544 cp
     553 python
     568 brew
     601 cat
     674 rm
    1928 vim
    1972 cd
    2845 git

Also, I'm noticing this won't catch anything in pipes otherwise I'd expect to see less and xargs pretty high up.

Re: Show HN: Unix tool that visualizes shell commands usage

#12

Pretty cool terminal visualizations, but tbh straight unix tools allow you to do this (might be different than 4th column for you depending on history format): `history | awk '{print $4}' | sort | uniq -c | sort` 56 tree 58 make 59 youtube-dl 69 cmake 71 which 76 docker 78 scala 80 drive 80 wget 96 curl 99 head 102 echo 105 pip 114 scp 119 ssh 131 open 135 conda 135 kubectl 141 man 181 sudo 298 mkdir 350 grep 378 ls…

Add -n to the second sort to actually get a numerically (as opposed to lexically) sorted list. Also, here (using bash on linux) awk needs $2 instead of $4.

It doesn't catch the pipes, because you are parsing the command lines as entered, and you filter for a single parameter from each.

Re: Show HN: Unix tool that visualizes shell commands usage

#13
post #10

If one of your top commands is `clear`, you may like my alias `c`: $ alias c='clear &&' $ # Usage: $ c git status [1]: https://github.com/grantzvolsky/skel/blob/ea43b1969463a97f96...

If you use bash (or zsh, and maybe others), hit ^L (control-L) to clear the screen. From the bash(1) manual: clear-screen (C-l) Clear the screen leaving the current line at the top of the screen. With an argument, refresh the current line without clearing the screen.

I must hit ctrl-l a thousand times a day, learned it before I knew of clear.

Re: Show HN: Unix tool that visualizes shell commands usage

#14
post #8

If one of your top commands is `clear`, you may like my alias `c`: $ alias c='clear &&' $ # Usage: $ c git status [1]: https://github.com/grantzvolsky/skel/blob/ea43b1969463a97f96...

If one of your top commands is `cd ../..` you may like my alias/function `..` $ .. 2 # go back 2 directories, i.e. 'cd ../..' $ .. # 'cd ..' https://github.com/Aperocky/unix-setup/blob/master/.bashrc#L...

I use '..' for '$ cd ..' and '...' for '$ cd ../..'.

Re: Show HN: Unix tool that visualizes shell commands usage

#15
post #14
post #8

Earlier quoted context omitted.

If one of your top commands is `cd ../..` you may like my alias/function `..` $ .. 2 # go back 2 directories, i.e. 'cd ../..' $ .. # 'cd ..' https://github.com/Aperocky/unix-setup/blob/master/.bashrc#L...

I use '..' for '$ cd ..' and '...' for '$ cd ../..'.

I like '$ .. 5' because after the number goes up the dots become very hard to count.

Re: Show HN: Unix tool that visualizes shell commands usage

#17

If one of your top commands is `clear`, you may like my alias `c`: $ alias c='clear &&' $ # Usage: $ c git status [1]: https://github.com/grantzvolsky/skel/blob/ea43b1969463a97f96...

I clear the screen a lot, but I use Cmd+K to clear the whole Terminal.app screen or Cmd+L to clear the last command (and its output) on Mac, rather than using the `clear` command. I use Bash, not sure if it works on other terminal emulators.

Re: Show HN: Unix tool that visualizes shell commands usage

#18
post #8

If one of your top commands is `clear`, you may like my alias `c`: $ alias c='clear &&' $ # Usage: $ c git status [1]: https://github.com/grantzvolsky/skel/blob/ea43b1969463a97f96...

If one of your top commands is `cd ../..` you may like my alias/function `..` $ .. 2 # go back 2 directories, i.e. 'cd ../..' $ .. # 'cd ..' https://github.com/Aperocky/unix-setup/blob/master/.bashrc#L...

Going to my home dir is another frequent operation for me so I also have

  alias ~='pushd ~'
(Those are tildes but may look like dashes depending on your font and size...)

Not as fancy as some other aliases I see here but does the (basic) trick.

Re: Show HN: Unix tool that visualizes shell commands usage

#19

Pretty cool terminal visualizations, but tbh straight unix tools allow you to do this (might be different than 4th column for you depending on history format): `history | awk '{print $4}' | sort | uniq -c | sort` 56 tree 58 make 59 youtube-dl 69 cmake 71 which 76 docker 78 scala 80 drive 80 wget 96 curl 99 head 102 echo 105 pip 114 scp 119 ssh 131 open 135 conda 135 kubectl 141 man 181 sudo 298 mkdir 350 grep 378 ls…

Interesting command usage. One tip I'd offer is to use a `trash` command instead of `rm`. Unix doesn't usually offer it, but installing is as simple as `apt install trash-cli`.

You've gotten lucky 674 times by not `rm`-ing the wrong thing.

Re: Show HN: Unix tool that visualizes shell commands usage

#20
post #8

Earlier quoted context omitted.

If one of your top commands is `cd ../..` you may like my alias/function `..` $ .. 2 # go back 2 directories, i.e. 'cd ../..' $ .. # 'cd ..' https://github.com/Aperocky/unix-setup/blob/master/.bashrc#L...

Going to my home dir is another frequent operation for me so I also have alias ~='pushd ~' (Those are tildes but may look like dashes depending on your font and size...) Not as fancy as some other aliases I see here but does the (basic) trick.

A raw "cd" with no arguments will take you back to your home-directory. Of course "~" is one less character to type, but on the off-chance you didn't know.
Post reply on HN