[solved] bash: patch: command not found

Need help with C, C++, perl, python, etc?

[solved] bash: patch: command not found

Postby Onsemeliot » 2020-09-26 07:40

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.
User avatar
Onsemeliot
 
Posts: 274
Joined: 2010-12-15 14:43

Re: bash: patch: command not found

Postby p.H » 2020-09-26 07:49

The "patch" command is provided by the "patch" package.
Are your package sources configured properly ?
Code: Select all
apt-cache policy patch
p.H
 
Posts: 1489
Joined: 2017-09-17 07:12

Re: bash: patch: command not found

Postby Onsemeliot » 2020-09-26 08:06

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.
User avatar
Onsemeliot
 
Posts: 274
Joined: 2010-12-15 14:43

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

Postby Dai_trying » 2020-09-27 08:05

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
Dai_trying
 
Posts: 943
Joined: 2016-01-07 12:25


Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable