Post Reply 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
find out where a program is located
06-14-2018, 12:37 PM (This post was last modified: 06-14-2018 02:57 PM by cchen.)
Post: #1
find out where a program is located
The type, which, and whereis commands all provide information about the location of programs.

type will tell you where a command is located in a verbose way, along with an indication of whether the command location is hashed. If there is more than one command with the same name, the location shown is the first one found using your $PATH:

#Drive example:
$ type cat                
cat is hashed (/bin/cat)

which is similar, but shows only the command location:
#Drive example:
$ which cat                  

whereis will show you all of the locations for the command (and sometimes there are several, if different versions of the same program are installed), along with the location of its manpage documentation:
#Drive example:
$ whereis cat
cat: /bin/cat /usr/share/man/man1p/cat.1p.gz /usr/share/man/man1/cat.1.gz

Another tool for quickly finding files by filename is the locate command. The locate command reads one or more databases prepared by updatedb and writes file names matching at least one of the patterns to standard output, one per line.

P1). Install mlocate
yum -y update
yum -y install mlocate

P2). using "locate filename" to index and quickly search for files
Find all posts by this user
Quote this message in a reply
Post Reply 

Forum Jump: