patch

How To Install Patch In Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS?

How To Install Patch In Debian, Ubuntu, Alpine, Arch, Kali, CentOS, Fedora, Raspbian And MacOS?

patch

Patch a file (or files) with a diff file.
Note that diff files contain both the target filenames and list of changes.

Maintainer: Laszlo Boszormenyi (GCS)



Section: vcs

Install patch

  • Debian apt-get install patch Click to copy
  • Ubuntu apt-get install patch Click to copy
  • Alpine OS apk add patch Click to copy
  • Arch Linux pacman -S patch Click to copy
  • Kali Linux apt-get install patch Click to copy
  • CentOS yum install patch Click to copy
  • Fedora dnf install patch Click to copy
  • Raspbian apt-get install patch Click to copy
  • macOS brew install patch Click to copy

Patch a file (or files) with a diff file. Note that diff files contain both the target filenames and list of changes.

How to use patch?

Below are few example commands for patch that you can use in the terminal.

Apply a patch:
patch < patch_file.diffClick to copy
Apply a patch to current directory:
patch -p1 < patch_file.diffClick to copy
Apply the reverse of a patch:
patch -R < patch_file.diffClick to copy
To install the latest version of patch in your favorite operating system just copy the patch installation command from above and paste it into terminal. It will download and install the latest version of patch 2022 package in your OS.