Finding the package which provides a given commandHow to find out which (not installed) Debian package a file belongs to?How to implement package install suggestion on Debian?How to install Debian package with file extension .debWhy is the Provides field in the local Debian package ignored (DepCompareOp)?How to get all the dependencies for a packageHow can I find the package that contains a program in Debian?Get name of package containing a given binaryFind which files in a folder are not known to the apt package managerlibcodec and libcodec2-dev do not exist in Debian 8Given a debian package name, how do I get a URL to the latest .deb URL?Find out which repository package provides a command
Memory capability and powers of 2
Airplanes in static display at Whiteman AFB
Strange Cron Job takes up 100% of CPU Ubuntu 18 LTS Server
Is my employer paying me fairly? Going from 1099 to W2
How important is a good quality camera for good photography?
Replacing tongue and groove floorboards: but can't find a match
High income, sudden windfall
On the strategic interest of giving long lasting stock orders
Is it legal to use cash pulled from a credit card to pay the monthly payment on that credit card?
What is the lowest-speed bogey a jet fighter can intercept/escort?
What exactly makes a General Products hull nearly indestructible?
TSA asking to see cell phone
How do professional electronic musicians/sound engineers combat listening fatigue?
Why is a dedicated QA team member necessary?
How can I tell if there was a power cut while I was out?
Why can't my huge trees be chopped down?
Why isn't there a serious attempt at creating a third mass-appeal party in the US?
Spoken encryption
Commercial jet accompanied by small plane near Seattle
Why is chess failing to attract big name sponsors?
How can I receive packages while in France?
Difficulty pronouncing "maths", "baths", "hundredths", "sixths"
Invert Some Switches on a Switchboard
What is the max number of outlets on a GFCI circuit?
Finding the package which provides a given command
How to find out which (not installed) Debian package a file belongs to?How to implement package install suggestion on Debian?How to install Debian package with file extension .debWhy is the Provides field in the local Debian package ignored (DepCompareOp)?How to get all the dependencies for a packageHow can I find the package that contains a program in Debian?Get name of package containing a given binaryFind which files in a folder are not known to the apt package managerlibcodec and libcodec2-dev do not exist in Debian 8Given a debian package name, how do I get a URL to the latest .deb URL?Find out which repository package provides a command
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
If the package command-not-found
is installed and a user tries to run a command which is not present on the system, a suggestion is printed with the name of the package which provides the executable. Is there a command with the same functionality but which takes the name of an executable as an argument?
Edit: I have read How to find out which (not installed) Debian package a file belongs to? but none of the suggestions present a command which gives an unambiguous result like command-not-found
.
debian apt
add a comment |
If the package command-not-found
is installed and a user tries to run a command which is not present on the system, a suggestion is printed with the name of the package which provides the executable. Is there a command with the same functionality but which takes the name of an executable as an argument?
Edit: I have read How to find out which (not installed) Debian package a file belongs to? but none of the suggestions present a command which gives an unambiguous result like command-not-found
.
debian apt
Possible duplicate of How to find out which (not installed) Debian package a file belongs to?
– muru
Jul 16 at 9:18
1
@muru See edit.
– August Karlstrom
Jul 16 at 9:52
I don't see anything ambiguous about the output ofpackage: filename
, but whatever you say.
– muru
Jul 16 at 9:57
@muruapt-file search
requires and provides details which I don't care for, for instance you need to provide the path/usr/bin
to the command in question.
– August Karlstrom
Jul 16 at 12:18
add a comment |
If the package command-not-found
is installed and a user tries to run a command which is not present on the system, a suggestion is printed with the name of the package which provides the executable. Is there a command with the same functionality but which takes the name of an executable as an argument?
Edit: I have read How to find out which (not installed) Debian package a file belongs to? but none of the suggestions present a command which gives an unambiguous result like command-not-found
.
debian apt
If the package command-not-found
is installed and a user tries to run a command which is not present on the system, a suggestion is printed with the name of the package which provides the executable. Is there a command with the same functionality but which takes the name of an executable as an argument?
Edit: I have read How to find out which (not installed) Debian package a file belongs to? but none of the suggestions present a command which gives an unambiguous result like command-not-found
.
debian apt
debian apt
edited Jul 16 at 9:51
August Karlstrom
asked Jul 16 at 9:08
August KarlstromAugust Karlstrom
4061 gold badge12 silver badges32 bronze badges
4061 gold badge12 silver badges32 bronze badges
Possible duplicate of How to find out which (not installed) Debian package a file belongs to?
– muru
Jul 16 at 9:18
1
@muru See edit.
– August Karlstrom
Jul 16 at 9:52
I don't see anything ambiguous about the output ofpackage: filename
, but whatever you say.
– muru
Jul 16 at 9:57
@muruapt-file search
requires and provides details which I don't care for, for instance you need to provide the path/usr/bin
to the command in question.
– August Karlstrom
Jul 16 at 12:18
add a comment |
Possible duplicate of How to find out which (not installed) Debian package a file belongs to?
– muru
Jul 16 at 9:18
1
@muru See edit.
– August Karlstrom
Jul 16 at 9:52
I don't see anything ambiguous about the output ofpackage: filename
, but whatever you say.
– muru
Jul 16 at 9:57
@muruapt-file search
requires and provides details which I don't care for, for instance you need to provide the path/usr/bin
to the command in question.
– August Karlstrom
Jul 16 at 12:18
Possible duplicate of How to find out which (not installed) Debian package a file belongs to?
– muru
Jul 16 at 9:18
Possible duplicate of How to find out which (not installed) Debian package a file belongs to?
– muru
Jul 16 at 9:18
1
1
@muru See edit.
– August Karlstrom
Jul 16 at 9:52
@muru See edit.
– August Karlstrom
Jul 16 at 9:52
I don't see anything ambiguous about the output of
package: filename
, but whatever you say.– muru
Jul 16 at 9:57
I don't see anything ambiguous about the output of
package: filename
, but whatever you say.– muru
Jul 16 at 9:57
@muru
apt-file search
requires and provides details which I don't care for, for instance you need to provide the path /usr/bin
to the command in question.– August Karlstrom
Jul 16 at 12:18
@muru
apt-file search
requires and provides details which I don't care for, for instance you need to provide the path /usr/bin
to the command in question.– August Karlstrom
Jul 16 at 12:18
add a comment |
2 Answers
2
active
oldest
votes
You can use command-not-found
itself:
command-not-found --ignore-installed ls
will tell you which package contains the ls
command. (--ignore-installed
avoids taking into account installed packages, and in particular ensures that the command isn’t run immediately if it’s already installed.)
Alternatively, you can use apt-file
:
apt-file search bin/ls
will list all packages containing a file whose path contains “bin/ls”. You can filter this to match only ls
:
apt-file search bin/ls | grep bin/ls$
1
@Inian I don’t know. The question is tagged debian so I answered for Debian.
– Stephen Kitt
Jul 16 at 9:23
apt-file
has options-x
(--regexp
) and-F
(--fixed-string
), so you probably don't need to pipe togrep
. For e.g.,apt-file search -lF bin/ls
=>coreutils
– muru
Jul 16 at 10:03
@muru-F
requires knowing the full path;bin/
in a substring match will find binaries in/bin
,/sbin
,/usr/bin
and/usr/sbin
.apt-file
with-x
is very slow.
– Stephen Kitt
Jul 16 at 11:10
add a comment |
Yes, the command is command-not-found
:
$ command-not-found firefox
The program 'firefox' is currently not installed. To run 'firefox' please ask your administrator to
install the package 'firefox-esr'
firefox: command not found
This has exactly the same functionality, because it is what the shell traps run to produce that output automatically already.
You can also use apt-file search firefox
to find any matching files in a package.
Which packages provides this? On Centos 7 I havecommand_not_found_handle
whose definition is just a shell function
– Inian
Jul 16 at 9:18
On Debian, it’s incommand-not-found
.
– Stephen Kitt
Jul 16 at 9:18
One potentially annoying side-effect of this is that, if the command is available, it will be run immediately.
– Stephen Kitt
Jul 16 at 9:19
@Inian Fedora hasPackageKit-command-not-found
, the name is likely the same in CentOS if it uses PackageKit. (Presumably CentOS 8 will — it's still not out yet, right? — but I'm not sure if 7 did.) ETA: Andcommand_not_found_handle
, which is in/etc/profile.d/PackageKit.sh
, is definitely provided byPackageKit-command-not-found
.
– FeRD
Jul 16 at 20:15
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f530413%2ffinding-the-package-which-provides-a-given-command%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use command-not-found
itself:
command-not-found --ignore-installed ls
will tell you which package contains the ls
command. (--ignore-installed
avoids taking into account installed packages, and in particular ensures that the command isn’t run immediately if it’s already installed.)
Alternatively, you can use apt-file
:
apt-file search bin/ls
will list all packages containing a file whose path contains “bin/ls”. You can filter this to match only ls
:
apt-file search bin/ls | grep bin/ls$
1
@Inian I don’t know. The question is tagged debian so I answered for Debian.
– Stephen Kitt
Jul 16 at 9:23
apt-file
has options-x
(--regexp
) and-F
(--fixed-string
), so you probably don't need to pipe togrep
. For e.g.,apt-file search -lF bin/ls
=>coreutils
– muru
Jul 16 at 10:03
@muru-F
requires knowing the full path;bin/
in a substring match will find binaries in/bin
,/sbin
,/usr/bin
and/usr/sbin
.apt-file
with-x
is very slow.
– Stephen Kitt
Jul 16 at 11:10
add a comment |
You can use command-not-found
itself:
command-not-found --ignore-installed ls
will tell you which package contains the ls
command. (--ignore-installed
avoids taking into account installed packages, and in particular ensures that the command isn’t run immediately if it’s already installed.)
Alternatively, you can use apt-file
:
apt-file search bin/ls
will list all packages containing a file whose path contains “bin/ls”. You can filter this to match only ls
:
apt-file search bin/ls | grep bin/ls$
1
@Inian I don’t know. The question is tagged debian so I answered for Debian.
– Stephen Kitt
Jul 16 at 9:23
apt-file
has options-x
(--regexp
) and-F
(--fixed-string
), so you probably don't need to pipe togrep
. For e.g.,apt-file search -lF bin/ls
=>coreutils
– muru
Jul 16 at 10:03
@muru-F
requires knowing the full path;bin/
in a substring match will find binaries in/bin
,/sbin
,/usr/bin
and/usr/sbin
.apt-file
with-x
is very slow.
– Stephen Kitt
Jul 16 at 11:10
add a comment |
You can use command-not-found
itself:
command-not-found --ignore-installed ls
will tell you which package contains the ls
command. (--ignore-installed
avoids taking into account installed packages, and in particular ensures that the command isn’t run immediately if it’s already installed.)
Alternatively, you can use apt-file
:
apt-file search bin/ls
will list all packages containing a file whose path contains “bin/ls”. You can filter this to match only ls
:
apt-file search bin/ls | grep bin/ls$
You can use command-not-found
itself:
command-not-found --ignore-installed ls
will tell you which package contains the ls
command. (--ignore-installed
avoids taking into account installed packages, and in particular ensures that the command isn’t run immediately if it’s already installed.)
Alternatively, you can use apt-file
:
apt-file search bin/ls
will list all packages containing a file whose path contains “bin/ls”. You can filter this to match only ls
:
apt-file search bin/ls | grep bin/ls$
answered Jul 16 at 9:17
Stephen KittStephen Kitt
197k26 gold badges464 silver badges537 bronze badges
197k26 gold badges464 silver badges537 bronze badges
1
@Inian I don’t know. The question is tagged debian so I answered for Debian.
– Stephen Kitt
Jul 16 at 9:23
apt-file
has options-x
(--regexp
) and-F
(--fixed-string
), so you probably don't need to pipe togrep
. For e.g.,apt-file search -lF bin/ls
=>coreutils
– muru
Jul 16 at 10:03
@muru-F
requires knowing the full path;bin/
in a substring match will find binaries in/bin
,/sbin
,/usr/bin
and/usr/sbin
.apt-file
with-x
is very slow.
– Stephen Kitt
Jul 16 at 11:10
add a comment |
1
@Inian I don’t know. The question is tagged debian so I answered for Debian.
– Stephen Kitt
Jul 16 at 9:23
apt-file
has options-x
(--regexp
) and-F
(--fixed-string
), so you probably don't need to pipe togrep
. For e.g.,apt-file search -lF bin/ls
=>coreutils
– muru
Jul 16 at 10:03
@muru-F
requires knowing the full path;bin/
in a substring match will find binaries in/bin
,/sbin
,/usr/bin
and/usr/sbin
.apt-file
with-x
is very slow.
– Stephen Kitt
Jul 16 at 11:10
1
1
@Inian I don’t know. The question is tagged debian so I answered for Debian.
– Stephen Kitt
Jul 16 at 9:23
@Inian I don’t know. The question is tagged debian so I answered for Debian.
– Stephen Kitt
Jul 16 at 9:23
apt-file
has options -x
(--regexp
) and -F
(--fixed-string
), so you probably don't need to pipe to grep
. For e.g., apt-file search -lF bin/ls
=> coreutils
– muru
Jul 16 at 10:03
apt-file
has options -x
(--regexp
) and -F
(--fixed-string
), so you probably don't need to pipe to grep
. For e.g., apt-file search -lF bin/ls
=> coreutils
– muru
Jul 16 at 10:03
@muru
-F
requires knowing the full path; bin/
in a substring match will find binaries in /bin
, /sbin
, /usr/bin
and /usr/sbin
. apt-file
with -x
is very slow.– Stephen Kitt
Jul 16 at 11:10
@muru
-F
requires knowing the full path; bin/
in a substring match will find binaries in /bin
, /sbin
, /usr/bin
and /usr/sbin
. apt-file
with -x
is very slow.– Stephen Kitt
Jul 16 at 11:10
add a comment |
Yes, the command is command-not-found
:
$ command-not-found firefox
The program 'firefox' is currently not installed. To run 'firefox' please ask your administrator to
install the package 'firefox-esr'
firefox: command not found
This has exactly the same functionality, because it is what the shell traps run to produce that output automatically already.
You can also use apt-file search firefox
to find any matching files in a package.
Which packages provides this? On Centos 7 I havecommand_not_found_handle
whose definition is just a shell function
– Inian
Jul 16 at 9:18
On Debian, it’s incommand-not-found
.
– Stephen Kitt
Jul 16 at 9:18
One potentially annoying side-effect of this is that, if the command is available, it will be run immediately.
– Stephen Kitt
Jul 16 at 9:19
@Inian Fedora hasPackageKit-command-not-found
, the name is likely the same in CentOS if it uses PackageKit. (Presumably CentOS 8 will — it's still not out yet, right? — but I'm not sure if 7 did.) ETA: Andcommand_not_found_handle
, which is in/etc/profile.d/PackageKit.sh
, is definitely provided byPackageKit-command-not-found
.
– FeRD
Jul 16 at 20:15
add a comment |
Yes, the command is command-not-found
:
$ command-not-found firefox
The program 'firefox' is currently not installed. To run 'firefox' please ask your administrator to
install the package 'firefox-esr'
firefox: command not found
This has exactly the same functionality, because it is what the shell traps run to produce that output automatically already.
You can also use apt-file search firefox
to find any matching files in a package.
Which packages provides this? On Centos 7 I havecommand_not_found_handle
whose definition is just a shell function
– Inian
Jul 16 at 9:18
On Debian, it’s incommand-not-found
.
– Stephen Kitt
Jul 16 at 9:18
One potentially annoying side-effect of this is that, if the command is available, it will be run immediately.
– Stephen Kitt
Jul 16 at 9:19
@Inian Fedora hasPackageKit-command-not-found
, the name is likely the same in CentOS if it uses PackageKit. (Presumably CentOS 8 will — it's still not out yet, right? — but I'm not sure if 7 did.) ETA: Andcommand_not_found_handle
, which is in/etc/profile.d/PackageKit.sh
, is definitely provided byPackageKit-command-not-found
.
– FeRD
Jul 16 at 20:15
add a comment |
Yes, the command is command-not-found
:
$ command-not-found firefox
The program 'firefox' is currently not installed. To run 'firefox' please ask your administrator to
install the package 'firefox-esr'
firefox: command not found
This has exactly the same functionality, because it is what the shell traps run to produce that output automatically already.
You can also use apt-file search firefox
to find any matching files in a package.
Yes, the command is command-not-found
:
$ command-not-found firefox
The program 'firefox' is currently not installed. To run 'firefox' please ask your administrator to
install the package 'firefox-esr'
firefox: command not found
This has exactly the same functionality, because it is what the shell traps run to produce that output automatically already.
You can also use apt-file search firefox
to find any matching files in a package.
edited Jul 16 at 9:18
answered Jul 16 at 9:15
Michael HomerMichael Homer
54.2k9 gold badges152 silver badges185 bronze badges
54.2k9 gold badges152 silver badges185 bronze badges
Which packages provides this? On Centos 7 I havecommand_not_found_handle
whose definition is just a shell function
– Inian
Jul 16 at 9:18
On Debian, it’s incommand-not-found
.
– Stephen Kitt
Jul 16 at 9:18
One potentially annoying side-effect of this is that, if the command is available, it will be run immediately.
– Stephen Kitt
Jul 16 at 9:19
@Inian Fedora hasPackageKit-command-not-found
, the name is likely the same in CentOS if it uses PackageKit. (Presumably CentOS 8 will — it's still not out yet, right? — but I'm not sure if 7 did.) ETA: Andcommand_not_found_handle
, which is in/etc/profile.d/PackageKit.sh
, is definitely provided byPackageKit-command-not-found
.
– FeRD
Jul 16 at 20:15
add a comment |
Which packages provides this? On Centos 7 I havecommand_not_found_handle
whose definition is just a shell function
– Inian
Jul 16 at 9:18
On Debian, it’s incommand-not-found
.
– Stephen Kitt
Jul 16 at 9:18
One potentially annoying side-effect of this is that, if the command is available, it will be run immediately.
– Stephen Kitt
Jul 16 at 9:19
@Inian Fedora hasPackageKit-command-not-found
, the name is likely the same in CentOS if it uses PackageKit. (Presumably CentOS 8 will — it's still not out yet, right? — but I'm not sure if 7 did.) ETA: Andcommand_not_found_handle
, which is in/etc/profile.d/PackageKit.sh
, is definitely provided byPackageKit-command-not-found
.
– FeRD
Jul 16 at 20:15
Which packages provides this? On Centos 7 I have
command_not_found_handle
whose definition is just a shell function– Inian
Jul 16 at 9:18
Which packages provides this? On Centos 7 I have
command_not_found_handle
whose definition is just a shell function– Inian
Jul 16 at 9:18
On Debian, it’s in
command-not-found
.– Stephen Kitt
Jul 16 at 9:18
On Debian, it’s in
command-not-found
.– Stephen Kitt
Jul 16 at 9:18
One potentially annoying side-effect of this is that, if the command is available, it will be run immediately.
– Stephen Kitt
Jul 16 at 9:19
One potentially annoying side-effect of this is that, if the command is available, it will be run immediately.
– Stephen Kitt
Jul 16 at 9:19
@Inian Fedora has
PackageKit-command-not-found
, the name is likely the same in CentOS if it uses PackageKit. (Presumably CentOS 8 will — it's still not out yet, right? — but I'm not sure if 7 did.) ETA: And command_not_found_handle
, which is in /etc/profile.d/PackageKit.sh
, is definitely provided by PackageKit-command-not-found
.– FeRD
Jul 16 at 20:15
@Inian Fedora has
PackageKit-command-not-found
, the name is likely the same in CentOS if it uses PackageKit. (Presumably CentOS 8 will — it's still not out yet, right? — but I'm not sure if 7 did.) ETA: And command_not_found_handle
, which is in /etc/profile.d/PackageKit.sh
, is definitely provided by PackageKit-command-not-found
.– FeRD
Jul 16 at 20:15
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f530413%2ffinding-the-package-which-provides-a-given-command%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Possible duplicate of How to find out which (not installed) Debian package a file belongs to?
– muru
Jul 16 at 9:18
1
@muru See edit.
– August Karlstrom
Jul 16 at 9:52
I don't see anything ambiguous about the output of
package: filename
, but whatever you say.– muru
Jul 16 at 9:57
@muru
apt-file search
requires and provides details which I don't care for, for instance you need to provide the path/usr/bin
to the command in question.– August Karlstrom
Jul 16 at 12:18