4 ms·
kill `ps -opid OC -C chrome | tail -n1` Kills only the highest-CPU-use Chrome pid. You can get a lot of useful information out of PS, like blocked, caught, ig
by peterwwillis 10y ago
kill `ps -opid OC -C chrome | tail -n1`
Kills only the highest-CPU-use Chrome pid.
You can get a lot of useful information out of PS, like blocked, caught, ignored & pending signals, control group, scheduling class & policy, CPU in tenths of a percent, instruction & stack pointers, elapsed time since it started, security label, thread id, number of threads, kernel function that the process is currently sleeping in, process state, current CPU, number of kernel threads, controlling tty, etc.
Also, never use killall. On Solaris it reboots the machine. Fun to find out when logged in as root.
- vram22 10y agoThanks for the tip. Didn't know you could get so much info from ps. Will re-check its man page. Do you have any recommendation on books or online sites for learning about the more advanced topics you mention above (the many Unix topics that you say ps gives info on, not just ps itself)? I know about the Stevens [1] series of Unix and networking books, and have read parts of some, but that was a while ago. Things must have changed a good amount since then. Should still read Stevens again, I guess. [1] https://en.wikipedia.org/wiki/W._Richard_Stevens https://en.wikipedia.org/wiki/W._Richard_Stevens
- peterwwillis 10y agoSome of those topics are basic UNIX programming things (signals, threads, process state, controlling tty). Others are features of the operating system, so you would want something Linux-specific that tells you about kernel programming or kernel features you can use in your applications (security labels, scheduling classes, control groups, kernel threads, etc). Still others are features of the OS & cpu's execution of programs (instruction/stack pointers), you'll want to learn Assembly for that. Sorry I don't have reading recommendations. I don't really read as much as just diving into man pages and looking up guides online. Hacker habits...
- vram22 10y agoNo problem. I do know what some of the points mean (signals, threads, control groups, instruction/stack pointers, etc.), just did not know some of the others (like security labels, threads vs. kernel threads, etc.). I guess some of those topics might not be found in one or a few books, more like scattered across books, articles, man pages etc. ...