O'Reilly logo

Linux in a Nutshell, 6th Edition by Robert Love, Stephen Figgins, Ellen Siever, Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

-B prefix, --prefix=prefix

Prepend prefix to the backup filename.

--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 dir before beginning patch operations.

-D string, --ifdef=string

Mark all changes with:

#ifdef
   string
#endif
--dry-run

Print results of applying a patch, but don’t change any files.

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

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

-g num, --get num

Specify whether to check the original file out of source control if it ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required