Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Using ps axc is easier' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Using ps axc is easier
Authored by: brandonedling on Dec 05, '02 10:07:51AM

su to root and type "ps axc" (without the quotes) at the prompt. This will list everything. Type "kill <ID>" at the prompt and there you go.

Brandon



[ Reply to This | # ]
Question to: Using ps axc is easier
Authored by: sms on Dec 05, '02 10:22:11AM
How can I search for a specific appliction within the ps output?

I tried ps -aux |grep Microsoft but (although Microsoft Word was running and hanging) the line was empty. Making the console window bigger revealed the PID.

Thanks for any input!

sImOn

[ Reply to This | # ]
Question to: Using ps axc is easier
Authored by: brandonedling on Dec 05, '02 03:36:03PM

Many Carbon apps don't itemize properly... instead, they fall under the title of "LaunchCFMApp". Sort of a drag, and I'm not sure if there is anyway around it. That when I look at how long a process has been running and then "guess" I'm killing the right one.

Brandon



[ Reply to This | # ]
2nd Question to: Using ps axc is easier
Authored by: sms on Dec 05, '02 11:18:05AM
Interestingly I just found out that every built in application (Finder, iTunes, ...) can be found piping grep after ps:

[myhostname:~] myusername% ps -axc | grep -ie finder
422 ?? S 0:27.72 Finder

The strange thing is: any other application on my computer (Mozilla, Word, you-name-it,...) cannot be found like that, though they show up in ps and top of course!!

Any clues?

[ Reply to This | # ]
2nd Question to: Using ps axc is easier
Authored by: sharumpe on Dec 05, '02 12:36:25PM
try this:
ps -axww | grep -ie whatever
The 'ww' means to show the long string for the command, even if it has to wrap around a line. Mr. Sharumpe

[ Reply to This | # ]
Other PS options & basic HOWTO on the recovery process
Authored by: Lanir on Dec 14, '02 06:14:37AM
... You beat me to adding the ww flags. =)

Personally, I'd probably do this if I wanted to save time. If commandline is new to you, you should still be able to follow this. If it's not, skim over what you don't need.

login as the username that is logged into the Mac from another machine on the same network, then...
Note: Remember to login using the short form of your username. Find it beforehand in System Preferences under Accounts if you're likely to forget.

ps -xwwU username | less

You have to replace your username in the line above for it to work right. Try this beforehand. Yes, it looks like a lot of strange goo but it will keep you from wading through more than you need to. It also sends the output to less a pager that lets you use the up and down arrow keys to navigate. To get out of less, hit the q key. Here is a short example of what you might see on a running system:

PID TT STAT TIME COMMAND
175 ?? Ss 2:06.89 /System/Library/Frameworks/ApplicationServices.framewo
rk/Versions/A/Frameworks/ATS.framework/Versions/A/Support/ATSServer
179 ?? Ss 21:06.88 /System/Library/CoreServices/WindowServer -daemon
341 ?? Ss 0:13.52 /System/Library/CoreServices/loginwindow.app/Contents/
MacOS/loginwindow console
390 ?? Ss 0:01.37 /System/Library/CoreServices/pbs
393 ?? S 0:17.56 /System/Library/CoreServices/Dock.app/Contents/MacOS/D
ock -psn_0_393217
396 ?? S 4:11.57 /System/Library/CoreServices/SystemUIServer.app/Conten
ts/MacOS/SystemUIServer -psn_0_524289
397 ?? S 0:15.10 /System/Library/CoreServices/Finder.app/Contents/MacOS
/Finder -psn_0_655361
3125 ?? S 0:04.27 /System/Library/CoreServices/SecurityAgent.app/Content
s/MacOS/SecurityAgent
3262 p1 S 0:00.11 -tcsh (tcsh)

To parse this out right so it makes sense to you, do this. First off, ignore all but the first column (PID) and the last one (Command). Any command that starts with a slash, just ignore everything before the last slash. For the second to last line (PID 3125), you would only need to know it was SecurityAgent, for example. Anything that doesn't begin with a slash is leaving out the path and just telling you the command. The last line (PID 3262) is an example of this (ignore the dash).

After you have the Proccess ID (PID), you'll want to use the kill command to make it go away. Here's how to do it the right way. Some things are stubborn so we'll try a hitting it over the head gradually harder until it's gone.

kill -HUP PID

This will tell it to hangup, which generally allows an application time to close things gracefully. It won't always work. To test, run the previous command again and search for the application you tried to kill (ps -xwwU username | less). If you see it, note the PID again because it may be different. Then...

kill PID

This just tells it to go away. Generally works. Look again to see if it's gone yet. If not...

kill -KILL PID

Slay with extreme prejudice. Do not pass Go, do not collect $200. Just smear it first and ask questions later. Check to make sure it's gone. If that didn't work, give it about a minute and check again. If it's still there... Well, one last trick.

kill 1

This will kill all processes and send you into single-user mode without turning the machine off. I can't imagine anything hosing your system this bad and still letting you login remotely but just in case here's how to do it. If things are this bad, all you want to do once you've typed that in is give it a little bit to get into single-user mode and type:

halt

Give it a couple minutes. If your machine is warm, give it more like half an hour to an hour as this might be part of the problem (happens on PC's sometimes, especially laptops). If your system doesn't come back up cleanly and let you login, you have much more serious problems. And my sympathies, for what it's worth.

[ Reply to This | # ]
2nd Question to: Using ps axc is easier
Authored by: aranor on Dec 06, '02 12:34:10AM

That's because you used the -c switch. That shows the name of the process itself (executable name), which for CFM apps (i.e. most Carbon apps), will show 'LaunchCFMApp'. If you leave that switch off (and put in -ww to make sure the entire line is displayed) then it shows the path to the process, and you can successfully use grep on it.

Anyway, use this to get the PID of the process you want:

ps -axww | grep -i <process name>



[ Reply to This | # ]
Try ps -aux
Authored by: iroot on Dec 05, '02 04:20:39PM

For those who like lots of info



[ Reply to This | # ]