top-command

Inspecting Java threads in Linux using top

微笑、不失礼 提交于 2019-11-28 16:27:04
问题 I am inspecting a Java process in Linux using top -H However, I cannot read the name of the thread in the "COMMAND" column (because it is too long). If I use 'c' to expand the full name of the process, then it is still to long to fit. How can I obtain the full name of the command? 回答1: You can inspect java threads with the tool jstack . It will list the names, stacktraces and other useful information of all threads belonging to the specified process pid. Edit : The parameter nid in the thread

Limit the output of the TOP command to a specific process name

百般思念 提交于 2019-11-28 15:05:52
If you call the top command, you get all the running processes. But how can I limit the output only to a certain process name like "java" ? I've tried this top -l 2 | grep java but in this way you get only snapshots and not a continuously updated list. And top -l 0 | grep java is not really clear. Rick Byers I prefer the following so I can still use top interactively without having to look up the pids each time I run it: top -p `pgrep process-name | tr "\\n" "," | sed 's/,$//'` Of course if the processes change you'll have to re-run the command. Explanation: pgrep process-name returns a list

Limit the output of the TOP command to a specific process name

北战南征 提交于 2019-11-27 08:59:49
问题 If you call the top command, you get all the running processes. But how can I limit the output only to a certain process name like "java" ? I've tried this top -l 2 | grep java but in this way you get only snapshots and not a continuously updated list. And top -l 0 | grep java is not really clear. 回答1: I prefer the following so I can still use top interactively without having to look up the pids each time I run it: top -p `pgrep process-name | tr "\\n" "," | sed 's/,$//'` Of course if the