Ps command

Hi,
I'm trying to learn Unix and I've yet the first problems on a basic command like ps.

If I have 2 different parameters, one more "restrictive" than the other, which of those controls? Let me explain:
-a : Select all processes except both session leaders and processes not associated with a terminal.
-d : Select all processes except session leaders.
If I use ps -ad is the same thing that use ps -da ? If the more "restrictive is a , is the d parameter superfluous?

a command like ps -edaf what processes will show?

Thank you!

Assuming you have access to a Unix or Linux machine, why not try all combinations and find out? Assuming the output is one process listed per line you could pipe the output of ps into wc -l just to see how long each listing would be. Then you can draw your own conclusions.

Andrew

I tried, but I didn't understand.
I tried, for example, ps -e, then ps -ed and the list was shorter than the first. So I thought it was depending on the d parameter, more restrictive, but I tried ps -d and the list was shorter again, so the -d parameter alone was more restrictive...
I tried other combinations, but had the same, confusing, results...

Our shop has ps -ef in a number of scripts--does that work?

The result of conflicting options depends on the ps version and should be documented in man ps .
The order of options should never matter, ps -ad is indentical with ps -da .
Please note that if you compare ps -e then ps -ed on an active system then it can differ because the number of processes have changed in between.

Thanks. So instead of using ps -ed I'd use ps -d obtaining the same result, correct?

No, -e and -d conflict, so consult your man page or try it out on the command line.
And if you try it out, be aware that the number of processes on the system can change any time. Even your ps command makes a process, and there is a race condition: the process table can be listed *before* or *after* the ps process appears in it.
(Tools like pgrep or pidof are safer, they take care to not list themselves.)