I often find myself using these commands to get detailed information about a system’s hardware or manage system’s resources. I will probably update this list as I think of more.
Get Process ID
To find the process ID of a specific process, use the following command:
| |
Replace <query> with the query or name of the process you are looking for.
In the following sections, we’ll use $PID to represent the process ID you obtain from this command.
| |
Get all TIDs in a process
| |
pidstat
pidstat is a command-line tool that reports detailed information about the running processes. You can get a comprehensive pidstat report by running the following commands:
To install:
For Debian/Ubuntu:
| |
For Alpine Linux:
| |
To get a detailed report for a given process:
| |
tuna
tuna is a utility for managing threads and CPU cores. You can isolate a specific CPU core or move a thread to a different core using the following commands:
To isolate a CPU:
| |
To move a thread to a specific CPU:
| |
Replace CPU# with the CPU core number and $TID with the thread ID.
CPU and Topology Details
To gather detailed information about your system’s CPU, you can use the following commands:
| |
lstopo is a command-line tool that provides a graphical representation of your system’s hardware layout.
To install it, run:
For Debian/Ubuntu:
| |
For Alpine Linux:
| |
To get CPU topography:
| |
Memory Details
To get detailed information about your system’s memory, use the following commands:
| |
numactl
numactl is a utility for managing Non-Uniform Memory Access (NUMA) systems.
To install it and check your system’s NUMA hardware information, run:
For Debian/Ubuntu:
| |
For Alpine Linux:
| |
To get hardware information:
| |
Run process on a specific numa node:
| |
Watch Interrupts
To monitor the interrupts in real-time, use the following command:
| |
Taskset
taskset allows you to set or retrieve the CPU affinity of a process.
| |
Replace CPUID with the CPU core number and $TID with the thread ID.