![]() You can choose one of the methods that you find easiest. In this article, three methods of extracting compressed files are discussed in detail: Extracting files using “unzip”, “tar” and “gunzip” commands. tgz” extension are unzipped by gunzip command.īelow mention command will unzip “” by gunzip command $ gunzip Ĭheck whether the file is extracted by listing all files in the directory:Įvery operating system offers the possibility to compress files or directories with different methods to save disk space and to transfer files easily. After extraction, the file/files will regain their original extension. In Linux, the gunzip command compresses or expands a file or files and, replaces the archived file/files with the original file/files. The below-mentioned command will unzip “linux2.tar” by tar command: $ tar xvf linux2.tarĬheck whether the file is extracted by listing all files in the directoryĪnother common way to extract data from archived files using a terminal in Linux is by using gunzip command, which also comes pre-installed. r : updates or add file/files or directory in already existed. z : zip, tells tar command that creates tar file using gzip u : compresses and adds to an existing zip file f : creates compressed file with given filename The files zipped with “.tar” extension are unzipped by tar command. The files zipped with “.zip” extension are unzipped by unzip command.īelow mention command will unzip “linux1.zip” by unzip command: $ unzip linux1.zipĬheck whether the file is extracted by listing all files in the directory.Īnother most common method to extract data from archived files using a terminal in Linux is by using the tar command which comes pre-installed in Ubuntu, it stands for “tape archiver“ used to compress, and extract the compressed files and also maintain and modify them. It’s preinstalled in new versions of Ubuntu and other Linux distributions but if you are using an older version you will need to install it by below-mentioned command. ![]() One of the most common methods to extract data from archived files using a terminal in Linux is by using unzip command. Some of the methods to extract data from files are mentioned below Some of them are described in detail in this article. There are many methods to unzip files and directories. Files that have been zipped in Linux can be recovered using a variety of tools on different platforms. In our case, we use tar -tf perl-5.36.0.tar.gz. In most operating systems, including Linux, working with compressed files and directories is similar to working with uncompressed files and directories. This command will display a list of files and directories in the tar archive. The term “archive file” refers to a file that combines many data files into a single file, saving disk space on the computer by compressing the files and making it easier to transfer files from one computer to another. In Ubuntu, there are numerous techniques to archive files and retrieve archived files, because these files are collections of one or more files or information. In this article, I have used Ubuntu 22.04, a widely used and popular Linux distribution. The destination directory must exist so make sure to use mkdir command to create one beforehand. You can extract a tarball to a specific directory in the following manner: tar xvf tarfile -C destinationdirectory. Some other zip operations are zipcloak, zipdetails, zipsplit and zipinfo, but in this article, we will discuss how to extract data from files (unzip operation). By default, the content of a tarball are extracted in the current directory. Finally Documents is the directory to archive and compress.Linux is a popular operating system that includes various utilities for handling files, including zipping and unzipping files. tgz file extension, others will know that this is a tar archive that has been gzipped. The new archive must be named, which is Documents.tgz in this example. The -czvf options break down as c for create a new archive, z for compress with g zip, v for verbose output, and f for file equals archive, which means the archive maintains the file structure of the original directory. ![]() Zip Files in Linux Terminal With Tar and GzipĮnter the command tar -czvf Documents.tgz Documents. Using tar with the gzip option on the directory compresses everything and makes one archive. ![]() Using the other zip methods on a directory of files, you’d get a compressed archive for each file in the directory. You get a nicely compressed single package of files. Whatever the file sizes are, the size of the tar file will be about the same.īut if you combine a zip method with tar, then you get something really cool. Why hasn’t tar been mentioned yet? It’s an archiving tool, taking a bunch of files and putting them into one archive for easy transport. What About Tar to Zip and Unzip Files in Linux?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |