nixCraft Poll

Topics

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

Posted by Vivek Gite [Last updated: December 18, 2007]

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

Want to stay up to date with the latest Linux tips, news and announcements? Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

You may also be interested in other helpful articles:

Discussion on This Article:

  1. Corey Hart Says:

    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

  2. Kunal Says:

    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

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , , , , ,

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.