Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm going to be slightly flippant and say the the bundled tools and little one liners built with them. A few examples from my .profile follow:

Eject a volume:

  alias eject='hdiutil eject'
Copy the working dir to the clipboard:

  alias cpwd='pwd|xargs echo -n|pbcopy'
Show current airport status:

  apinfo='/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I'

Use spotlight to search for a file:

  spotlightfile() {
      mdfind "kMDItemDisplayName == '$@'wc";
  }
Use spotlight to search file contents:

  spotlightcontent() {
      mdfind -interpret "$@";
  }
Display a man page in Preview:

  pdfman () {
     man -t $1 | open -a /Applications/Preview.app -f
  }
I've a few others but they're less generic than the above. Also although the above were sitting in my .profile I probably yanked them from random parts of the inter-webs; in other words, I take no credit for them.

EDIT: One more generic one I use fairly regularly:

  google() {
      python -c "import sys, webbrowser, urllib;   webbrowser.open('http://www.google.com/search?' + urllib.urlencode({'q': ' '.join(sys.argv[1:]) }))" $@
  }


pbcopy is a great little utility

another neat trick is dragging and dropping a file to the terminal and having the filename pasted to the terminal


That's not really flippant as those are useful by themselves. All the utility I am advocating does it make the oneliners a bit easier to get to and have context(i.e. changing the working directory to what you are actually working on) readily available. I would say that a programmer without a decent list of aliases saved up is not the best programmer.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: