Site changes

As you’ve might have noticed the layout has changed. Everything should still work fundamentally but it can look a bit messed up. Please bear with it for now, I’ll try to get everything back to normal as soon as I can.

divider

Command line snippet of the week: 48

Hate having to remember all switches for each different unpacker? You can fix that!
Create a new file in /usr/bin/ called “extract” and paste the following code:

if [ -f $1 ] ; then
case $1 in
    *.tar.bz2)   tar xvjf $1        ;;
    *.tar.gz)    tar xvzf $1     ;;
    *.bz2)       bunzip2 $1       ;;
    *.rar)       unrar x $1     ;;
    *.gz)        gunzip $1     ;;
    *.tar)       tar xvf $1        ;;
    *.tbz2)      tar xvjf $1      ;;
    *.tgz)       tar xvzf $1       ;;
    *.zip)       unzip $1     ;;
    *.Z)         uncompress $1  ;;
    *.7z)        7z x $1    ;;
    *)           echo "'$1' cannot be extracted via >extract<" ;;
esac
else
echo "'$1' is not a valid file"
fi

be sure to chmod it to executable:

chmod +x /usr/bin/extract

This code will save you time by extracting almost any kind of archive by using the command:

extract my_awesome_archive.tar.gz
divider