cancel
Showing results for 
Search instead for 
Did you mean: 

program

karunesh reddy
Occasional Contributor

program

i wanted to write a default version of program to report the behavior of the linux kernel by inspecting kernel state.i want the program to print the following values on stdout.
1 cpu type and model of the pc
2.kernel version
3.amount of time since the system the system was last booted, in the form 4days 10hrs 20 minutes 32 seconds formatted 04:10:20:32...
-
2 REPLIES
Stuart Browne
Honored Contributor

Re: program

1) start with 'uname -m', and then look at /proc/cpuinfo

2) uname -r
3) bit of uptime parsing.. look at 'cut', or 'awk'. As to where you're gonna get the seconds from, I'm not sure..
One long-haired git at your service...
Mark Fenton
Esteemed Contributor

Re: program

uname -r shows the kernel version
uname -v shows the last boot time in the format you want. For instance, on my system,
uname -v returns
#1 Mon Jun 10 15:31:48 EDT 2002
cat /proc/cpuinfo
returns a bunch of information on the cpu.

Mark