I\'m typing a shell script to find out the total physical memory in some RHEL linux boxes.
First of all I want to stress that I\'m interested in the total ph
These are the ways :
1. /proc/meminfo
MemTotal: 8152200 kB
MemFree: 760808 kB
You can write a code or script to parse it.
2. Use sysconf by using below macros
sysconf (_SC_PHYS_PAGES) * sysconf (_SC_PAGESIZE);
3. By using sysinfo system call
int sysinfo(struct sysinfo *info);
struct sysinfo { .
.
unsigned long totalram; /*Total memory size to use */
unsigned long freeram; /* Available memory size*/
.
.
};