
One look at the man page for ps(1) <https://man7.org/linux/man-pages/man1/ps.1.html> and you see all the different traditional option syntaxes it tries to be compatible with. The BSD style doesn’t even prefix options with dashes, which can lead to ambiguities and is best avoided. If this is what you’re used to, try to wean yourself off it. To list some useful info about all processes, you can do ps -ef or, for even more info, try ps -eF One thing I find annoying about this it reports less precision in process start times for long-running processes. To get around this, you can use a custom format. For example ps -eo pid,ppid,lstart,tty,etime,cmd shows some similar info to the default “-f” format, but always includes start time and elapsed time to the nearest second, regardless of how long the process has been running. Another useful command to use with ps is pgrep(1) <https://man7.org/linux/man-pages/man1/pgrep.1.html>, which lets you filter processes to get information for according to various criteria. Or you could just use grep(1) on the output from ps, as I suspect a lot of people do. ;)

On Tue, 6 Oct 2020 11:47:22 +1300, I wrote:
Another useful command to use with ps is pgrep(1) <https://man7.org/linux/man-pages/man1/pgrep.1.html>
If you are expecting more than one process to match your criteria, it is easy enough to use the “-d,” option to comma-separate them. Then the output becomes acceptable to the “-p” option in ps, e.g. ps -p$(pgrep -d, bash) -wwo pid,ppid,lstart,tty,etime,cmd to report all the bash sessions I have running (quite a lot). The “ww” says not to truncate the output, which is handy for long command lines.
participants (1)
-
Lawrence D'Oliveiro