Untar to a specific directory and other tar tricks
by Mahdi Sajjadpour

This only works w/gnu tar which is pretty much on every platform now. If you still use solaris tar, then you are out of luck. w/GNU tar you can untar to a specific directory using the -C command (change directory) without switching directories.
tar -xzf foo.tar.gz -C /tmp/foo/;

and the old school solaris way which still does the cd
gzip -d < foo.tar.gz | (cd /tmp && tar -xf -) 

Copyright by techTips