Linux in a Nutshell, Third Edition
by Ellen Siever, Stephen Spainhour, Jessica P. Hekman, Stephen Figgins
Name
patch
Synopsis
patch [options] [original [patchfile]]
Description
Apply the patches specified in patchfile to original. Replace the original with the new, patched version; move the original to original.orig or original~.
Options
- + [options] [original2]
Apply patches again, with different options or a different original file.
- -b, --backup
Back up the original file.
- -z suffix, --suffix= suffix
Back up the original file in original.suffix.
- -B prefix, --prefix= prefix
Prepend prefix to the backup filename.
- -c, --context
Interpret patchfile as a context diff.
- -d dir, --directory= dir
cd to directory before beginning patch operations.
- -D string, --ifdef= string
Mark all changes with:
#ifdef
string
#endif- -e, --ed
Treat the contents of patchfile as ed commands.
- -E, --remove-empty-files
If patch creates any empty files, delete them.
- -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.
- -i file, --input= file
Read patch from file instead of stdin.
- -t, --batch
Skip patches if the original file does not exist.
- -F num, --fuzz= num
Specify the maximum number of lines that may be ignored (fuzzed over) when deciding where to install a hunk of code. The default is 2. Meaningful only with context diffs.
- -l, --ignore-whitespace
Ignore whitespace while pattern matching.
- -n, --normal
Interpret patch file as a normal diff.
- -N, --forward
Ignore patches ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access