Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use tarball in Linux system

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use tarball in the Linux system, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Tarball is what we often call tarball. In the Linux system, Tarball provides users with a general method for backing up and managing files.

Introduction to tarball: tarball is the most convenient packaging tool under linux, which uses the tar instruction to package and compress files. The so-called Tarball file, in fact, is to package all the source files of the software with tar, and then use compression technology to compress.

How to create a tarball on Linux using the following command, you can create a tarball and compress it in a single command.

The result of $tar-cvzf PDFs.tar.gz * .pdf 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 note 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, just add the file name:

$tar-xvzf PDFs.tar.gz ShenTix.pdf ShenTix.pdf ls-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, after deleting ShenTix.pdf, we reduced the space occupied by tarball files a little bit. If we want, we can compress the file again:

$gzip-f PDFs.tar ls-l PDFs.tar.gz-rw-rw-r-- 1 shs shs 10134499 Dec 15 11:51 PDFs.tar.gzFlickr / James St. John's rich command-line options make tarball easy to use.

Thank you for reading this article carefully. I hope the article "how to use tarball in Linux system" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report