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
  • 51
  • 1
  • 1
  • 3

4 Answers4

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
  • 3,893
  • 14
  • 53
  • 73
2

whereis [command]

whereis ls
ls: /usr/bin/ls

HayekSplosives
  • 583
  • 1
  • 6
  • 13
1

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

  • 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 Sep 25 '12 at 07:22
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
  • 13,899
  • 4
  • 31
  • 48