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 ...

Get Linux in a Nutshell, Third 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.