Linux top threads Recipe

  1. Run top in the background with a 30 second interval:
    nohup sh -c "top -c -w -b -H -d 30 | grep -A 10 'top - ' >> diag_topH_$(hostname)_$(date +%Y%m%d_%H%M%S).txt" &
  2. Reproduce the problem.
  3. To stop collection, kill the top process. For example:
    pkill -TERM -f "top -c -w -b -H -d"
  4. Upload diag_* and nohup.out

For background, see Linux top.