Name
patch
Synopsis
patch [options
] [original
[patchfile
]]
Apply the patches specified in patchfile to original. Replace the original with the new, patched version; move the original to original.orig or original~. The patch file is a difference listing produced by the diff command.
Options
- -b, --backup
Back up the original file.
- --backup-if-mismatch, --no-backup-if-mismatch
When not backing up all original files, these options control whether a backup should be made when a patch does not match the original file. The default is to make backups unless --posix is specified.
- -c, --context
Interpret patchfile as a context diff.
- -d dir, --directory= dir
cd to directory before beginning patch operations.
- --dry-run
Print results of applying a patch, but don’t change any files.
- -e, --ed
Treat the contents of patchfile as ed commands.
- -f, --force
Force all changes, even those that look incorrect. Skip patches if the original file does not exist; force patches for files with the wrong version specified; assume patches are never reversed.
- -g num, --get num
Specify whether to check the original file out of source control if it is missing or read-only. If num is a positive number, get the file. If it is negative, prompt the user. If it is 0, do not check files out of source control. The default is negative or the value of the PATCH_GET environment variable when set, unless the --posix option is given. Then the default is 0.
- --help
Print help message, then exit.
- -i file, --input= file
Read patch ...
Get Linux in a Nutshell, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.