how do I continuously do a ps auxw on OSX?
Matthew Harrington
The question is this: If I open terminal and type ps auxw, I see a list of all processes running but this command is like a snapshot of that instant. What I need is this:
I am trying to discover what process is being run by an app that is crashing just after launching. I will use the finder and double click on the app icon to execute it. For a brief moment I know the app will launch and then crash.
How do I have a terminal window monitoring the running processes all the time, so when the app launches for a brief instant, that monitoring captures the process and lists it on terminal?
How do I do that? thanks.
03 Answers
If you have macports available (or possibly homebrew or a similar environment) you can use watch to print the output of the command every second:
watch -n 1 ps auxwAn alternative is to use glances, which is also available through macports.
1You can indeed use watch for this. Alternatives are
topandhtop: these display processes in continuously updating windows.Use the shell
while true; do ps auxw; sleep 1; doneUse
straceon Linux orktraceon OSX.
I used a modified command provided by @terdon:
while true; do ps auxw >> ps.txt; date >> ps.txt; sleep 1; doneI did this to make it easier to track the processes running at a given moment.