How do you know what the swap is?



  • Usually, the subtracting section is empty and only filled with very large graphical files. But for the second day there's been a mess. We can solve the problem of exit and re-introduction, but I'm curious to know exactly what the swap is. How do you know that?

    Except for the browsers, NetBeans, audio, video and virtual car, didn't start anything. I didn't do anything special, everything.

    I didn't get out of the system in two weeks and everything was fine.

    Экранный снимок htop



  • Found somewhere on the lambs and a little bit subtle to his environment. Maybe we'll have to finish drinking, too, but the point is to understand the principle:

    #!/bin/sh
    for dir in $(find /proc/ -maxdepth 1 -type d |grep -E "[0-9]+"); do 
      pid=$(echo $dir |cut -d/ -f3)
      cmd=$(ps h -o comm -p $pid)
      swap=$(grep VmSwap $dir/status 2> /dev/null |awk '{print $2}')
      if [ ! -z $swap ] && [ $swap -ne 0 ]; then
        echo "pid: $pid command: $cmd swap: $swap KB"
      fi
    done | sort -rnk6 | column -t
    

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2