What is Linux patch ?
Here is patch description from Linux Man pages.
patch - apply a diff file to an original
SYNOPSIS
patch [options] [originalfile [patchfile]]
but usually just
patch -pnum <patchfile
DESCRIPTION
patch takes a patch file patchfile containing a difference listing produced by the diff program and applies those
differences to one or more original files, producing patched versions. Normally the patched versions are put in
place of the originals. Backups can be made; see the -b or --backup option. The names of the files to be patched
are usually taken from the patch file, but if thereâs just one file to be patched it can specified on the command
line as originalfile.
How Linux patch works?
Here is short explanation about How to use patches in linux.
Working with Patch 10 step Guide.
In order to reverse the patch applied run following command.
patch -p 1 -R < learn.patch
Here is patch description from Linux Man pages.
patch - apply a diff file to an original
SYNOPSIS
patch [options] [originalfile [patchfile]]
but usually just
patch -pnum <patchfile
DESCRIPTION
patch takes a patch file patchfile containing a difference listing produced by the diff program and applies those
differences to one or more original files, producing patched versions. Normally the patched versions are put in
place of the originals. Backups can be made; see the -b or --backup option. The names of the files to be patched
are usually taken from the patch file, but if thereâs just one file to be patched it can specified on the command
line as originalfile.
How Linux patch works?
Here is short explanation about How to use patches in linux.
Working with Patch 10 step Guide.
- mkdir patch_test
- cd patch_test/
- mkdir old
- cd old
- create file1.txt and file2.txt
- cd .. ; mkdir new
- cp file.txt and file2.txt == Now change both or any files to create patch
- cd .. ; ls // new and old dir here
- diff -Naur old new > learn.patch ==Your patch is ready.
- patch -p0 < learn.patch == apply patch to old folder; you should be above old dir
In order to reverse the patch applied run following command.
patch -p 1 -R < learn.patch
Comments