Users browsing this thread: 1 Guest(s)
xero
Long time nixers
* note i'm truncating the output of these commands as an example *

the posix way is to use "command":
Code:
[~]── - command -v 2bwm
/usr/local/bin/2bwm

there's also "whereis":

Code:
[~]── - whereis 2bwm
2bwm: /usr/local/bin/2bwm

the "locate" command finds files by name:

Code:
[~]── - locate 2bwm
/home/xero/dotfiles/2bwm
/home/xero/src/2bwm/2bwm.c
/usr/local/man/man1/2bwm.1
/usr/local/share/man/man1/2bwm.1

but "which" is my favorite:
Code:
[~]── - which 2bwm
/usr/local/bin/2bwm

you can use the "find" utility with the name flag:
Code:
[~]── - find -name 2bwm
./dotfiles/2bwm
./src/2bwm
./src/2bwm/2bwm

you also have other tools you can install to aid in your searching.

"ag", the silver searcher, can search file contents (default) or file and location names with the -g flag
Code:
[~]── - ag -g 2bwm
dotfiles/2bwm/bin/wm
src/2bwm/2bwm.c
src/2bwm/tags
src/2bwm/Makefile

you can get the same results with ack, but it's much slower.
Code:
[~]── - ack -g 2bwm
dotfiles/2bwm/bin/wm
src/2bwm/2bwm.c
src/2bwm/tags
src/2bwm/Makefile

you can also search the inverse way looking for binaries by man page topics using "apropos":

Code:
[~]── - apropos "window manager"
2bwm (1)             - A small and fast keyboard driven window manager with two borders.

package managers can also give you some good info:

on arch "pacman" can display a file install location list based on package name:
Code:
[~]── - pacman -Ql php
php /etc/
php /etc/php/
php /etc/php/conf.d/
php /etc/php/php.ini
php /usr/
php /usr/bin/
php /usr/bin/phar
php /usr/bin/phar.phar
php /usr/bin/php
php /usr/share/man/man1/phar.1.gz
php /usr/share/man/man1/phar.phar.1.gz
php /usr/share/man/man1/php-config.1.gz
php /usr/share/man/man1/php.1.gz

if you use an "rpm" based distribution (centOS, rhel, SUSE, opensuse, etc):

Code:
[~]── - rpm -ql findutils
/bin/find
/usr/bin/find
/usr/bin/xargs

if you use a "dpkg" based dist (debian, ubuntu and it's derivatives):
Code:
[~]── - dpkg --status some_package
[~]── - dpkg --listfiles some_package
[~]── - dpkg --search some_file


Messages In This Thread
Where is what - by venam - 05-06-2017, 11:19 AM
RE: Where is what - by evbo - 05-06-2017, 12:20 PM
RE: Where is what - by xero - 05-06-2017, 12:58 PM
RE: Where is what - by alxndr - 05-06-2017, 03:13 PM
RE: Where is what - by yossarian - 05-06-2017, 10:02 PM
RE: Where is what - by venam - 06-06-2017, 01:13 PM
RE: Where is what - by jkl - 06-06-2017, 01:17 PM
RE: Where is what - by venam - 06-06-2017, 01:26 PM
RE: Where is what - by venam - 23-11-2021, 01:45 PM
RE: Where is what - by neeasade - 29-11-2021, 02:03 PM
RE: Where is what - by z3bra - 29-11-2021, 07:50 PM
RE: Where is what - by neeasade - 30-11-2021, 02:26 AM