Skip to Main Content
Unix in a Nutshell, 4th Edition
book

Unix in a Nutshell, 4th Edition

by Arnold Robbins
October 2005
Intermediate to advanced content levelIntermediate to advanced
908 pages
46h 42m
English
O'Reilly Media, Inc.
Content preview from Unix in a Nutshell, 4th Edition

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. On Solaris, this command is named gpatch.

URL: http://www.gnu.org/software/patch.

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.

--binary

Read and write files as binary. Has no effect on a Unix system.

-Bprefix, --prefix=prefix

Prepend prefix to the backup filename.

-c, --context

Interpret patchfile as a context diff.

-ddir, --directory=dir

cd to directory before beginning patch operations.

--dry-run

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

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

-Fnum, --fuzz=num

Specify the maximum number of lines that may be ignored (fuzzed over) when deciding where to install ...

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.
Start your free trial

You might also like

Learning the Unix Operating System, 5th Edition

Learning the Unix Operating System, 5th Edition

John Strang, Grace Todino, Jerry Peek
UNIX and Linux System Administration Handbook, 5th Edition

UNIX and Linux System Administration Handbook, 5th Edition

Trent R. Hein, Evi Nemeth, Garth Snyder, Ben Whaley, Dan Mackin

Publisher Resources

ISBN: 0596100299Errata Page