Android shell tricks: ps
If you ever played around with the adb shell you may have found that the ps utility, which lists process lists, is not as verbose as you would expect it to be. And, to make things worse, there’s no inline help or man entries. Here’s the ps utility usage line: ps -t -x -P -p -c [pid|name].
-
-tshow threads, comes up with threads in the list -
-xshows time, user time and system time in seconds -
-Pshow scheduling policy, eitherbgorfgare common, but alsounanderfor failures to get policy -
-pshow priorities, niceness level -
-cshow CPU (may not be available prior to Android 4.x) involved -
[pid]filter by PID if numeric, or… -
[name]…filter by process name
Android’s core toolbox (shell utilities) are more primitive than the ones you may be used to. Notice how each argument needs to be separated and you can’t just -txPc it all, the command line argument parser is non-complex.
It’s a pity how command line arguments are not shown. If you need something that’s not available by the stock ps shell utility, try manually combing through the /proc directory. For the command line one would do cat /proc/<pid>/cmdline.
