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 tar compressed File Management Command in Linux

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article mainly introduces the Linux tar compression file management command how to use, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Summary:

Tar is mainly used to compress and decompress files, which is a commonly used command.

Command format:

Tar [- cxtzjvfpPN] pathname [pathname...]

Parameters:

-c: create an archive

-x: unlock an archive

-t: view the contents of an archive

-z: use gzip to compress or decompress the archive

-j: compress or decompress the archive with bzip2

-v: show detailed processing

-f: use the file name, followed by the file name directly

-r: append the file to the end of the file

-- delete: delete a file from an archive

-p: do not change the original attributes of the file

-N: archive only updated files, followed by date (yyyy/mm/dd)

-- exclude FILE: do not pack the following files

Example:

1. Package / home but do not compress

Tar-cvf / filepath/filename.tar / home

2. Compress and package in gzip

Tar-zcvf / filepath/filename.tar.gz / home

3. Compress and package in bzip2

Tar-jcvf / filepath/filename.tar.bz2 / home

4. View the contents of tar files

Tar-tvf / filepath/filename.tar

5. View the contents of gzip files,

Tar-ztvf / filepath/filename.tar.gz

6. View the contents of bzip2 files

Tar-jtvf / filepath/filename.tar.bz2

7. Back up / home directory and save permission settings

Tar-zxvpf / filepath/filename.tar.gz / home

8. Backup the files in the / home directory that are newer than 2009-05-28

Tar-N "2009-05-28"-zcvf / filepath/filename.tar.gz / home

9. Back up the / home directory, but not the / home/slyar directory

Tar-- exclude / home/slyar-zcvf / filepath/filename.tar.gz / home

10. Back up the / home directory as home.tar.gz, and extract only the / home/slyar.sh file

Tar-zxvf home.tar.gz home/slyar.sh

Thank you for reading this article carefully. I hope the article "how to use tar compressed File Management commands in Linux" 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

Servers

Wechat

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

12
Report