News for hackers. Stuff that matters.
Re:Ask HN: Best Unix Tricks? by uggedal on Tuesday September 08, 2009 @09:14AM (#810869)
My most useful zsh functions:

  # a visual recursive list of all files and directories
  function tree()
  {
    find . | sed -e 's/[^\/]*\//|--/g' -e 's/-- |/    |/g' | $PAGER
  }

  # recursive text search (ack is also nifty)
  function f()
  {
    find . -name '*' | xargs grep -l $1
  }

  # recursive search and replace (ignoring hidden files and dirs), example: replace foo bar
  function replace()
  {
    find . \( ! -regex '.*/\..*' \) -type f | xargs perl -pi -e "s/$1/$2/g"
  }
Re:Ask HN: Best Unix Tricks? by nibrahim on Tuesday September 08, 2009 @09:44AM (#810934)
Perhaps Python specific but I use this a lot

  epy () { 
  	cmd="import $1 as a ; print   a.__file__.endswith('.pyc') and a.__file__[:-1] or a.__file__" 
  	file=$(/usr/bin/env python -c $cmd) 
  	echo $file
  	emacsclient --no-wait $file
  }