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 .
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.
How can i find the location of installed software in linux?
Is there any command that I can use in the console to know the location of installed software in linux? i have copied a xyz.bin from windows machine to linuxdesktop and installed it. more over can you please tell me how to uninstall a software which is installed in linux Thanks in advance
You might be able to use the find command to search for it. Have a look at this unix.stackexchange.com/questions/19369/…
3 Answers 3
to find the path where the binary is linked to.
Other application specific files may reside in
The way a package is installed/uninstalled on Linux depends on either the specific Linux distribution AND the specific package.
Since you have used a .bin file for installation, it is likely that you have an uninstall command specific for your program in the path.
If you provide more information about the package and the Linux distribution, we can give more help.
It depends on the distribution you’re using. Supposing you are using a debian\ubuntu distribution, you can uninstall it by the apt command, using sudo apt-get remove software_name sudo apt-get purge software_name
Of course you need to have root privileges.
The softwares are usually installed in bin folders, in /usr/bin, /home/user/bin and many other places, a nice starting point could be the find command to find the executable name, but it’s usually not a single folder. The software could have components and dependencies in lib,bin and other folders.
how to find Linux module path
in the linux, lsmod lists a lot of modules. but how can we find where those module loaded from. for some modules,linux command «modprobe -l» shows a path but some are not.
edited i also tried «find» and «locate». both of them lists all kind of versions
locate fake /svf/SVDrv/kernel/linux/.fake.ko.cmd /svf/SVDrv/kernel/linux/.fake.mod.o.cmd /svf/SVDrv/kernel/linux/.fake.o.cmd /svf/SVDrv/kernel/linux/fake.ko /svf/SVDrv/kernel/linux/fake.mod.o /svf/SVDrv/kernel/linux/fake.o /svf/SVDrv.03.11.2014.16.00/kernel/linux/.fake.ko.cmd /svf/SVDrv.03.11.2014.16.00/kernel/linux/.fake.mod.o.cmd /svf/SVDrv.03.11.2014.16.00/kernel/linux/.fake.o.cmd /svf/SVDrv.03.11.2014.16.00/kernel/linux/fake.ko /svf/SVDrv.03.11.2014.16.00/kernel/linux/fake.mod.o /svf/SVDrv.03.11.2014.16.00/kernel/linux/fake.o /svf/SVDrv.04.29.2014.17.39/kernel/linux/.fake.ko.cmd /svf/SVDrv.04.29.2014.17.39/kernel/linux/.fake.mod.o.cmd /svf/SVDrv.04.29.2014.17.39/kernel/linux/.fake.o.cmd /svf/SVDrv.04.29.2014.17.39/kernel/linux/fake.ko /svf/SVDrv.04.29.2014.17.39/kernel/linux/fake.mod.o /svf/SVDrv.04.29.2014.17.39/kernel/linux/fake.o /svf/SVDrv.05.05.2014.11.25/kernel/linux/.fake.ko.cmd /svf/SVDrv.05.05.2014.11.25/kernel/linux/.fake.mod.o.cmd /svf/SVDrv.05.05.2014.11.25/kernel/linux/.fake.o.cmd /svf/SVDrv.05.05.2014.11.25/kernel/linux/fake.ko /svf/SVDrv.05.05.2014.11.25/kernel/linux/fake.mod.o /svf/SVDrv.05.05.2014.11.25/kernel/linux/fake.o /svf/SVDrv.05.05.2014.17.43/kernel/linux/.fake.ko.cmd /svf/SVDrv.05.05.2014.17.43/kernel/linux/.fake.mod.o.cmd /svf/SVDrv.05.05.2014.17.43/kernel/linux/.fake.o.cmd /svf/SVDrv.05.05.2014.17.43/kernel/linux/fake.ko /svf/SVDrv.05.05.2014.17.43/kernel/linux/fake.mod.o /svf/SVDrv.05.05.2014.17.43/kernel/linux/fake.o /svf/SVDrv.05.07.2014.14.59/kernel/linux/.fake.ko.cmd /svf/SVDrv.05.07.2014.14.59/kernel/linux/.fake.mod.o.cmd /svf/SVDrv.05.07.2014.14.59/kernel/linux/.fake.o.cmd /svf/SVDrv.05.07.2014.14.59/kernel/linux/fake.ko /svf/SVDrv.05.07.2014.14.59/kernel/linux/fake.mod.o /svf/SVDrv.05.07.2014.14.59/kernel/linux/fake.o
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 .
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