The way to see this is via the proc file system. Which is in /proc.
/proc file system is a virtual filesystem that reflect kernel states.
like any filesystem you can "ls" in it. First thing you see is a set of numbers, that is actually the process of the system. And a few thing as well. One thing about the /proc filesystem is that, some make sense to human, other is not quite.
Take an example, inside /proc, have cpuinfo.
cat /proc/cpuinfoYou should see the cpu information.
Another is
cat /proc/uptimethe information is not quite obvious.
Just now I show one can do with it already. In /proc, files act like files, text file to be precise, which is editable, but not recommended, it can mess up the system. So you can cat it, you can write script to read it. For example, in python
f=open("/proc/cpuinfo")And it applies to all other programming language that run linux, and can read files. So you can write program for it. Or get system information. For example, to get cpu temperature for a laptop, in my case, it runs a amd64 x2, I do something like this
for l in f:
print l
cat /proc/acpi/thermal_zone/tsz0/temperatureAnd some desklets use this to get system info too.
No comments:
Post a Comment