• VMware

    Learn about VMware virtualization for its products like vsphere ESX and ESXi, vCenter Server, VMware View, VMware P2V and many more

  • Linux

    Step by step configuration tutorials for many of the Linux services like DNS, DHCP, FTP, Samba4 etc including many tips and tricks in Red Hat Linux.

  • Database

    Learn installation and configuration of databases like Oracle, My SQL, Postgresql, etc including many other related tutorials in Linux.

  • How to find the path of any command in Linux

    The so called term used "command" is basically a binary file. If you try to read any of those files using any editor then you won't understand any thing as it is not human readable. These all commands are installed along with the relative packages with the installation of OS.

    These binary files are mostly located in the below 4 locations
    • /bin
    • /usr/bin 
    • /sbin 
    • /usr/sbin.
    You can either manually use the find or locate command to look out for the command in the above mentioned locations or alternatively you can use the below most suitable commands for this purpose





    which command

    # which "command_name"
    For eg:
    # which cp
    alias cp='cp -i'
    /bin/cp


    # which useradd
    /usr/sbin/useradd

    In case you get the below error# which samba
    /usr/bin/which: 
    no samba in (/usr/lib/qt-3.3/bin:/usr/local/sbin
    /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin)

    It means your PATH variable does not contains the path for samba command. In that case which will not help you find the location of the command.

    whereis command

    So, you can use the below command for the same purpose
    # whereis command_name
    For example
    # whereis useradd
    useradd: /usr/sbin/useradd /usr/share/man/man8/useradd.8.gz


    I hope I made my self clear

    Related Articles
    How to set environment (PATH) variable permanently in Linux
    How to mount windows share on linux

    Deepak Prasad

    is a techie and an author who is still trying to survive in this IT generation with very little knowledge he has on Linux/Unix, VMware, SAN Storage, Automation, networking etc

    You can follow him on Facebook or Google+


    Do you also have something to share here?
    Join GoLinuxHub Team as an Author, Click here for more information
    How to find the path of any command in Linux How to find the path of any command in Linux Reviewed by Deepak Prasad on Tuesday, October 14, 2014 Rating: 5

    No comments:

    Powered by Blogger.