In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of "how to extract files from tarball". The editor shows you the operation process through actual cases. The operation method is simple, fast and practical. I hope this article "how to extract files from tarball" can help you solve the problem.
Tarball is the most convenient packaging tool under the linux system, which uses the instruction tar to package and compress files.
How to create tarball on Linux
Using the following command, you can create a tarball and compress it in a single command.
$tar-cvzf PDFs.tar.gz * .pdf
The result is a compressed file (gzip compressed) that contains all the PDF files in the current directory. Of course, compression is optional. A slightly simpler command that simply packages the PDF file into an uncompressed tarball:
$tar-cvf PDFs.tar * .pdf
Notice that z in the option makes the file compressed. C indicates that the file is created, and v (detailed) indicates that you need some feedback while the command is running. If you do not want to view the listed files, please ignore v.
Another common naming convention is to name the compressed tarball .tgz instead of the double extension .tar.gz, as follows:
$tar cvzf MyPDFs.tgz * .pdf how to extract files from tarball
To extract all files from the gzip package, you can use the following command:
$tar-xvzf file.tar.gz
If you use the .tgz naming convention, the command will look like this:
$tar-xvzf MyPDFs.tgz
To extract a single file from the gzip package, you can do almost the same thing by adding the file name:
$tar-xvzf PDFs.tar.gz ShenTix.pdfShenTix.pdfls-l ShenTix.pdf-rw-rw-r-- 1 shs shs 122057 Dec 14 14:43 ShenTix.pdf
If you don't compress tarball, you can even delete files from tarball. For example, if we wanted to delete the files we extracted above from PDFs.tar.gz, we would do this:
$gunzip PDFs.tar.gz$ ls-l PDFs.tar-rw-rw-r-- 1 shs shs 10700800 Dec 15 11:51 PDFs.tar$ tar- vf PDFs.tar--delete ShenTix.pdf$ ls-l PDFs.tar-rw-rw-r-- 1 shs shs 10577920 Dec 15 11:45 PDFs.tar
Notice that after deleting ShenTix.pdf, we reduced the space occupied by the tarball file a little bit. If we want, we can compress the file again:
$gzip-f PDFs.tarls-l PDFs.tar.gz-rw-rw-r-- 1 shs shs 10134499 Dec 15 11:51 PDFs.tar.gzFlickr / James St. John
The rich command line options make tarball easy to use.
This is the end of the introduction on "how to extract files from tarball". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.