 |
|
Oracle Tips by Burleson |
Display the Number of
Processors in Your Server
Keeping what we learned about the /proc/cpuinfo file in
mind, we could easily determine the number of processors in
our server by running the following command string:
# cat /proc/cpuinfo | grep
processor | wc -l
4
The command string returns a count of four. Let's take a look at
the construction of the command string to see why it returns a
processor count.
The cat command sends the contents of the file specified to the
standard output device (stdout) which defaults to the display
screen. If instead, we redirect or pipe (|) the output to a grep
command, we can search for a specified string (processor) in
the output.
If we then pipe the lines found that contain the string to the
word count, wc command using the -l option to count lines, we
will get a count of the lines found with the specified string. The
count that is returned is equal to the number of processors in
our server.
The above book excerpt is from:
Easy Linux
Commands
Working Examples of Linux Command Syntax
ISBN:
0-9759135-0-6
Terry Clark
http://www.rampant-books.com/book_2005_1_linux_commands.htm |