2

I'm starting to use Oracle Solaris 11.2 SPARC.

In Linux, I can write

ps aux | grep *some_data*

... but that doesn't show any result on Solaris.

Instead I need to say

ps auxww | grep *some_data* 

I had a look at man ps to find more information about ww

If the option letter is repeated, that is, -ww, this option uses arbitrarily wide output

Why do I need to use ww to get anything to grep?

2

On Linux the ps command detects whether the output is to a terminal or not. If it is to a terminal then it truncates the output to the terminal width. If it is not on a terminal then it doesn't truncate. Effectively it behaves as if it automatically adds the ww flags.

You can see the difference by typing ps aux and ps aux | cat

In your example you are piping the output to grep and so it acts as if you typed ps auxww | grep.

For portability you should always use the ww flags if you want to see all the data beyond (say) 80 characters.

Note: you're using the BSD form of the ps command, so on Solaris make sure you're calling the right one!

  • 1
    Solaris 11 ps actually accepts both the System V and the BSD syntax. – jlliagre Jul 18 '16 at 12:59
3

You are using non standard BSD options, whether under Linux or Solaris.

The portable way is to use the -o option to specify which fields you want to appear, here for example ps -o pid,args. Note that unless you are using a recent 11.3 update or newer, the argument list will be limited to 80 characters unless you are root or own the process.

Alternatively, you might use pgrep -f which will search for the full command line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.