Gzip-cd xxxxx | meaning of the path-d xxx-p1 command

Source: Internet
Author: User

A command is used to compile and install PHP during nginx compilation and installation.
"Gzip-cd php-5.2.6.-fpm-0.5.9diff.gz | patch-d php-5.2.6-p1"

The role of this command is to add "php-5.2.6.-fpm" (this is a php management tool recommended by Mr. John) to the PHP source package,

But what does this command mean? After half a day of searching, reading, and thinking, I have roughly understood the meaning of this command and adhered to the boobooke spirit.
This is why we have strengthened our communication during learning and maintained this positive learning status in order to share and consolidate the knowledge we have learned .. what is it ..... learning notes!

This "gzip" is "gun zip". What about the "-cd" used for decompression? -C is "stdout -- to-stdout" to write the result to the standard output. The original file remains unchanged,
In the vernacular, extract and retain the source file. -D is decompression.

What about this patch? We know that it translates into patches. Here we will introduce another tool diff.
In the open-source world, most people spread and update software over the Internet. However, in the early days of the Internet, network bandwidth was very limited,
At this time, diff and patch are generated (diff is about ten years earlier than patch, as described by g.cn)

Diff is mainly used to generate a file, which lists the rows with changed content, displays two original files, modified rows, and
"(In simple words, an update package is generated)

Patch is typically used to update the source code files in a directory to a new version, thus avoiding the need to download the entire new source code file.
(Update with the update package, but the difference is that it updates the source code package, and you have to re-compile and install it after it is finished ).

I will briefly describe the usage of a diff and patch:

Diff a B> C. Generally, A is the original file, B is the modified file, and C is called the patch file of.

A and B can be Files And Directories. If one is A file and the other is A directory, files with the same name under the directory will take effect. If there are two directories,
It applies to all files in the directory, but does not apply recursion. The-r parameter can be used to implement recursion.

Patch usage
  
Or use the above example

PatchAC
After execution, A becomes B. What if the patch is found to be wrong after execution? In this case, you can use the parameter-R (Case Sensitive !)

Patch-r B C can be restored to.

There is also a problem with the path and name of the original file:
The-p parameter determines whether to use the prefix directory information of the read source file name. If the-p parameter is not provided, all directory information is ignored.-p0 (or-p 0) indicates that all path information is used,
-P1 will ignore the previous directory of the first "/", and so on. A file name such as/usr/src/linux-2.4.15/Makefile uses the linux-2.4.15/Makefile as the file to be patched when the-p3 parameter is provided.

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.