If you're like me and you can never remember which command and options to use to extract a file, and you use the friendly interactive shell (though it shouldn't be difficult to convert for other shells), then you'll like this.
It's a function to extract files based on the extension.
extract foo.tar.gz bar.zip baz.bz2 qux.rar.
Save it as ~/.config/fish/functions/extract.fish
function extract --description "Expand or extract bundled & compressed files" for file in $argv if test -f $file echo -s "Extracting " (set_color --bold blue) $file (set_color normal) switch $file case *.tar tar -xvf $file case *.tar.bz2 *.tbz2 tar -jxvf $file case *.tar.gz *.tgz tar -zxvf $file case *.bz2 bunzip2 $file # Can also use: bzip2 -d $file case *.gz gunzip $file case *.rar unrar x $file case *.zip *.ZIP unzip $file case *.pax pax -r < $file case '*' echo "Extension not recognized, cannot extract $file" end else echo "$file is not a valid file" end end end