Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
given a command name, what is the best way to find its full path in order to be able to run that command in a situation where PATH is not set?
i originally have used the shell command "which" to quickly find this. but, recent versions of Ubuntu have merged /bin and /usr/bin such that there is one directory having all these files and references to either go to that one directory. the result is that every name is found in the first of these directories listed in PATH.
On my recent *buntu and debian installations, /bin is just a symlink to /usr/bin. However, /usr/bin is listed before /bin in PATH so the which command gives the path as /usr/bin/<command>. If no PATH is set or the application is not in PATH, the simplest way I can think of to find its location is with the find command:
which works on PATH (see man which). Otherwise you can use locate, find, whereis, you can check your installed packages, and there is a /usr/lib/command-not-found (or something similar), but in general there is no way to identify arbitrary binaries in any system.
i failed to explain well what i am looking for. i want to find the one and only "official" path of where a command is generally supposed to be found, like "ls" is supposed be at "/bin/ls".
write a script that checks all the directories listed in PATH and report all rogues and missing commands in the system it is run on, for a full set of command names or those given as arguments.
i failed to explain well what i am looking for. i want to find the one and only "official" path of where a command is generally supposed to be found, like "ls" is supposed be at "/bin/ls".
Just because a cmd doesn't exist on a system, it doesn't necessarily mean it should be there. Systems vary enormously...
If your distro is RPM based, the rpm -V (plus more options) can check verify installed pkgs against what the rpmdb says it should be.
See also https://www.cyberciti.biz/tips/reset...ermission.html to fix various errors.
Just because a cmd doesn't exist on a system, it doesn't necessarily mean it should be there. Systems vary enormously...
rogues are commands that are there but not what you expect them to be.
missing are commands you expected to be there but are not there.
that systems vary enormously is all the more reason to write such a script.
Quote:
Originally Posted by chrism01
If your distro is RPM based, the rpm -V (plus more options) can check verify installed pkgs against what the rpmdb says it should be.
See also https://www.cyberciti.biz/tips/reset...ermission.html to fix various errors.
i'll skip this, for now. i no longer have any RPM based distros. when i get a current project ready to deploy on AWS, i might have quite a few. for now, i'm running Xubuntu 20.04.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.