Processes

How to see the cgroup of a process

Learn how to find the control group (cgroup) of a process by using /proc, pidof, or ps.

Summary

The control group of a process can be retrieved from the /proc directory. We only need to know the PID of the process, which can be found using ps or pidof.

Usage

If we know that our PID is 1234, then showing the cgroup is as easy as using cat to see the contents of the ‘cgroup’ file.

How to see cgroup in ps output

Want to see the control group in the output of the ps command? Here is how to tune your command options to include that.

Summary

The ps command can show the control group of a process using the -o option, followed by the right column names.

Usage

To show processes and the control group, we can filter the output columns.

# ps -e -o pid,cgroup:64,args
    PID CGROUP                                                           COMMAND
      1 0::/init.scope                                                   /lib/systemd/systemd --system --deserialize 58
      2 -                                                                [kthreadd]
      3 -                                                                [rcu_gp]
<snip>
    576 -                                                                [xprtiod]
    634 0::/system.slice/dbus.service                                    @dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
    640 0::/system.slice/networkd-dispatcher.service                     /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers
    645 -                                                                [nfsiod]
    653 0::/system.slice/systemd-logind.service                          /lib/systemd/systemd-logind
    696 0::/system.slice/system-getty.slice/getty@tty1.service           /sbin/agetty -o -p -- \u --noclear tty1 linux

In this example the PID is displayed, with the control group, and the command with its arguments. By specifying the width of 64 characters, we can properly see the full name of the control group.

How to stop all processes of a single user

Learn how to stop all processes of a single user using the killall command.

Summary

Killing processes with a filter

Kill

The kill command can be used on Linux systems to send a defined signal to a process. Learn how to use it and what signals are available.

Summary

The kill command is used on Linux to send a process signals. This can be a numeric value or its defined name (e.g. SIGTERM).

What is a zombie process?

What is a zombie process on Linux and how to deal with it? In this article we will have a look at the details.

Summary

Zombies…

How to kill a zombie process

How to kill a zombie process if it does not respond to kill -9? Here are a few last steps that you can try.

Summary

Killing zombies, for fun?

How to show a running process name and its process ID (PID)

Find the process ID (PID) and process name on Linux with the help of the pgrep command.

Summary

Search for PID and process name

How to find all process IDs by its process name

Discover the process ID (PID) on Linux for a running process by searching for its process name.

Summary

Retrieve PIDs for a service

Linux process signals and their meaning

Want to know the difference between SIGHUP, SIGKILL, and SIGTERM? Learn about Linux process signals, including a list and description.

Summary

Linux uses signals to interact and define the state of a process. It uses POSIX reliable and real-time signals. The first are considered standard signals.

Many programs are build using glibc and therefore use functions like kill(2) to send a signal to a process or processes group, or even all processes on the system. A process can decide to ignore a signal or take an action after it is received by a signal handler, a routine to catch incoming signals.

How to kill a running process by its name

Find and stop a running process on Linux by searching for its name using the killall or pkill command.

Summary

Stop a process by searching for its name

Processes: Frequently Asked Questions

Frequently asked questions about start and stop processes, discover information, and monitoring them.

Summary

Processes

This section provides tips and tricks to deal with processes on Linux systems. Got another tip? Let it know!

Summary

A Linux systems without processes is not possible. So we collect tips to deal with processes and improve your skills.

Kill a process that won't respond to CTRL+C

Got a process that won't respond to CTRL+C? With this tip you can kill almost all processes without having to open a second terminal.

Summary

Sometimes a process gets stuck and how often you try, it won’t respond to the combination of CTRL+C. One option is to open a second shell, then perform a kill.

kill 1234

Pushing a job to the background

While this works, there is usually a much easier way. This involves pushing a running process into the background by pressing CTRL+Z.

[1]+  Stopped                 ./runserver

Kill the process

To get it back to the foreground, we would normally run fg. Instead, we tell it to stop.

Understanding what runs on your Linux system (and why)

Linux systems have a lot of processes running by default. Let's dive into how programs are started and how you can see all details of each running process.

Summary

Introduction

Each Linux system has a bunch of processes running. Most of these processes might be familiar to you if you regularly use a command like ps or top to display them. Processes may look like just an item in a list. They are actually complicated pieces of code that are tamed by a memory manager. To truly understand how your system is running, knowledge of process (or memory) management is of great help. So let’s make a jump into the internals of Linux by learning the tools at our disposal.

Understanding memory information on Linux systems

Linux memory management is an extensive subject. This guide helps you understanding the how to analyze it and obtain available memory information.

Summary

Every operating system needs memory to store program code segments and data. This is also true for Linux systems. The problem: there is a lot of information available regarding memory usage and its behavior. Let’s discover how Linux manages its memory and how we can gather memory information.

After reading this guide, you will be able to:

  • Show the total amount of memory
  • Display all memory details
  • Understand the details listed in /proc/meminfo
  • Use tools like dmesg, dmidecode, free, and vmstat

Linux memory information

Random access memory

When we talk about memory in this article, we usually mean random access memory (RAM). This is the memory which can be used for both showing and storing data. Typically we will find in this type of memory the programs that are running on the system, including the Linux kernel itself. Besides the program code, memory also stores a lot of data. A good example is when you are running a MySQL database server. The program itself is relatively small, the data itself is huge. So we will also have a look at tuning programs and their memory usage, as this is typically a problem with memory-hungry programs.

Auditing Linux processes: The Deep Dive!

In-depth article about auditing Linux processes. Determination of running processes, memory and on-disk structure and the proper tools for analyzing them.

Summary

From the initial start of the Linux operating system, the first processes are already born. In this article we have a look on dealing with processes. In particular we look at how to do process auditing. Whenever you are an auditor, system administrator or just a Linux enthusiast, you can’t ignore processes and should know how to deal with them.

Process listing

For most people working on Linux systems, it might be obvious to display running processes with ps. For Linux it’s common to use ps -ef, which shows effectively a list of all processes with a full listing. Those who are used to work on BSD machines will prefer using ps aux. On Linux with the POSIX tools, both will work, however with a slightly different output.