Actually, for extracting tar files, using xf is enough.
tar xf archive.tar.gz
tar xf archive.tar.bz2
Still, this will be useful for other formats, I think. Thanks.