In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Today, the editor shares with you how to use linux's patch command to patch files. I believe many people don't know much about it. In order to make you understand better, I summarized the following contents for you. Let's look down together. I'm sure you'll get something.
The patch command allows users to modify and update the original file by setting the patch file. If only one file is modified at a time, instructions can be issued directly in the instruction column to be executed 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.
Syntax format: patch [parameters]
Common parameters:
-b backup each original file-B setting file backup, a prefix string appended to the file name, which can be the path name-c interprets the patch data into relevance differences-d setting working directory-D marks the changes with the specified symbol-e interprets the patch data into a narrative file available for the ed instruction-E if the output file after patching is blank Then remove the file-f the effect of this parameter is similar to that of the specified "- t:" parameter, but assumes that the version of the patch data is the new version-F sets the maximum number of monitored columns-g setting controls the patch job by RSC or SCCS-I reads the specified patch file-l ignores the tabs of patch data and input data The space character-n interprets the patch data into general differences-N ignores that the patched data is older than the version of the original file, or that the patched data has been used to set the name of the output file, the patched file is stored with that name-p setting to split several layers of path name-f setting to save the name of the file that refuses patching information The default file name is .rej-R assuming 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, does not ask any questions-T the effect of this parameter is similar to that of specifying the "- Z" parameter However, it is mainly local time-u interprets the patch data into consistent differences-v displays version information-V backs up the target file with the "- b" parameter, the suffix of the backup file is appended with a backup string, this string can not only be changed with the "- z" parameter, when using "- V" When the parameter specifies different backup methods, it will also produce backup strings with different suffixes-Y sets the file backup with the initial string-z appended to the beginning of the basic name of the file. The effect of this parameter is similar to that of the specified "- B" parameter, except that the path used by the repair job is the same as if the file name is src/linux/fs/super.c and the "backup/" string is added. 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. And do not back up files when they are not deliberately specified-- verbose shows the execution of the instructions in detail
Reference example
Use the patch directive to upgrade the file "file1" with the upgrade patch file "file.patch":
[root@linuxcool ~] # patch-p0 file1 file.patch
Use patch to apply patches:
[root@linuxcool ~] # patch-p0 < foo.patch on how to use linux's patch command to patch files is shared here, I hope the above content can have a certain reference value for everyone, you can learn to apply. If you like this article, you might as well share it for more people to see.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.