To find out which process is using a large amount of memory or CPU time on a Linux system, you can use the top
command. This command is a interactive system monitor that shows the running processes on the system and their resource usage.
To use top
, you can run the following command:
top
This will open a screen showing a list of processes sorted by CPU usage, with the process using the most CPU at the top of the list. You can use the M
key to sort the list by memory usage instead.
To view more detailed information about a specific process, you can use the htop
command. This command is a more advanced version of top
that provides additional features, such as the ability to view the resources used by individual threads within a process.
To use htop
, you can run the following command:
htop
This will open a screen showing a list of processes, with each process shown as a separate row. You can use the F3
and F4
keys to sort the list by different fields, such as CPU usage or memory usage. You can also use the F6
key to filter the list by process name or user.