Tar command -- compress the file/directory to the specified directory

Source: Internet
Author: User
Tags xform

Sometimes, we may need to compress the file/directory to the specified directory. For example, to compress all the files and directories in the/home And/boot directories to the Bak directories, you must first create a Bak directory, copy the/home And/boot directories to the Bak directory, and then compress the Bak directory. In this way, both time and disk space are wasted.


Now there is a better way to solve this problem, that is, to use the -- XForm parameter of tar. this parameter is used to modify the file name by replacing the SED command during packaging and compression, you can add a prefix before the file name.


For example.

Tar czvf test.tar.gz -- XForm's # ^ # bak/# '/home/boot


This article from the "Last Night stars" blog, please be sure to keep this source http://yestreenstars.blog.51cto.com/1836303/1554654

Tar command -- compress the file/directory to the specified directory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.