- UNIX / Linux Decompress tgz / tar.gz and extract files
- Linux decompress tgz file
- Unix decompress .tar.gz file
- How to decompressing .tar.bz2 file
- How to uncompress tar.gz/tgz/tar.bz2 file into a different directory
- How to to extract single file named foo.mp4 from the backup.tar.gz
- How to view a listing all files in tarball archive
- UNIX decompress tgz / tar.gz file
- Summary of tar command options
- Conclusion
- HowTo: Unpack .tgz File On a Linux
- Unpacking .tgz files command
- Examples
- tar command options
- What is TGZ File and How To Extract TGZ In Windows and Linux?
- Tar.gz
- TGZ Exract Applications For Windows
- List TGZ File Information
- Extract TGZ For Linux
- Extract For Windows with 7zip
- linux-notes.org
- Распаковка .tgz файлов в Unix/Linux
- Extract tar.gz File in Linux or Unix using tar
- Syntax to extract .tar.gz file
- Extracting tr.gz. file
- Extracting an entire archive
- List files in archive
- How to create a tarball
- How to add files to an existing tarball
- How delete files from a tarball
- Conclusion
UNIX / Linux Decompress tgz / tar.gz and extract files
Linux decompress tgz file
To open such file type the following tar command at Linux shell prompt (GNU tar syntax):
$ tar -zxvf filename.tgz
The above, command will extract the .tgz file into the current directory. To view files use the cd command and ls command:
ls -l
cd dir1
ls
Unix decompress .tar.gz file
Let us see how to extract .tar.gz files using Unix or Linux command line, run:
$ tar -zxvf filename.tar.gz
How to decompressing .tar.bz2 file
Run the following command to extract .tar.bz2 file on Unix or Linux:
$ tar -jxvf filename.tar.bz2
How to uncompress tar.gz/tgz/tar.bz2 file into a different directory
The syntax is:
tar -zxvf filename.tgz -C /path/to/dir1/
tar -zxvf filename.tar.gz /dir2/
tar -jxvf filename.tar.bz2 /path/to/dir3
How to to extract single file named foo.mp4 from the backup.tar.gz
Execute:
tar -xvzf backup.tar.gz foo.mp4
Extract dir2 from backup.tar.gz, run:
tar -xvzf backup.tar.gz dir2
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
How to view a listing all files in tarball archive
Again use the tar command as follows to see a listing of all files in backup.tar.gz:
tar -ztvf backup.tar.gz
UNIX decompress tgz / tar.gz file
Type the following command:
$ gzip -dc filename.tgz | tar xf —
$ gzip -dc filename.tar.gz | tar xf —
If file extension ends with .Z, enter:
$ zcat filename.tar.Z | tar xf —
Summary of tar command options
- z – Decompress/extract tar.gz or .tgz file
- j – Decompress/extract tar.bz2 or .tbz2 file
- x – Extract files
- v – Verbose output on screen
- t – List files stored inside given tarball archive
- f – Extract given filename.tar.gz and so on
Conclusion
This page showed how to extract (decompress) tar.gz/tgz files using Linux and Unix command line options.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник
HowTo: Unpack .tgz File On a Linux
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | No |
Requirements | tar+gunzip |
Est. reading 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:
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
To unpack and put files in a different folder (directory) say /tmp/data, enter:
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
Category | List of Unix and Linux commands |
---|---|
Documentation | help • mandb • man • pinfo |
Disk space analyzers | df • duf • ncdu • pydf |
File Management | cat • cp • less • mkdir • more • tree |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Linux Desktop Apps | Skype • Spotify • VLC 3 |
Modern utilities | bat • exa |
Network Utilities | NetHogs • 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 • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop |
Searching | ag • grep • whereis • which |
Shell builtins | compgen • echo • printf |
Text processing | cut • rev |
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 |
Comments on this entry are closed.
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…!
Источник
What is TGZ File and How To Extract TGZ In Windows and Linux?
TGZ file is a tar archive which is compressed with the Gzip compression algorithm. Linux operating systems provide tar and gzip by default. A tar archive is created in order to make multiple files and directories single file with a tar archive. And then gzip is used to compress this tar which will create a TGZ file.
Tar.gz
As stated previously TGZ is tar and gzipped file. TGZ can be also expressed as tar.gz . Tar is for tar archive and gz is gzip archive.
TGZ Exract Applications For Windows
There are a lot of tools which can be used to create or extract TGZ file. We will list the most popular application for TGZ below.
List TGZ File Information
We will start by printing the TGZ file information. We will use file command which will print information like file type, last modified time, original size etc.
List TGZ File Information
Extract TGZ For Linux
Linux distributions like Ubuntu, Debian, Mint, Kali, Fedora, CentOS, RedHat provides requires tools tar and gzip from applications repositories. These tools are installed by default.
Extract TGZ For Linux
Extract For Windows with 7zip
We will right click to the TGZ file and click Extract Here like below.
This will decompress gzip part and create a tar file. We will again Rigth Click and then click to the Extract Here which will decompress the tar file like below.
As we can see the decompressed file will not be deleted automatically.
Источник
linux-notes.org
Распаковка .tgz файлов в Unix/Linux
Сейчас расскажу как можно распаковать файлы которые запакованы в tgz, на готовом примере я покажу в своей статье «Распаковка .tgz файлов в Unix/Linux».
Я новый пользователь Linux. У меня некоторые проблемы с терминалом и я не знаю некоторые команды. И например, я забываю всегда как можно распаковать архив .tgz (tar.gz) на Linux с помощью параметров командной строки.
Распаковка .tgz файлов
Синтаксис выглядит следующим образом:
Или можно использовать синтаксис Bash который открывает «трубу» и распакует ваш архив:
Примеры
В этом примере, чтобы распаковать файл с именем my_backup.tgz, выполните:
Чтобы распаковать все файлы и поместить их в другую папку или каталог (например /usr/local/src), введите:
Можно посмотреть, имеются ли файлы в том каталоге:
Команды tar
-z : Распакует полученный архив с помощью команды GZIP.
-x : Извлечение файлов на диск из архива.
-v : Показывает сам процесс распаковки файлов при извлечении файлов.
-f my_backup.tgz : Read the archive from the specified file called my_backup.tgz.
-C /usr/local/src : Распаковка/ извлечение файлов в /usr/local/src вместо текущей директории по умолчанию.
Мне нравится еще использовать утилиту zcat:
Данный архив содержит файл с БД (sql), программа zcat открывает «трубу», после чего начнет распаковку и сразу же будет перенаправлять все данные в mysql (я указал в нужную мне базу).
Распаковка .tgz файлов в Unix/Linux закончена.
Источник
Extract tar.gz File in Linux or Unix using tar
I have downloaded a file called foo.tar.gz from the Internets. How do I extract tar.gz file under Linux / UNIX like operating systems using command line options?
A tarball (tar.gz file) is nothing but compressed tar archive. The tar program provides the ability to create tar archives, as well as various other kinds of manipulation. For example, you can use tar on previously created archives to extract files, to store additional files, or to update or list files which were already stored.
Tutorial details | |
---|---|
Difficulty level | Easy |
Root privileges | No |
Requirements | tar |
Est. reading time | 2m |
Initially, tar archives were used to store files conveniently on magnetic tape. The name “Tar” comes from this use; it stands for tape archiver. Despite the utility’s name, Tar can direct its output to available devices, files, or other programs (using pipes), it can even access remote devices or files as archives. The tar command is available on Linux (CentOS/RHEL/Fedora/Debian/Ubuntu and all other distros), BSD (OpenBSD/NetBSD/FreeBSD), Apple macOS, HP-UX, AIX, and other Unix-like operating systems. This page shows how to extract tar.gz file using command line.
Syntax to extract .tar.gz file
The syntax is as follows:
Extracting tr.gz. file
To extract one or more members from an archive, enter:
$ tar -zxvf < file.tar.gz >
If your tarball name is backup.tar.gz, enter the following at a shell prompt to extract files:
$ tar -zxvf backup.tar.gz
To extract resume.doc file from backup.tar.gz tarball, enter:
$ tar -zxvf backup.tar.gz resume.doc
Where,
- -z : Work on gzip compression automatically when reading archives.
- -x : Extract tar.gz archive.
- -v : Produce verbose output i.e. display progress and extracted file list on screen.
- -f : Read the archive from the archive to the specified file. In this example, read backups.tar.gz archive.
- -t : List the files in the archive.
- -r : Append files to the end of the tarball.
- —delete (GNU/Linux tar only) : Delete files from the tarball.
In order to untar a tar file, the -x (for extract) and -f options are needed.
Extracting an entire archive
To extract an entire archive, specify the archive file name only, with no individual file names as arguments.
tar -zxvf backup.tar.gz
List files in archive
To view a list of the files within a tarball, issue the following command, enter:
$ tar -tvf backup.tar.gz
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
How to create a tarball
tar command used to create a Tape ARchive. The resulting file is known as a tarball in Unix world. Let us see how to create a tarball using tar command. The following would create an archive file called data.tar from the three files named file1.txt, file2.txt and file3.txt that are located in the current directory:
tar -cvf data.tar file1.txt file2.txt file3.txt
One can use the tar command to make archives from the contents of one or more directories. For example, the contents of two directories named /etc/ and /home/vivek/Documents/ could be archived into a file named dump.tar with the following:
tar -cvf dump.tar /etc/ /home/vivek/Documents
In this example, create an archive named data.tar.bz2 of the files /etc/ directory that is compressed using gzip:
tar -cvzf files.tar.gz /etc/
How to add files to an existing tarball
Pass the -r option. For example, the following would append a file named resume.doc to file.tar:
tar -rf file.tar resume.doc
How delete files from a tarball
Pass the —delete option to GNU/tar command which allows specified files to be completely removed from a tarball. Thus, for example, the files pic1.png and pic2.png can be removed from file.tar with the following:
tar -f file.tar —delete pic1.png pic2.png
Conclusion
We have shown you how to extract tar.gz file from the command line. The commands should work on Linux and Unix-like systems. For more info see tar command help page here and here.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник