Information Technology Tips

Innotechtips_logo_v4
Menu
  • Home
  • Linux
  • Programming
  • Other Tech Tips
    • Windows
    • Security
Youtube
Home Linux

How To Monitor and Manage Processes in Ubuntu Linux

Inno by Inno
July 27, 2023

There are two main types of processes or services in Ubuntu Linux:

Daemon

These are services that start automatically when a computer is booting up.

These services are managed using the systemctl command.

Jobs

These are services that are started from the shell.

These services have specific management commands.

Example of a Job:

dd if=/dev/zero  of=/dev/null  (This command triggers a job but is not very useful as it is copying nothing to nowhere)

Below are some of the commands that can be used to manage jobs.

To stop the above job temporarily:

CTRL+Z

The bg command is used to put a job in the background. This frees the shell and allows us to do something else while the job is running.

To show the list of current jobs running in the shell:

jobs

To bring a job to the foreground. This allows us to further manage the job:

fg

To terminate a job:

CTRL+C

To list all processes and their relationships (i.e., parent, child relationship). Note that a child process is killed whenever a parent process is terminated.

ps fax

Alternatively, we can use the below command:

pstree

Commands for Monitoring Processes

The 2 most common commands for viewing/monitoring processes are the top and ps aux commands.

Top provides some commands for managing processes when one has admin privileges.

To do a demonstration, we will generate a process by running a script. The below script creates an infinite loop.

while true; do true; done &

To show running jobs and their process IDs:

jobs -l

The column headers seen on the top screen include PID (process ID), user, priority, and nice values.

After starting the job and then running the top command, we will notice that the load average (determined by the number of cpu’s on the system; 1 cpu = max load average value of 1.0) value continues to increase.

We also see that the percentage cpu utilization value is very high. This is due to the job that we generated that is putting a lot of demand/load on the system resources. On the top screen, we also have the total amount of memory and free memory.

When in top, we can change process priority using renice (type the letter r then enter value). Nice values range from -19 (more aggressive) to 19 (less aggressive) and are used to change the priority of a process. You have to be root in order to increase the priority of a process.

Killing processes

We can also kill processes by sending signals. To send a signal just press k while within the top interface.

Once you type k, you will be prompted for the PID, the default will be the topmost PID. Press enter and then you will be asked for the signal value to send.

There are several signal options but the two main ones for terminating a process are 15 (nice way of terminating a process) and 9 (not a nice way of terminating a process as it does not clean up).

Conclusion

In this article, we looked at the two main types of processes or services in Linux. We went over a few of the commands that can be used to manage jobs in Linux. Some of the commands included those for displaying the running process and those for stopping the services. We also highlighted the tools that are available for viewing and monitoring processes. These tools allow us to view details such as process id, priority, CPU, and memory usage. Finally, we covered the commands for killing or ending processes.

Inno

Inno

Related Posts

Linux

Getting Started with Kali Linux: A Guide for Beginners

July 31, 2024
Linux

20 Linux Commands for Beginners

March 31, 2024
Linux

What is KVM Virtualization?

March 31, 2024
Linux

The Linux Booting Process in Linux

February 17, 2024

Category

  • Linux
  • Other Tech Tips
  • Programming
  • Windows

Recommended.

How to Find Network Vulnerabilities Using NMap

June 4, 2024

2 Ways to Install Google Chrome Browser on Kali Linux

July 27, 2023

Trending.

How To Connect Kali Linux to Wi-Fi on VirtualBox

October 9, 2023

How to Install and Enable Free VPN in Kali Linux

July 27, 2023

How to Connect Kali Linux on VMware Workstation to a Wi-Fi Network

July 27, 2023

How to Capture Network Traffic on a Wi-Fi Network using Kali Linux

July 27, 2023
How to Connect to Kali Linux from Window’s Command Prompt

How to Connect to Kali Linux from Window’s Command Prompt

July 27, 2023

About us

This site is dedicated towards highlighting various important aspects of information technology. The key areas includes programming, Linux, software, and security. The content will include articles as well as videos.

Quick Links

Menu
  • Home
  • Linux
  • Programming
  • Other Tech Tips
    • Windows
    • Security

Privacy Policy

Menu
  • Privacy Policy
Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}
No Result
View All Result
  • Cookie Policy (EU)
  • Home 1
  • Home 2
  • Home 3
  • Mytest Page
  • Privacy Policy

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.