Path of a command

5

Could someone please let me know how to get to know the executable path of a command/utility in solaris?? like executable path of ls is /usr/bin

Akanksha

Posted 2012-09-25T07:12:53.620

Reputation: 51

Answers

7

use type command

For example

[max@localhost ~]$ type cal
cal is /usr/bin/cal
[max@localhost ~]$ type ifconfig
ifconfig is /sbin/ifconfig
[max@localhost ~]$ type ping
ping is /bin/ping

max

Posted 2012-09-25T07:12:53.620

Reputation: 3 329

type -P will give you the pure path in a more easily machine-consumable format. – kojiro – 2012-09-25T12:43:40.447

2

whereis [command]

whereis ls
ls: /usr/bin/ls

HayekSplosives

Posted 2012-09-25T07:12:53.620

Reputation: 533

1

You could use which command to see the full name of an executable. Like 'which foo' would return the full path to foo

user118305

Posted 2012-09-25T07:12:53.620

Reputation:

this is yielding me onlt the utitlites present in /usr/bin. I would want to find the path of otherutilities present in other folders as well.. – Akanksha – 2012-09-25T07:22:11.190

1

That depends on the shell you use and whether the command is in your PATH or not.

Assuming you are using ksh, you can use the whence command in the first case. If the command is not in your path or if you want to know if alternative versions exist, you can run something like

find $(find / ! -local -prune -o -name "*bin" | grep bin) -type f -name ls 

It assumes commands are in all in directories which name ends with bin, which is usually the case.

jlliagre

Posted 2012-09-25T07:12:53.620

Reputation: 12 469