How to find unix/linux system info like OS version, RAM, no. of processors, hard disk, memory dedicated to a particular process, memory utilization of java using java or shell scripts.
2 Answers
To find the version of the kernel, use uname -r in a shell script. All kinds of information regarding the hardware can be retrieved from the files in /proc.
/proc/cpuinfo contains information about the CPU's, including their number. /proc/meminfo shows the total physical memory, free memory, etc.
If you only want to fetch a particular field, you can filter the output like this:
cat /proc/cpuinfo | grep "model name"
df shows you all of the mounted storage devices and their used space.
/proc/PID/status shows the amount of virtual memory dedicated to the process, where PID is the numeric process id.