Where whereis is searching
I am writing a script to install a program (a GUI interface) and would like to search if the required software is already installed. This made me think of the command whereis.
I was curious how the command whereis is working but didn't know where to search. Is it equivalent with a find at the most common locations? thank you very much |
whereis has a hard-coded path it searches for your search term. Similar to the way 'which' works, but does not use the $PATH environment variable, but rather a path determined by the distro.
From the man page: whereis has a hard-coded path, so may not always find what you're looking for. |
Also from the man page:
"whereis then attempts to locate the desired program in a list of standard Linux places." |
Quote:
So is there any other "standard" way to search for already installed software? I would like the GUI I am making to make sure the user has already installed the prerequisites. |
Well if you have mlocate installed, you could do something like:
Code:
updatedb Edit: You could also take the approach commonly used by configure scripts when compiling from source: Check in $PATH with something like 'which', if it's not there, tell the user they need to specify the location of the binary with flags like... --mysqldir=/var/lib/mysql |
the find command is a very flexible file locater
you can set the search path and what find will do with the results of the search |
Quote:
1 updatedb reads every directory and every file name accessible on a file system to build the data base this is extremely slow on a fresh slackware install this can tack up to half an hour depending on the speed of the hard drive 2 locate is extremely lose on what it considers a match a file name can be 3 letters off from the searched for spelling and still be included in the search results |
All times are GMT -5. The time now is 05:52 PM. |