Main Tutorials

Linux – How to extract a tar.gz file

In this tutorial, we will show you how to extract a tar.gz file :


tar vxf filename.tar.gz

Example

For example, apache-ant-1.9.4-bin.tar.gz in your ~/Download folder.


$ cd ~
$ pwd
/Users/mkyong

# Optionally, create a new folder for the archived file.
$ mkdir tools
$ cd tools
$ pwd
/Users/mkyong/tools

# Copy archived file to an above newly created folder.
$ cp ~/Downloads/apache-ant-1.9.4-bin.tar.gz ~/tools

# Extracts it
$ tar vxf apache-ant-1.9.4-bin.tar.gz
 
x apache-ant-1.9.4/bin/ant
x apache-ant-1.9.4/bin/antRun
x apache-ant-1.9.4/bin/antRun.pl
x apache-ant-1.9.4/bin/complete-ant-cmd.pl
x apache-ant-1.9.4/bin/runant.pl
x apache-ant-1.9.4/bin/runant.py
x apache-ant-1.9.4/
x apache-ant-1.9.4/bin/
......
 
$ pwd
/Users/mkyong/tools

$ ls -lsah

    0 drwxr-xr-x@ 15 mkyong  staff   510B Nov 22 11:24 apache-ant-1.9.4
10872 -rw-r-----@  1 mkyong  staff   5.3M Oct 29 14:42 apache-ant-1.9.4-bin.tar.gz

References

  1. Linux : tar man page
  2. 18 tar command examples

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments