Friday, December 08, 2023

How to find out what processes are running on Linux?

You can use various commands to find out what processes are running on Linux. Here are some commonly used commands:

ps Command:

The ps command provides a snapshot of the current processes. You can use it in different ways to display various levels of information.

To display a list of running processes:

ps aux

To display a tree-like process hierarchy:

ps auxf

top Command:

The top command provides a dynamic, real-time view of system processes, including details about CPU and memory usage.

top

Press 'q' to exit.

htop Command:

Similar to top, but with a more user-friendly interface. If it's not installed, you can install it using your package manager.

htop

Press 'q' to exit.

pgrep Command:

The pgrep command allows you to search for a process by name.

pgrep "process_name"

pkill Command:

The pkill command is used to send signals to processes based on their name.

pkill "process_name"

pstree Command:

The pstree command displays a tree diagram of processes.

pstree

System Monitor (GUI):

Many Linux distributions provide a graphical system monitor that displays running processes. For example, on GNOME-based systems:

gnome-system-monitor

On KDE-based systems, you might use ksysguard.

ps aux and grep:

You can use the combination of ps aux and grep to filter for specific processes.

ps aux | grep "process_name"

Replace "process_name" with the name or part of the name of the process you are looking for.

Choose the command that best suits your needs and provides the level of detail you require. The commands mentioned above provide information about the running processes, their PIDs (Process IDs), CPU and memory usage, and other details.

No comments: