Showing posts with label cpuinfo. Show all posts
Showing posts with label cpuinfo. Show all posts

Friday, August 14, 2009

Determining Bits of CPU and OS (32/64-bits)

In order to determine whether OS/CPU is 32-bit or 64-bit,
you can use this shell script.


#!/bin/bash
echo -n "Running "

RES=`uname -a | grep 64`
if [ $? -eq 0 ]; then

echo -n "64-bit "
else
echo -n "32-bit "
fi
echo -n "operating system on a "

RES=`cat /proc/cpuinfo | grep " lm "`
if [ $? -eq 0 ]; then

echo -n "64-bit "
else
echo -n "32-bit "
fi
echo "machine"




Sample Run:

$ ./os_cpu.sh
Running 64-bit operating system on a 64-bit machine

Friday, October 17, 2008

Total RAM in your System

In order to find total RAM in your system, give following command:

$ cat /proc/meminfo | awk '/^MemTotal/ {print $2/1024 " MB"}'
2008.07 MB

If you all information related to memory:

$ cat /proc/meminfo


Extra:
Total CPU cores in your system:

$ cat /proc/cpuinfo | awk '/^processor/ {ncores++} END {print "Total cores = " ncores}'
Total cores = 2