[solved] bash: patch: command not found

Programming languages, Coding, executables, and scripting.
Post Reply
Message
Author
User avatar
Onsemeliot
Posts: 285
Joined: 2010-12-15 14:43

[solved] bash: patch: command not found

#1 Post by Onsemeliot »

Sorry, for asking such a probably very trivial question but I am stuck and so far I am unable to find an answer.

I want to apply a patch to a free cpp project I am helping out with as a designer. Somebody provided a .patch file and I expected it would be easy to just do: "$ patch < file.patch" if I am in the right folder on Debian stable. But I get "bash: patch: command not found" as a result and I can't find "patch" as a package in Debian either. So far I was unable to find any hint how I could actually use the patch command on Debian. Everywhere it just seems to be assumed that the patch command works out of the box. Obviously I am missing something here. Can anyone enlighten me?
Last edited by Onsemeliot on 2020-09-26 08:06, edited 1 time in total.

p.H
Posts: 1969
Joined: 2017-09-17 07:12
Been thanked: 9 times

Re: bash: patch: command not found

#2 Post by p.H »

The "patch" command is provided by the "patch" package.
Are your package sources configured properly ?

Code: Select all

apt-cache policy patch

User avatar
Onsemeliot
Posts: 285
Joined: 2010-12-15 14:43

Re: bash: patch: command not found

#3 Post by Onsemeliot »

Thank you for you quick reply, p.H. I don't know of any oddness in my sources:

Code: Select all

# apt-cache policy patch
patch:
  Installed: (none)
  Candidate: 2.7.6-3+deb10u1
  Version table:
     2.7.6-3+deb10u1 500
        500 http://deb.debian.org/debian buster/main amd64 Packages
        500 http://security.debian.org/debian-security buster/updates/main amd64 Packages
But I now successfully ran the command "apt install patch" and it worked. Even if I didn't find the patch package beforehand. Thank you anyway.

Dai_trying
Posts: 967
Joined: 2016-01-07 12:25

Re: [solved] bash: patch: command not found

#4 Post by Dai_trying »

I install command-not-found on a fresh installation and then after running "apt-file update" and "update-command-not-found" I will get some useful information when I try to run a command that doesn't appear to be found, this is also useful for trying to use a command that needs root privileges.

Example #1

Code: Select all

dai@somemachine:~$ foo

Command 'foo' not found, did you mean:

  command 'fop' from deb fop
  command 'fio' from deb fio
  command 'goo' from deb goo

Try: sudo apt install <deb name>
Example #2

Code: Select all

dai@somemachine:~$ blkid
Command 'blkid' is available in the following places
 * /sbin/blkid
 * /usr/sbin/blkid
The command could not be located because '/usr/sbin:/sbin' is not included in the PATH environment variable.
This is most likely caused by the lack of administrative privileges associated with your user account.
blkid: command not found

Post Reply