You may be wondering how to unzip a Tar file in Linux. Just remember to backup your data before you use it. You can even do it on Windows, Mac, and Linux systems.
If you’re unsure about the process, read on! This article will walk you through the process of extracting a tar file in Linux Terminal. Using a tar file is an easy way to extract compressed files from a computer. You can also use the -r option to recursively compress the files in the DIRECTORY/ directory. In addition to this, you can use the -c option to specify a different directory for the extracted files. You can use the tar command to extract the compressed files. Moreover, you can extract a specific file from a tar gz file by specifying a path or filename.įor tarballs that have been compressed with GZIP, you need to uncompress them. After that, you can see the file’s permissions, owner, and size. If you prefer to use a GUI, you can right-click on the tar gz file and choose the Extract option. There are many ways to open a tar gz file in Linux. How Do I Open a Tar Gz File in Linux Terminal? If you want to unzip a tarball containing multiple files, use the -r option to recursively compress all files in the DIRECTORY/directory. When running tar -C, specify the destination directory with the path, which is the actual path to the directory you wish to unpack. Tar -c /PATH/TO/DIRECTORY/where ‘TARGZ’ is the tar directory, and ‘c’ specifies the destination directory. READ ALSO: How Do I Setup a Ubuntu Home Server? So, how do you unzip a TAR gz file in Ubuntu? Today, TAR files are compressed with GNU gzip, and this is evident by the GZ file extension.
TAR stands for Tape Archive and originally was used to store data on magnetic tapes.
How Unzip Gz File in Ubuntu?Ī tarball is a series of files that are compressed in Linux and commonly referred to as a TAR file. This application can also create and open tar Gz files.
The format is mainly used on UNIX-based operating systems, but Windows and MacOS users can also open tar Gz files if they have a version of WinZip. You can then save them or delete them from the server.Ī tar gz file is compressed files that are often used to send packages and programs over the Internet, but they can also be used to store files locally. Once you’ve extracted the files, you can view them in a new directory.
This file is in the format of a tar archive. When a user downloads a file from a server, it’s possible to see the contents of the archive. How Do I Open a Tar Gz File in Linux Terminal?.If you find this guide helpful or have more information or additional ideas, you can give me a feedback by posting a comment. That is it with extracting tar files to a specific directory and also extracting specific files from a tar file. Img 05: Extract Specific Files From Tar Archive Summary # tar -xvf etc.tar etc/issue etc/nf etc/mysql/ -C /backup/tar_extracts/ In the next example, I will extract specific files out of a tar file to a specific directory as follows: # mkdir /backup/tar_extracts The tar utility also allows you to define the files that you want to only extract from a. Img 04: Extract tar.bz2 Files to Different Directory Example 4: Extract Only Specific or Selected Files from Tar Archive # tar -jvxf documents.tbz2 -C /tmp/tar.bz2/
Now we will be unpacking the documents.tbz2 files to /tmp/tar.bz2/ directory. tbz2 Files to Different DirectoryĪgain repeating that you must create a separate directory before unpacking files: # mkdir -p /tmp/tar.bz2 tgz Files to Different Directory Example 3: Extract tar.bz2. Now we will extract the contents of documents.tgz file to separate /tmp/tgz/ directory. tgz Files to Different Directoryįirst make sure that you create the specific directory that you want to extract into by using: # mkdir -p /tmp/tgz Img 02: Extract Tar Files to Specific Directory Example 2: Extract. # tar -xvf articles.tar -directory /tmp/my_articles/ Let me also use the -directory option instead of -c for the example above. In the above example I used the -v option to monitor the progress of the tar extraction. Img 01: Extract Tar Files to Different Directory To extract the files in articles.tar to /tmp/my_article, I will run the command bellow: # tar -xvf articles.tar -C /tmp/my_article/ You can include the -p option to the above command so that the command does not complain. Let me start by creating the /tmp/my_article directory using the command below: # mkdir /tmp/my_article Always make sure that the directory into which you want to extract tar file exists. In the first example, I will extract the files in articles.tar to a directory /tmp/my_article. Example 1: Extracting tar Files to a Specific Directory