Solaris 11 Changes: Where is the BSD style ps command?
Solaris 11 Changes: Where is the BSD style ps command?Short Answer: In /usr/bin/ps
Background
Oracle's new operating system Solaris 11 (Express) is a modular operating system based on the IPS installation technology. This feature has been used by Oracle to make the BSD commands in the directory /usr/ucb an optional package which doesn't get installed by default (see previous post). The BSD commands shouldn't be used since they're a backwards compatibility courtesy allowing 20th century applications written for SunOS 4 to operate without changes.
The Conflict: The BSD ps command is outdated and cool at a time
The BSD ps command doesn't truncate output after 80 lines like it's brother from the System V side of the family (/usr/bin/ps)
Getting the best from both Worlds
The good news is that the Oracle developers solved the problem and they documented it in the sources: They ship only one binary which implements BSD and System V at a time! The only trick is to know how to make the command act in one or the other way:
Suboptimal Solution
Install the ucb compatibility package and use a hard coded link to call /usr/ucb/ps.
Oracle uses a hard link to /usr/bin/ps and the /usr/bin/ps binary behaves like a BSD command if it finds any notion of the string "ucb" in it's path of the executable.
This option is not recommended since you will want to make your application ready for the 21th century and leave the BSD paths behind you.
Recommended Solution
Call the command with ps or /usr/bin/ps
- omit the "-" character as first character in the first argument
- provide a BSD compliant parameter list (without the "-")
The binary will sort it out and behave like the BSD flavor of the command.
The beauty with this solution is
- No directory /usr/ucb is required in the search path
- /usr/ucb in the search path will not do any harm (Solaris 10)
- the scripts are using the correct BSD syntax
- maintenance costs for the next generation will be lower
Food for Thought
You will want to have a look for the Solaris 10 and 11 pargs and pgrep commands. They will most likely solve your problem as well and you can leave all worries about BSD style commands in a System V OS behind you.
- 14053 views
/usr/bin/ps with no dash runs in UCB mode -- no official doc?
Is there is any official Oracle documentation on this mode? Solaris 11 ps man page doesn't mention it, and I've not been able it to find anywhere else.
No idea
I don't know. You may want to ask this question to Oracle support.