Find where an executable is on your Linux system.

Finding the location of an installed program can be annoying. But this is how to find where a program is.

The whereis(1) command will print out the installed locations of various programs.

darkstar:~/Documents> whereis tcsh
tcsh: /usr/bin/tcsh /bin/tcsh /usr/share/man/man1/tcsh.1.gz

The find command will also allow you to locate an executable.

darkstar:~/Documents> find /bin -name "ls"
/bin/ls

Use the -b parameter for whereis to only search for executable binaries.

darkstar:~/Documents> whereis -b tcsh
tcsh: /usr/bin/tcsh /bin/tcsh

Use the -m parameter to only search for manual pages.

darkstar:~/Documents> whereis -m tcsh
tcsh: /usr/share/man/man1/tcsh.1.gz

The -l parameter will output a long list of all lookup paths the whereis command is using to search for files.

darkstar:~/Documents> whereis -b -l tcsh
bin: /usr/bin
bin: /usr/sbin
bin: /usr/lib
bin: /bin
bin: /sbin
bin: /etc
bin: /lib
bin: /lib64
bin: /usr/games
bin: /usr/local/bin
bin: /usr/local/sbin
bin: /usr/local/etc
bin: /usr/local/lib
bin: /usr/local/games
bin: /usr/include
bin: /usr/local
bin: /usr/share
bin: /opt/pt/bin
man: /usr/share/man/fi
man: /usr/share/man/fr
man: /usr/share/man/pt_BR
man: /usr/share/man/ko
man: /usr/share/man/sv
man: /usr/share/man/hu
man: /usr/share/man/pt
man: /usr/share/man/zh_CN
man: /usr/share/man/sr
man: /usr/share/man/man3
man: /usr/share/man/pl
man: /usr/share/man/tr
man: /usr/share/man/gl
man: /usr/share/man/zh_TW
man: /usr/share/man/ru
man: /usr/share/man/man2
man: /usr/share/man/da
man: /usr/share/man/ro
man: /usr/share/man/el
man: /usr/share/man/sl
man: /usr/share/man/id
man: /usr/share/man/man8
man: /usr/share/man/fr.ISO8859-1
man: /usr/share/man/nl
man: /usr/share/man/man1
man: /usr/share/man/man6
man: /usr/share/man/de
man: /usr/share/man/it
man: /usr/share/man/man5
man: /usr/share/man/man4
man: /usr/share/man/zh
man: /usr/share/man/es
man: /usr/share/man/ja
man: /usr/share/man/cs
man: /usr/share/man/sk
man: /usr/share/man/hr
man: /usr/share/man/man7
man: /usr/share/man/fr.UTF-8
src: /usr/src/linux-headers-3.16.0-4-common
src: /usr/lib/linux-kbuild-3.16
src: /usr/src/linux-headers-3.16.0-4-amd64
tcsh: /usr/bin/tcsh /bin/tcsh

No comments have been made. Use this form to start the conversation :)

Leave a Reply