Last Updated: February 25, 2016
·
938
· mitchellduffy

Extract .tar.gz in single command.

We all download .tar.gz archives and consistently I find myself going to gunzip or tar man pages to remember the command (and it seems I'm not the only one). Later I found a one-liner and put it in a little function I've called guntar for ease of use. guntar extracts a directory of the same name (minus the .tar.gz) into the current directory.

Put this in your .bashrc or .profile

# extracts .tar.gz
extractIt() {
    gunzip -c $1 | tar xopf -
}
alias guntar=extractIt