LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Trying to write simple command line application that prints CPU info etc. (https://www.linuxquestions.org/questions/programming-9/trying-to-write-simple-command-line-application-that-prints-cpu-info-etc-760992/)

erdek15 10-10-2009 10:51 AM

Trying to write simple command line application that prints CPU info etc.
 
I know I have to obtain the information from /proc file system..such as cat /proc/cpuinfo.

But how can I print this information on std-out?
If I write something like observer it should print those information.
Thank you!

ThinkFree 10-10-2009 10:53 AM

cat command is used to display a file.

erdek15 10-10-2009 11:23 AM

Quote:

Originally Posted by ThinkFree (Post 3714649)
cat command is used to display a file.

Well what I've learned is that files inside /proc are not actually files. Anyways, any idea how to get into /proc/cpuinfo and display that information on stdout?

ThinkFree 10-10-2009 11:27 AM

If you just want to show the info in terminal then
Quote:

cat /proc/cpuinfo
If you want to redirect the output of the command to a file then
Quote:

cat /proc/cpuinfo >filename

repo 10-10-2009 11:28 AM

As said by ThinkFree,
use the cat command


All times are GMT -5. The time now is 02:42 AM.