Process Management Tools

LinuxLinuxBeginner
Practice Now

Introduction

Linux provides a number of tools to help you manage processes and resource. In this lab, you will learn how to use the following tools.

Achievements

  • ps - List processes
  • top - Display processes dynamically
  • free - Display amount of free and used memory in the system

Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/SystemInformationandMonitoringGroup(["`System Information and Monitoring`"]) linux/SystemInformationandMonitoringGroup -.-> linux/ps("`Process Displaying`") linux/SystemInformationandMonitoringGroup -.-> linux/top("`Task Displaying`") linux/SystemInformationandMonitoringGroup -.-> linux/free("`Memory Reporting`") subgraph Lab Skills linux/ps -.-> lab-46{{"`Process Management Tools`"}} linux/top -.-> lab-46{{"`Process Management Tools`"}} linux/free -.-> lab-46{{"`Process Management Tools`"}} end

List Process

ps is a command-line tool that lists the processes running on the system. It can be used to list all processes, or to list processes for a specific user.

To list all processes, use the ps command with the -A options.

ps -A

List Processes For A Specific User

To list processes for a specific user, use the ps command with the -u option. The -u option lists processes for the specified user.

ps -u root

List All Processes and the Full Command Line

To list all processes and the full command line, use the ps command with the -ef option. The -ef option lists all processes and the full command line.

ps -ef

List All Processes For All Users In Full Format

To list all processes for all users in full format, use the ps command with the -aux options.

ps -aux

List Processes By Process ID

To list processes by process ID, use the ps command with the -p option. The -p option lists processes by process ID.

ps -p 1

Display Processes Dynamically

top is a command-line tool that displays processes dynamically. It can be used to display all processes, or to display processes for a specific user with some options.

To display all processes, use the top command without any options.

top

To exit top, press q or Ctrl + C.

Display Processes For A Specific User

To display processes for a specific user, use the top command with the -u option. The -u option displays processes for the specified user.

top -u root

Display All Processes with Command Line

To display all processes with command line, use the top command with the -c option. The -c option displays all processes with command line.

top -c

Display All Processes with Delay

To display all processes with delay, use the top command with the -d option. The -d option displays all processes with delay.

Tips: The default delay is 3 seconds.

top -d 1

Display Memory Usage

free is a command-line tool that displays the amount of free and used memory in the system.

To display memory usage, use the free command without any options.

free

Display Memory Usage In Human Readable Format

To display memory usage in human readable format, use the free command with the -h option. The -h option displays memory usage in human readable format.

free -h

Summary

In this lab, you learned how to use the ps command to list processes, and how to use the top command to monitor processes. You also learned how to use the free command to display memory usage.

This command can be used with other commands to display processes in a specific format. For example, you can use the ps command with the grep command to display processes that match a specific pattern.

keep exploring!

Other Linux Tutorials you may like