Extracting info from OS/hardware

Tauno Voipio tauno.voipio at iki.fi.NOSPAM.invalid
Mon Mar 15 08:06:29 CET 2004


Cameron Laird wrote:
> In article <nOq3c.9451$_c4.119500 at news4.e.nsc.no>,
> Thomas Weholt <2002 at weholt.org> wrote:
> 
>>I need a piece of code to extract as much info about OS, current status and
>>hardware from a machine as possible ( at least, all available partitions and
>>free space on these, CPU-speed, free/total memory and stuff like that ) at
>>one given moment on Linux and Windows.
>>
>>Any hints? Can I call something in win32all on Windows or read some file on
>>linux? I'm not sure where to begin.
> 
> 			.
> 			.
> 			.
> I was hoping someone else would answer this.
> 
> My impression is that there are dozens of answers to this.
> I know I've seen quite a few such utilities advertised in
> places like Freshmeat.  I haven't kept track of them at 
> all.  
> 
> "... as much info ... as possible ...":  whoooo!  Usually
> when a manager says that to me, I ask for how much he's 
> willing to pay.  As it turns out, notions like "free 
> space", "CPU speed", and so on are surprisingly poorly
> standardized.  It's far from clear what they mean for any
> particular platform.
> 
> Sooooooo, what I usually do is define my requirements 
> carefully, and write up my own tool.

Plenty of the Linux information is in the /proc directory tree.

The files in /proc are actually windows into the kernel
innards giving at least the information you asked for.

For starters, read /proc/cpuinfo, /proc/meminfo and
/proc/partitions.

HTH

Tauno Voipio
tauno voipio @ iki fi




More information about the Python-list mailing list