If you grok the Unix command line, you're probably familiar with the less command. If you're still using more, switch now. less has more advanced commands you can type while viewing, for example jump to the end of the file (">"), jump to the beginning of the file ("<"), or jump to a specific line number ("#G"). It's searching capabilities are much richer, too. It highlights the matched term, allows regular expressions, and can be put into case insensitive mode ("-i"). But one of the best goodies is lesspipe. lesspipe is input filter that allows to view files with binary content, compressed files, archives and files contained in archives. So, let's say you have a tarball with two files: hello.c and hello.txt. You can view the contents:

% less hello.tar.gz
==> use tar_file:contained_file to view a file in the archive
-rw-r--r-- dave/wheel      105 2006-01-06 11:18:01 hello.c
-rw-r--r-- dave/wheel        7 2006-01-06 11:16:22 hello.txt

This works for tar.bz2 and zip, archives, too. This saves you from having to remember the different flags needed to uncompress and list the archive, and you don't have to remember to pipe it to less, which is probably what you were going to do, anyway. You'll notice from the output that you can also view files inside the archive directly:

% less hello.tar.gz:hello.c  
#include <stdio.h>

int main(char * argc, char * argv[])
    printf("Hello World!\n");
    return 0;

You can use it on a file that's just compressed, too: less hello.c.gz. One of my favorite is to view man pages: less /usr/share/man/man1/ls.1. While obviously not useful for man pages in standard locations, you can use it to view a man page in the current directory without having to remember the flags to nroff. This is useful if you want to view a man page for a package you haven't installed yet, or if you are writing a man page. On OS X, it can view bom files, and it's even smart enough to look inside a pkg: less /Library/Receipts/Mail.pkg.

I just learned that it can colorize source code. But to do this, you need to use -r or -R to enable raw control characters: less -R hello.c. This is somewhat dangerous in that viewing a binary file can really mess up your terminal, by putting into some mode that you can't get it out of. But if you want to enable this all the time, you can put it into your LESS environment variable. My LESS is set to -i -M, so I can always be in case insensitive mode, and -M gives a more descriptive prompt.