![]() ![]() -f is used to specify the file which needs to be extractedįor example, here, I have extracted a Fedora.tar file: tar -xvf Fedora.tarĪnd as you can see, the file is extracted successfully and here I have used the tree command to show the file contents of the directory.-v gives the verbose output of what is being done by the command.-x is used to specify user wants to extract the file.tar extension when you use the tar command to create an archive from one or multiple files.Īnd to extract the tar file, all you need to do is use the -xvf option with the tar command and append the filename as shown: tar -xvf file.tar In this tutorial, I will walk you through how you can untar the following file types: So in this tutorial, I will walk you through how you can untar files that were created with different utilities. For example, using gzip command, you can create. Or you may have used the tar command to compress files in the past and now want to extract them.īut several types of tar files can be created with different utilities. For more information on using the tar command, see my Linux tar command examples.While installing packages from the source, you are more likely to get the file in the. I hope this tar/gzip tutorial has been helpful. Once I learned that I could tar and gzip a file with one command I stopped using this two-step process, but again, either way will work. This is a two-step process - and the way I used to do this - that works like this:Īs a practical matter you can treat a tar.gz file just like a tgz file, and extract its contents using the same command that was shown earlier: When you see this ".tar.gz" file extension, it indicates that the file has probably been tar'd first, and then gzip'd second. This command lists the contents of the archive, but does not extract the files in the archive to your filesystem.Īs you work in the Unix world you'll also run into files named with a "tar.gz" extension, like this: If this is an archive you just received from someone else, you may want to look at its contents before just extracting it to your filesystem.įortunately you can list the contents of an archive very easily, using the t option ("lisT") instead of the x argument, like this: If that previous command sounded scary, maybe it should be. This command extracts whatever was in that tar'd and gzip'd archive to your filesystem.ģ) List the contents of a tar/gzip archive To extract the contents of the archive issue a very similar command, this time using an x (for "eXtract") instead of the c argument, like this: ![]() Now imagine that you have just received a tar/gzip archive like this from someone else. When creating an archive that has been tar'd and gzip'd, this is considered a "tar tgz" file, so it's common practice to end your filename with the extension tgz (though you can call it whatever you want).Ģ) Extract the contents of a tar/gzip (tar tgz) archive f - specifies that you want to use the following filename ( mydirectory.tgz) as the name of the archive.v - work verbosely, showing me the name of each file you add.I've included four options with the tar command: Here's how you create a tar'd and gzip'd archive of a directory (i.e., a "tar tgz" file) in your current folder named mydirectory:Ī few quick notes about this tar/gzip example: The most common way to do that these days is to create an archive that is "tar'd and gzip'd". Here's a quick look at how to work with the most common tar/gzip scenarios.ġ) Create a tar'd and gzip'd archive of a directoryĪ lot of times you'll have a directory that you want to either (a) make a backup copy of, or (b) share with other people. When you work on Unix, Linux, and Mac OS X systems, you'll quickly find that tools like tar and gzip are your good friends, so learning how to work with them is very important. Tar gzip FAQ: How do I work with tar archives that have been created with tar and gzip? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |