One Liner to Decompress tar.gz Files
For some reason I can never seem to remember this one liner so I generally have to look it up, or decompress the gzip files, then untar. So I’m documenting it here for my own future reference. (Yeah, Linux experts, keep laughing at me!)
tar xzvf my_dir.tar.gz my_dir
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
May 14, 2009
Tags: gzip, linux, tar Posted in: Programming & Internet




5 Responses
Wow, I can’t believe that!! You may have to put -xvzf on some systems and last argument my_dir is not really required.
This works for tar.gz as well as tgz files. If you have tar + bz2 file, you can use xvjf — somehow i always use xvzf and not xzvf.
I consider myself pretty good with Linux and I still have to look that up when I need it. I think that anymore I do not use it enough to really remember it.
Yup. You don’t need to provide ‘my_dir’ when extracting a tar archived file. You do that if you are creating a tar archive file such as:
tar cvf my_dir.tar.gz my_dir1 my_dir2
Anyway, tar is a great tool for backup too.
So ever considered making an alias for it?
in ~/.bash_rc or ~/bash_aliases (or whatever is suitable for your distro)
Add for example
# Extract tar.gz
alias tarx=’tar xvzf’
Or name it anything you are sure you will remember
Being of advanced years I find aliases are the way to go!
Leave a Reply