Display Number of Processors on Linux Показувати кількість процесорів на Linux
If you've just upgraded your Linux box, or you are wondering how many processors a remote server has, there's a quick and dirty command you can use to display the number of processors. Якщо ви тільки що оновили облікову Linux Box, або ви хочете знати, скільки процесори віддаленому сервері, є швидкі і брудні команди можна використовувати для відображення кількості процесорів.
On Linux, /proc/cpuinfo contains all of the processor information for all current processors in your computer. У Linux / Proc / CPUInfo міститься вся інформація про процесор для всіх сучасних процесорів у комп'ютері. This will include the speed, the amount of on-chip cache, processor type, and how many cores.
Here's the command: Ось команда:
cat /proc/cpuinfo | grep processor | wc -l Cat / Proc / CPUInfo | Grep процесор | WC-L
The command just looks in the /proc/cpuinfo file, pulls out the number of lines containing the word “processor” and passes them into wc (word count), which returns a count of the CPUs in the system. Команда просто дивиться в / Proc / CPUInfo файл, витягує число рядків, що містять слова "процесор", і передає їх в туалет (Word Count), який повертає кількість процесорів в системі.
Here's what it returned on my remote server: Ось що він повернувся на мій віддалений сервер:
[root@root]# cat /proc/cpuinfo | grep processor | wc -l [Root @ Root] # CAT / Proc / CPUInfo | Grep процесор | WC-L
4 4
Note that if you have a dual-core processor, it will return each core as a separate processor. You can look at the full output of cat /proc/cpuinfo to see if the chips are dual-core. Ви можете поглянути на повний вихід з кішки / Proc / CPUInfo чи чіпів Dual-Core.

Daily Email Updates Email Щоденні оновлення
You can get our how-to articles in your inbox each day for free. Ви можете отримати наші довідкові статті у Вашу поштову скриньку щодня безкоштовно. Just enter your name and email below: Просто введіть ваші ім'я та адресу електронної пошти нижче:



Hi, Привіт,
this will give you the same result and saves you having to type a couple of characters Це дасть вам той же результат і заощаджує ваш того, щоб вводити пару символів
grep processor /proc/cpuinfo |wc -l Grep процесор / Proc / CPUInfo | WC-L
This will save you a pipe Це врятує вас труба
grep -c processor /proc/cpuinfo Grep-C процесор / Proc / CPUInfo
Won't this count CPUs with hyperthreading twice? Не буде цього кількість процесорів з HyperThreading двічі? My computer has one Pentium 4 (Prescott) CPU, but has two processor entries in cpuinfo. Мій комп'ютер став одним Pentium 4 (Prescott) процесор, але має два процесори записів у CPUInfo.
Well… Sorry to say that it doesn't work most of the time. Ну ... на жаль, що він не працює більшу частину часу. Beside multithreadin processors, It is common that entry on a single processor has multiple occurence of word “processor” (both in the procesor identifier and model name. Крім multithreadin процесора, він є загальним, що в'їзд на одному процесорі кілька поява слова "процесор" (як у Procesor ідентифікатор і назва моделі.
On my ancient pemtium M laptop it reports 2 processors because ist modelname is “Intel(R) Pentium(R) M processor 1.73GHz”. За моєї давньої pemtium М ноутбука його доповідях 2 процесора, оскільки IST ModelName є "Intel (R) Pentium (R) M Processor 1.73GHz".
This might help: Це може допомогти:
grep -c ^processor /proc/cpuinfo Grep-C ^ процесор / Proc / CPUInfo
To get the count of physical CPUs, this works by counting the unique physical ids Щоб отримати кількість фізичних процесорів, це працює шляхом підрахунку унікальні фізичні IDS
grep “physical id” /proc/cpuinfo |sort -u|wc -l Grep "фізичний ID" / Proc / CPUInfo | Сортувати-U | WC-L
This comment I wrote may also help you (it's actually for Linux): Цей коментар я написала також можуть допомогти вам (це насправді для Linux): http://www.howtogeek.com/howto.....ment-64380 http://www.howtogeek.com/howto.....ment-64380