2
anisha@linux-dopx:~> which qmake
which: no qmake in (/opt/qtcreator-2.0.92/bin/:/opt/qtsdk-2010.05/qt/bin/:/opt/qtcreator-2.0.92/bin/:/opt/qtsdk-2010.05/qt/bin/:/usr/lib64/mpi/gcc/openmpi/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/mit/bin:/usr/lib/mit/sbin)

anisha@linux-dopx:~> locate qmake
anisha@linux-dopx:~> 

Is there any other way by which I can confirm whether a software is installed or not, considering the clause that it is currently not in the PATH?

1
  • 1
    Since locate uses a database and does not restrict to $PATH, if the database is up to date, no need to do more. (you can use locate -eb \\filename to find only existing files with exact match)
    – tuxce
    Commented Aug 10, 2011 at 9:46

2 Answers 2

6

Try whereis. It looks in all places that make sense for binaries (when -b is used), even if they are not included in your $PATH. For example whereis -b ifconfig returns /sbin/ifconfig, even though /sbin is not in my $PATH.

5
  • Thanks, what does this output mean now? Command: anisha@linux-dopx:~> whereis qmake Output: qmake: Commented Aug 10, 2011 at 9:41
  • with -b also it is returning the same. Commented Aug 10, 2011 at 9:44
  • 2
    @Anisha: means it is not installed. You may want to install qt-devel to get qmake
    – nico
    Commented Aug 10, 2011 at 9:52
  • 1
    It means that it cannot find qmake in all the paths that it looks for. From the man page: "whereis then attempts to locate the desired program in a list of standard Linux places". So that could also mean that qmake is installed but in an unusual place. You can also try find. For example find / -executable -type f -name ifconfig 2>/dev/null looks for the ifconfig executable file, starting from the root directory. Just replace ifconfig with qmake.
    – sakisk
    Commented Aug 10, 2011 at 9:53
  • Thanks @nico, I did: cnf qmake which resulted in The program 'qmake' can be found in following packages: * libqt4-devel [ path: /usr/bin/qmake, repository: zypp (openSUSE-11.3 11.3-1.82) ] * libqt4-devel [ path: /usr/bin/qmake, repository: zypp (repo-oss) ] * libqt4-devel [ path: /usr/bin/qmake, repository: zypp (Updates for openSUSE 11.3 11.3-1.82) ] Try installing with: sudo zypper install libqt4-devel Commented Aug 10, 2011 at 9:54
4

The problem lies in the sole definition of the word "installed". There are several ways to interpret it.

  • A typical and most proper way to "install" a program is to use a package manager tool(s). These vary from distribution to distribution: on Gentoo, there is emerge and and a bunch of other helpful programs around portage; on Debian-based systems (like Ubuntu), there are apt-<something> tools and so on. These tools are what you should use whenever possible - both for installation and searching for available/installed software - their main job on the system is to maintain all the information about your official software.

  • Software that is not available in the repositories can also be installed by its own specific installation scripts. Such software will not be automatically seen by the system management tools - which can cause various problems. To find components of such programs, you are left to use tools like locate, find, which or whereis.

  • You can also build a program, place it "by hand" and adjust your environment (like PATH) so that it becomes usable. From both the user's and the system's point of view it can be much different, slightly different or not different at all compared to the previous approach.

In your case, you should distinguish between finding a binary and determining if a certain package is installed. For the practical part of finding a binary, you can just use which or whereis. Note that the PATH environmental variable can be different for root and non-root users. If you want to determine if a package is installed (using the first interpretation of that word), use your distribution's package management software.

1
  • Thanks, that's correct, I should have use the package manager, too, to figure out whether qmake is installed or not. Commented Aug 10, 2011 at 10:13

You must log in to answer this question.

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