-1
ps -f -U

I am not able to understand the functionality of this command. I am getting output for the above mentioned command, but not able to understand it.

  • 1
    What Uix are you trying to use this on? Does it generate any error or warning message? Please edit your question to fill in some details. – Kusalananda Oct 23 '17 at 6:21
1

In ps the -U option is supposed to take list of users whose processes you want to view (or more correctly, usernames under which processes run). Purpose is obviously filtering by username.

Something like this:

$ ps -f -U syslog,avahi                                                                                                                                                                                                                     
UID        PID  PPID  C STIME TTY          TIME CMD
syslog     522     1  0 10月22 ?      00:00:00 /usr/sbin/rsyslogd -n
avahi      594     1  0 10月22 ?      00:00:00 avahi-daemon: running [eagle.local]
avahi      622   594  0 10月22 ?      00:00:00 avahi-daemon: chroot helper

The option is present in both FreeBSD and coreutils ps as well as POSIX standard, so I'm guessing this is fairly portable option.

As for -f, manual for coreutils ps states:

   -f     Do full-format listing. This option can be combined with many other UNIX-style options to add additional columns.  It also causes the command arguments to be printed.  When used with -L, the NLWP (number of threads)
          and LWP (thread ID) columns will be added.  See the c option, the format keyword args, and the format keyword comm.

while FreeBSD manual states:

 -f      Show command-line and environment information about swapped out
     processes.  This option is honored only if the UID of the user is
     0.

So the purpose is to obtain full formatting of the output in either case, but notice the description is very different. Notice also that FreeBSD option is supposed to unclude swapped out processes. This one isn't quite portable, since it's missing in OpenBSD manual.

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.