ack: the fast code search tool

September 08, 2009

One of the handiest tools in my programming toolkit is ack, a Perl script that is great for searching through code (or really any text files). I use it a lot while refactoring, for example when I want to rename a method every time it’s called in a project.

You can install ack with this command (from http://betterthangrep.com/):
$curl http://betterthangrep.com/ack-standalone > ~/bin/ack && chmod 0755 ~/bin/ack 

Assuming that ~/bin/ack is in your path searching code is as easy as this:

$ ack my_poorly_named_method

My Favorite Bash Substitution Tricks

August 01, 2009

Here’s a few tricks that I often use on the command line to save time. They take advantage of some variables that the bash shell uses to store various aspects of your history.

Repeating the last command with !!

Sometimes I run a command that requires sudo access, but forget the sudo. This is a great opportunity to use !! which holds the last command you ran.


$ tail /var/log/mail.log
tail: cannot open `/var/log/mail.log' for reading: Permission denied
$ sudo !!
sudo tail /var/log/mail.log
# output of command