Skip to content

BASH-ing My Birthday

The Mind of Bryan Veloso at Age 25

The Web Design Era
Seattle, WA
DISCLAIMER
This is a legacy post written before 2013 . While the content has survived numerous site migrations and content management systems, some formatting and links may be broken. I've done my best to fix things under my control.

Usually, I’d write a post related to adding one year onto my age and stuff like that. Twenty-five. Well, now I don’t have to pay the underage fee to rent a car anymore! And my insurance should go down right? RIGHT?

Anyway, I’m sure those posts were boring to everybody else but me, so here’s something completely different:

extract () {
    if [ -f $1 ] ; then
        case $1 in
            *.tar.bz2)  tar xjf $1      ;;
            *.tar.gz)   tar xzf $1      ;;
            *.bz2)      bunzip2 $1      ;;
            *.rar)      rar x $1        ;;
            *.gz)       gunzip $1       ;;
            *.tar)      tar xf $1       ;;
            *.tbz2)     tar xjf $1      ;;
            *.tgz)      tar xzf $1      ;;
            *.zip)      unzip $1        ;;
            *.Z)        uncompress $1   ;;
            *)          echo "'$1' cannot be extracted via extract()" ;;
        esac
    else
        echo "'$1' is not a valid file"
    fi
}

This should go in your .bash_profilenow.

Did you do it yet? If you do have it, then isn’t it awesome? If not, then it’ll save you the hassle of trying to remember how to extract .tar, .tar.gz, bz2-whatever and .zip files on the command line! Sure, you might be a master with the tar zxvf stuff, but this is a must for those absent minded folk such as myself. :P

Well, with that I shall go celebrate being 25… and pondering how to get this geeky CLI feeling out of my system.

Avalonstar is the 25-year-old personal website of Bryan Veloso: streamer, professional user interface designer, hobbyist developer, lifelong gamer, and compass of purpose.

Colophon

The text of this website is set in Geologica, Andada Pro, and Optician Sans. Built by hand with Astro and GitHub. Hosted on my Mac Mini using Bun.

© 2000-2026 Avalonstar. “Avalonstar” is a registered trademark of Avalonstar, Inc. All rights reserved.