1

I want to run a command using ps to find non responsive binaries.

This stack question has a response which I've tried to implement, but I am getting odd results from it.

ps aux | awk -F' ' '{ if ( $8="D" ) print $0 }'

This is supposed to return only the lines from ps where column 8 has the letters "D". What I am seeing is that it's replacing column 8 with the letter D instead.

I have tried on zsh and bash, using gawk instead of awk, and getting the same result. What is wrong with this command?

I am interested in why it's failing.

1 Answer 1

2

The operator for equality is a double equal sign. A single equal sign is an assignment.

 ps aux | awk -F' ' '{ if ( $8=="D" )  print $0 }'

The command will never return any output on a Mac, because there is no status D.

7
  • Also, ps only shows binaries unresponsive (stuck) on Unix level, not GUI applications which are just too busy to process input events.
    – nohillside
    Commented Sep 4 at 7:37
  • I edited the title to add binaries. What prompted this quest was the family binary which keeps locking up. I want to be notified so I can force close it. /System/Library/CoreServices/Family.app/Contents/MacOS/Family
    – John
    Commented Sep 4 at 14:21
  • @Linc-D. Are you the original and outstanding Linc Davis from the Apple forums of yesteryear?
    – John
    Commented Sep 4 at 14:23
  • 1
    Guilty as charged. Best to post another question with more details of the real problem, and without prejudging how to solve it.
    – Linc Davis
    Commented Sep 4 at 14:26
  • @LincD. We are supposed to ask one question at a time and attempt a solution before coming here.
    – John
    Commented Sep 4 at 15:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .