3

I could find a process named typora from htop

enter image description here

but I cannot trace it from ps or pstree

$ ps -a | grep -i typora
 9696 ttys003    0:00.01 grep -i typora

$ pstree | grep -i typora 
 |     |--- 09713 me grep -i typora
 |--= 00258 me /Applications/Typora.app/Contents/MacOS/Typora -psn_0_40970

How could I find it from command ps.

  • Have you try ps -efl | grep -i typora? – Romeo Ninov Nov 6 '18 at 6:40
10

From the ps manual on macOS (my emphasis):

-a

Display information about other users' processes as well as your own. This will skip any processes which do not have a controlling terminal, unless the -x option is also specified.

Applications that are running on macOS without a controlling terminal, such as windowed Finder applications, will not be listed by ps -a. To list these, use ps -ax.

Or, you may may use the -A or -e option:

-A

Display information about other users' processes, including those without controlling terminals.

-e

Identical to -A.

If you are looking for information about a process with a particular name, consider using pgrep instead:

pgrep Typora

(note that case matters, unless you use pgrep -i)

To signal a process with a particular name, use pkill rather than trying to grep the output of ps.

See the manuals for pgrep and pkill.

Also, even though this was not part of your question, pstree has a -s option to show only the branches of the process tree that contains processes with a particular name.

  • Or use POSIX ps -A. MacOS being a UNIX certified system, I'd expect ps -e would work as well. – Stéphane Chazelas Nov 6 '18 at 7:22

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.