Use of patch commands in Linux

Source: Internet
Author: User
Keywords Linux patch command
Tags directory example file information linux name read source

Let's explore the use of patch commands in Linux.

syntax is patch [options] [Originalfile] [Patchfile]

For example:

Patch-p[num] <patchfile

The-p parameter determines whether to use the prefix directory information of the read out source filename, does not provide the-p parameter, ignores all directory information,-p0 (or-P 0) indicates that all path information is used,-P1 ignores the first "/" previous directory, and so on. A file name such as/usr/src/linux-2.4.16/makefile will use Linux-2.4.16/makefile as the file to patch when providing-P3 parameters.

For the example of the Linux kernel source 2.4.16 upgrade package Just given, assume that the source directory is in/usr/src/linux, then use "Patch-p0 <patch-2.4.16" to work when the current directory is/USR/SRC, in the current directory Usr/src/linux, "Patch-p1 <patch-2.4.16" can also work properly.

Related Article

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.