Sobes.tech
Middle+

How to view resource consumption of processes using Linux terminal? How to kill a process? What commands did you use overall?

sobes.tech AI

Answer from AI

To view processes and their resource consumption in Linux, the top command is often used, or a more modern alternative htop (if installed). They display a list of processes with information on CPU, memory, runtime, etc.

Example usage:

top

In interactive mode, you can sort processes by CPU, memory, etc.

Alternatively, you can use ps with filters, for example:

ps aux --sort=-%cpu

which shows processes sorted by decreasing CPU load.

To kill a process, use the kill command with the process PID:

kill <PID>

If the process does not terminate, you can force it with:

kill -9 <PID>

There is also the pkill command, which kills processes by name:

pkill process_name

Summary of main commands:

  • top / htop — process monitoring
  • ps — process viewing
  • kill — terminate process by PID
  • pkill — terminate by process name

Example:

top
# look for the PID of the desired process
kill 1234