111

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

1
  • Possible duplicate of 18472
    – sakisk
    Aug 25, 2011 at 12:51

9 Answers 9

98

You can use:

which fluidpoint

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.

From Manual:

NAME
       which - shows the full path of (shell) commands.

SYNOPSIS
       which [options] [--] programname [...]

Full manual: https://linux.die.net/man/1/which

5
  • 4
    or check to see if the program is actually an alias, e.g. alias fluidpoint, Aug 25, 2011 at 2:56
  • 2
    @Chad Some versions of which (e.g. the one built in to ZSH) will do that for you Aug 25, 2011 at 3:32
  • @Michael excellent to know. Because of your comment, I just discovered that newer versions of bash also do this. +1 to your comment. Aug 25, 2011 at 4:06
  • 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".
    – Steve-o
    Aug 25, 2011 at 5:24
  • 1
    Sorry to be ambiguous, I mean ~/.dir. The hidden directory is below the home directory. And I completely forgot about /usr/local/bin dop.
    – nopcorn
    Aug 25, 2011 at 5:35
19

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

Example:

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.

14

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

dpkg --status some_package

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

dpkg --search some_file

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
6

The whereis command locates the binary, source, and manual-page files for a command, and the type command tells what exactly the shell executes when you run a certain command.

Try whereis -l fluidplot in your case. If it only returns "fluidplot:", but no path, that means the software is not installed. Note that this does not include files that may be hidden within the home folder under ~/.local/share/ (in my case).

Found on Linux Screw

3
  • Re: "this does not include...", it's not clear whether this refers to type, whereis, or both.
    – agc
    Jun 10, 2016 at 1:57
  • @agc I merged the three lines into a single paragraph; is it clearer now?
    – 魔大农
    Nov 19, 2019 at 11:55
  • Yes, it's much clearer.
    – agc
    Nov 19, 2019 at 18:19
2

On Arch based systems:

pacman -Qo <somefile>

Will give you the package that owns somefile.

pacman -Ql <package>

Will list the location of all the files that comes with a given package

1

You just simply type the command in Linux terminal whereis toolsname. I have searched like this: whereis ping enter image description here

0

Instead of using which (which probably isn't the right choice unless you're using csh) you can use command -v fluidplot to get the shell to boune like shell to tell you what it would do if you asked it to run the command (fluidplot in this example).

Some examples for me:

$ command -v ls
alias ls='ls --color=auto'
$ command -v cat
/bin/cat
$ test_func() {
> :
> }
$ command -v test_func
test_func
$ which test_func
/usr/bin/which: no test_func in (/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin)
$ if command -v noSuchFile; then echo "It exists"; else echo "does not exist"; fi
does not exist

so you can also use it to test if a command would even be found and attempted to run. Since most of us use Bourne-like shells (e.g., bash or zsh) this is often preferable to which

0

It seems the main goal is being missed, in that links are scattered around but the actual app is in one place. How to find?

  1. whereis "symlink" result will be like : /usr/bin/"symlink" look at the location of the symlink, then run

  2. ls -al /usr/bin |grep "symlink" this will produce the line that tells you where the app is located, such as

postman -> /opt/Postman/Postman

-1

You can try to run:

ps aux | grep "THE_NAME_OF_A_PROGRAM"

There are pretty good chances you will see the path to the program (if it's running)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .