Simpler Navigation coming for Servers and Operating Systems
Coming soon: a much simpler Servers and Operating Systems section of the Community. We will combine many of the older boards, and you won't have to click through so many levels to get at the information you need. If you are looking for an older board and do not find it, check the consolidated boards, as the posts are still there.
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