How do I monitor swap usage?

You can monitor swap usage in Linux using several command-line tools. Here are a few methods:

  1. Using the free command:

    free -h
    

    This command displays memory and swap usage in a human-readable format.

  2. Using the swapon command:

    sudo swapon --show
    

    This command shows the swap space currently in use, including the size and usage of each swap file.

  3. Using the top command:

    Run the top command:

    top
    

    In the output, you will see a summary of memory and swap usage at the top of the screen.

  4. Using the vmstat command:

    vmstat 1
    

    This command provides a continuous report of system performance, including swap usage, updated every second.

  5. Using the htop command (if installed):

    Simply run:

    htop
    

    This interactive process viewer shows memory and swap usage in a graphical format.

You can choose any of these methods based on your preference for monitoring swap usage.

0 Comments

no data
Be the first to share your comment!