Most Linux and open source software files are distributed in either .tgz or .tar.gz extensions format over the Internet. These files are gzipd tar balls and include multiple files and sub-directories into a single file using tar command. To save the bandwidth tar files are cpmpressed using gzip program.
Tutorial details | |
---|---|
Difficulty | Easy (rss) |
Root privileges | No |
Requirements | tar+gunzip |
Time | 2m |
Unpacking .tgz files command
The syntax is as follows:
tar zxvf fileNameHere.tgz
Or try the geeky bash pipe based syntax:
gunzip -c fileNameHere.tgz | tar xvf -
Examples
In this example, unpack a file called backups.tgz, enter:
tar zxvf backups.tgz
OR
gunzip -c backups.tgz | tar xvf -
Sample outputs:
tar: Removing leading '/' from member names x Users/vivek/Downloads/db.txt x Users/vivek/Downloads/resume.txt x Users/vivek/Downloads/vendors.txt x Users/vivek/Downloads/sales.txt
To unpack and put files in a different folder (directory) say /tmp/data, enter:
tar zxvf backups.tgz -C /tmp/data ls -l /tmp/data
tar command options
- -z : Uncompress the resulting archive with gzip command.
- -x : Extract to disk from the archive.
- -v : Produce verbose output i.e. show progress and file names while extracting files.
- -f backup.tgz : Read the archive from the specified file called backup.tgz.
- -C /tmp/data : Unpack/extract files in /tmp/data instead of the default current directory.
See tar(1) command man page for more information.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.
🐧 5 comments so far... add one ↓
🐧 5 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
Hello.
You can try too:
It’s just what i have been looking for. Much thanks.
Thank you for the information, I was able to find what i was looking for in a jiff and i was able to understand the instructions.
Hi Folks..!
i have created a Tarball
“softwaredevelopment.war.tgz” size 1.2G
while extracting it
i used all the above command mentioned on this page
tar zxvf fileNameHere.tgz
gunzip -c fileNameHere.tgz | tar xvf –
i have also installed GNU software… but still not working for me..!
is there any solution for this… kindly help…!
tar -zxvf softwaredevelopment.war.tgz