linux – Getting a list of cpu and processes attached to them

Question:

There is a server. Centos 7 installed on the server. Within the interface, there is only the CLI . Several additional installed modules work under the OS. Each module in its configuration file is bound to a specific CPU core. Is it possible to somehow collect a list of CPU cores remaining for the system without going through the configuration files of the additionally installed modules? Maybe you can find something in /proc ?

Answer:

For example like this:

lscpu

  • see (if not known) how many CPUs in the system (core)

ps -o pid, psr, comm -C thunderbird

  • thunderbird for example your program – will show which CPUs are busy

well, then count

ps -o pid, psr, comm -C thunderbird | wc -l

  • the number of occupied cores and subtract from the total

If desired, everything can be wrapped in one command or script

Scroll to Top
AllEscort