Linux / UNIX: Determine where a binary command is stored / located on file system

by Vivek Gite on August 29, 2007 · 3 comments

You can use "type" or "whereis" command to find out which command shell executes and to print binary (command) file location for specified command.

whereis command example

Display ls command location along with man page path:
whereis ls
Output:
ls: /bin/ls /usr/share/man/man1p/ls.1p.gz /usr/share/man/man1/ls.1.gz

type command example

Find out which command the shell executes:
type -a ls
Output:
ls is aliased to `ls --color=tty'
ls is /bin/ls

Related: How Linux or UNIX Understand which program to run - PART I and How BASH Shell Command Search Sequence Works

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

We're here to help you make the most of sysadmin work. So, subscribe!

{ 3 comments… read them below or add one }

1 Corey Hart August 29, 2007

If for some reason the command you are looking for is not in your PATH you can try the locate command to find out where it might be located

% locate ls

Reply

2 Kunal October 27, 2007

i access my server through sshd using putty but after a certain period of time the port on which sshd is open is closed automatically.
i am not able to figure out this problem.
please help me thanks in advance

Reply

3 Pramoth June 24, 2009

How to know the virsion of a binary file in UNIX?
Need unix command for the same.

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 15 + 5 ?
Please leave these two fields as-is:
Are you a human being? Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: