The difference between the tar command for Mac--exclude and the tar command--exclude for Linux

Source: Internet
Author: User

One requirement is to compress a folder, but to exclude another folder
--exclude command, but execute on Mac

TAR-ZCVF test.tgz test/--exclude *.jpg

Always prompt

Tar:--exclude:cannot stat:no such file or directory

And on Linux does not prompt this error, in the end is why?
Later found that Mac and Linux do not deal with this parameter, through the man tar separately on the Mac and Linux instructions above, found on the MAC for--exclude is explained this way

not process files or directories that match the specified pattern.  Note that exclusions take precedence over patterns or filenames specified on the command line.

The first sentence is the interpretation of this command, that is, the meaning of exclusion, the next sentence is the focus, meaning that--exclude to write in front, so mac above exclude a file or folder to write

Tar--exclude *.jpg-zcvf test.tgz test/

And look at the explanation of--exclude in Man tar under Linux.

as a PATTERN

Just explained the use of this command, and did not have a special description of its location, after testing also verified that the--exclude in front and back are in force

Conclusion: Mac and Linux platforms many of the commands are similar, but there are some differences that cannot be taken for granted.

The difference between the tar command for Mac--exclude and the tar command--exclude for Linux

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.