What I do with my Shell

Lifehacker suggests the following command to list your most frequently used commands:

history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -r

The idea is to identify your frequent commands and then perhaps alias them to something shorter. Unix being what it is, of course, you’re unlikely to save many keystrokes unless you’re aliasing not just the command but also its arguments. Anyway, on my Mac, I get the following top 10 list:

  • ls: what’s here?
  • cd: go somewhere else.
  • open: Mac-specific; spawns a Finder window if the argument is a directory or spawns the appropriate viewer/editor for a graphics file, Word document, PDF file, etc. I love this command.
  • ssh: connect to another machine (sorry, elysium!).
  • mv: move something to a better place.
  • latex: there can be only one typesetter.
  • less: less is more. No, wait, less isn’t more. Never mind; just display the contents of a text file.
  • df: how much disk space is left? (I was getting close to the limit of my 100 GB!)
  • convert: magical utility that turns any graphics format into any other one.

On my linux machine at work, the same exercise turned up slightly different patterns:

  • ls: or maybe it was the same pattern.
  • cd: like I said…
  • jobs: oh good, something different! I run a lot of jobs on pavonis and often need help remembering what’s still running in which shell.
  • fg: foreground a job, leaving the others to languish in the darkness.
  • screen: oh, the joys of a detachable screen! I want to learn to wield this magic even more.
  • less: less is still more! Or maybe it isn’t.
  • cut: I love cutting and pasting in the shell.
  • bg: dismiss this job into the background wastelands, where it may toil in obscurity!
  • nice: try not to crowd out other users on the same machine.
  • top: find out who is crowding me out on my own machine.

I don’t see myself aliasing any of these in the near future, but it’s a fun self-data-mining exercise. How do you use your shell?