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 the patch command in Linux

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the relevant knowledge of "how to use patch commands in Linux". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The patch command is used to install patches for open source software. Let the user modify and update the original file by setting up and patching the file. If you modify only one file at a time, you can issue instructions directly in the command line to execute in sequence. If you cooperate with the way of patching files, you can repair a large number of files at one time, which is also one of the core upgrade methods of the Linux system.

Grammatical format

Patch [parameters]

Common parameter:-b backup each original file-B sets the prefix string that is appended to the file name when backing up the file The string can be a path name-c interprets the patch data into relevance differences-d sets the working directory-D marks the changes with the specified symbol-e interprets the patch data into a narrative file available to the ed instruction-E if the contents of the output file after patching are blank, the effect of removing the file-f this parameter is similar to the specified "- t" parameter However, it is assumed that the version of the patch data is the new version-F sets the maximum number of columns monitored-g setting controls the patch job with RSC or SCCS-I reads the specified patch file-l ignores the tabs of the patch data and the input data, the space character-n interprets the patch data into a general difference-N ignores that the patched data is older than the version of the original file Or this version of the patch data has been used to set the name of the output file, and the patched file will store-p setting to split several layers of path name-f setting to save the file name that refuses to patch related information, and the preset file name is. Rej-R assumes that the patch data is generated by the exchange location of the old and new files-s does not show the instruction execution process unless an error occurs-t automatically skips the error Do not ask any questions-T the effect of this parameter is similar to specifying the "- Z" parameter, but mainly local time-u interprets the patch data into consistent differences-v displays version information-after V backs up the target file with the "- b" parameter, the suffix of the backup file is appended with a backup string, which can not only be changed with the "- z" parameter, but also when the "- V" parameter is used to specify different backup methods. Backup strings with different suffixes are also generated-Y sets the prefix string-z appended to the beginning of the file base name when backing up files. The effect of this parameter is similar to that of specifying the "- B" parameter, except that the path used by the repair job is similar to that used by the file name src/linux/fs/super.c, followed by the "backup/" string. The file super.c will be backed up in the / src/linux/fs/backup directory-Z changes the patched files, and the access time will be set to UTC-backup-if-mismatch when the patched data does not exactly match and the file is not deliberately specified to be backed up-binary reads and writes data in binary mode instead of using the standard output device-help to view help information-nobackup-if-mismatch does not exactly match the patched data. Do not back up files when they are not deliberately specified-verbose shows the execution process of the instruction in detail.

Use the patch directive to upgrade the file "file1" with the upgrade patch file "file.patch":

[root@linux265 ~] # patch-p0 file1 file.patch

Use patch to apply patches:

This is the end of [root@linux265] # patch-p0 "how to use patch commands in Linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Development

Wechat

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

12
Report