Check the memory usage of a specific process in Linux.

In Linux, you can use the top or htop command to check the memory usage of a specific process.

  1. Use the top command:
  2. Open the terminal and type in the top command.
  3. Press Shift + f, then press the n key, select the %MEM option, and press Enter.
  4. Press Shift + r, then input the process’s PID (Process ID) and press Enter.
  5. The top command will display the memory usage of the process.
  6. Execute the htop command (htop needs to be installed beforehand):
  7. Open the terminal and enter the htop command.
  8. Press the F6 key and then type MEM% followed by pressing the Enter key.
  9. Press the F4 key, then enter the PID (Process ID) and press Enter.
  10. The htop command displays the process’s memory usage.

Additionally, you can use the combination of the ps command and grep command to view the memory usage of a specified process.

ps aux | grep <进程名或PID>

The above command will list the processes associated with the specified process name or PID, including memory usage information.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds