Путь до приложения linux

How to find the installation path for a software under linux?

Under linux, I launch a software by typing, e.g., fluidplot. How can I find the installation path for this software?

9 Answers 9

to see where it is executing from (if it’s in your $PATH). Or:

find / -name fluidpoint 2> /dev/null 

to look for a file named fluipoint and redirect errors on virtual filesystems.

Usually they are in /sbin , /usr/sbin , /usr/local/bin or ~ as a hidden directory.

NAME which - shows the full path of (shell) commands. SYNOPSIS which [options] [--] programname [. ] 

@Michael excellent to know. Because of your comment, I just discovered that newer versions of bash also do this. +1 to your comment.

The «Usually they are . » line is pretty disingenuous, additional software should be in /opt/* or /usr/local/bin . ~ is your home directory, I’m confused why you call it «hidden».

Sorry to be ambiguous, I mean ~/.dir . The hidden directory is below the home directory. And I completely forgot about /usr/local/bin dop.

If you use an RPM based distribution (CentOS, RHEL, SUSE, openSUSE) you can use rpm -ql

rpm -ql findutils /bin/find /usr/bin/find /usr/bin/xargs /usr/share/doc/packages/findutils /usr/share/doc/packages/findutils/AUTHORS /usr/share/doc/packages/findutils/COPYING /usr/share/doc/packages/findutils/NEWS /usr/share/doc/packages/findutils/README /usr/share/doc/packages/findutils/THANKS /usr/share/doc/packages/findutils/TODO /usr/share/info/find.info.gz /usr/share/man/man1/find.1.gz 

Things aren’t installed to locations in the Linux/UNIX world like they are in the Windows (and even somewhat in the Mac) world. They are more distributed. Binaries are in /bin or /sbin , libraries are in /lib , icons/graphics/docs are in /share, configuration is in /etc and program data is in /var .

Читайте также:  Linux log files network

The /bin , /lib , /sbin contain the core applications needed for booting and the /usr contains all the other user and system applications.

Just to add some point to @djsumdog’s answer, if you are using DPKG based dist, like Ubuntu, you can use

to check what it is about, and

dpkg --listfiles some_package 

to check what files are included/relevant to this package. It’s for packages that don’t have a binary to run, like libnss3 . And

to find what package includes this file.

For example, dpkg —listfiles libnss3 gives me:

/. /usr /usr/lib /usr/lib/i386-linux-gnu /usr/lib/i386-linux-gnu/libssl3.so /usr/lib/i386-linux-gnu/nss /usr/lib/i386-linux-gnu/nss/libsoftokn3.chk /usr/lib/i386-linux-gnu/nss/libnssckbi.so /usr/lib/i386-linux-gnu/nss/libnsssysinit.so /usr/lib/i386-linux-gnu/nss/libfreebl3.chk /usr/lib/i386-linux-gnu/nss/libnssdbm3.chk /usr/lib/i386-linux-gnu/nss/libnssdbm3.so /usr/lib/i386-linux-gnu/nss/libsoftokn3.so /usr/lib/i386-linux-gnu/nss/libfreebl3.so /usr/lib/i386-linux-gnu/libnssutil3.so /usr/lib/i386-linux-gnu/libsmime3.so /usr/lib/i386-linux-gnu/libnss3.so /usr/share /usr/share/doc /usr/share/doc/libnss3 /usr/share/doc/libnss3/copyright /usr/share/doc/libnss3/changelog.Debian.gz /usr/share/lintian /usr/share/lintian/overrides /usr/share/lintian/overrides/libnss3 

Note that the folders are not only owned by this packages, but by others too. Just check the files.

And reversely, dpkg —search libnss3.so gives me:

firefox: /usr/lib/firefox/libnss3.so thunderbird: /usr/lib/thunderbird/libnss3.so libnss3:i386: /usr/lib/i386-linux-gnu/libnss3.so libnss3-1d:i386: /usr/lib/i386-linux-gnu/libnss3.so.1d 

Источник

Как узнать путь до исполняемого файла в Linux?

Как в Linux узнать путь до исполняемого файла? В виндовс, например, на ярлыке или в bin/app.exe можно через свойство посмотреть Интересуюсь с целью создавать *.desktop ярлыки для заполнениями ими рабочего стола 🗔, так как способ «добавить в избранное» мне не подходит и получается рабочий стол пустой 😔

Для создания *.desktop нет необходимости указывать полный путь. Посмотрите примеры в /usr/share/applications

3 ответа 3

Я по факту могу найти приложение в диспетчере приложений, можно ли как-то оттуда взять этот путь? Или лучше и правильнее поискать путь к .exe в папках типа как в Windows —> C/Program FIles/app_folder/bin/app.exe ?

Внизу слева есть кнопка «Показать приложения», я про это имел в виду, оттуда бы как-то брать пути, там же ярлыки и их на рабочий стол хочу закидывать : )

Читайте также:  Linux grep case insensitive

Если вы знаете имя исполняемого файла, который выполняется в текущий момент, то полный путь к исполняемому можно узнать вот так:

pgrep | while read pid; do echo -ne "$pid\t"; readlink -f /proc/$pid/exe; done 

Например, вывод для исполняемого процесса gopls (сервер go для VS Code):

pgrep gopls | while read pid; do echo -ne "$pid\t"; readlink -f /proc/$pid/exe; done 30880 /mnt/drive2/home2/user/go/bin/gopls 

Набрав в командной строке

whereis locates the binary, source and manual files for the specified command names. The supplied names are first stripped of leading pathname components and any (single) trailing extension of the form .ext (for example: .c) Prefixes of s. resulting from use of source code control are also dealt with. whereis then attempts to locate the desired program in the standard Linux places, and in the places specified by $PATH and $MANPATH.

Источник

How to find application’s path from command line?

For example, I have git installed on my system. But I don’t remember where I installed it, so which command is fit to find this out?

Just in case, command -v and which worked in Linux Alpine 3.16.2 (Docker image). whereis and locate did not — not installed.

5 Answers 5

If it is in your path, then you can run either type git or which git . The which command has had problems getting the proper path (confusion between environment and dot files). For type , you can get just the path with the -p argument.

If it is not in your path, then it’s best to look for it with locate -b git It will find anything named ‘git’. It’ll be a long list, so might be good to qualify it with locate -b git | fgrep -w bin .

Читайте также:  Openbsd мы linux server

I use locate endlessly (it is very fast), but for those unaware of it, locate is only as up to date as its most recent database update, which is automatically run daily on my Ubuntu. The refresh command is sudo updatedb . Also locate has built-in regex capability, so commands like this works: locate -br «^git$» . -b` means restrict the search to just the basename . or without the -b , it searches the full pathname .. Also, it only searches paths you have configured it to search.. there is no command-line control of this other than your regex filters.

@Gilles, that’s funny for me the behavior is exactly the opposite: type is a shell builtin that tells me aliases and such, and which is an external program that shows me the path to an executable. although if there’s a builtin that gets in the way that executable won’t get called.

@quodlibetor The problems with which are that it doesn’t know about shell built-ins and functions (which is relevant when you’re wondering what typing the command will do), and it uses a different $PATH on some systems.

Источник

Оцените статью
Adblock
detector