LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 02-02-2007, 12:32 AM   #1
stranger_6_7
LQ Newbie
 
Registered: Nov 2006
Posts: 24

Rep: Reputation: 15
System Command To Output CPU Type and RAM


Hi

Does linux have any system command to display processor type and RAM available in a system. Or do we need to write a script to print this system information.

Thanks in Advance
Stranger
 
Old 02-02-2007, 12:38 AM   #2
Mega Man X
LQ Guru
 
Registered: Apr 2003
Location: ~
Distribution: Ubuntu, FreeBSD, Solaris, DSL
Posts: 5,339

Rep: Reputation: 65
I think you will find all the info you need in /proc (ex: cat /proc/cpuinfo. << it won't work on every distro, I guess). There has to be a command to find that out, but I can't remember... hmmm

Last edited by Mega Man X; 02-02-2007 at 12:40 AM.
 
Old 02-02-2007, 01:43 AM   #3
edenCC
Member
 
Registered: May 2006
Location: China
Distribution: Debian
Posts: 198
Blog Entries: 1

Rep: Reputation: 32
In most common distributions,you can use dmesg or dmidecode to get these details.
Generally,the diretory /proc provides a simple way for you.
 
Old 02-02-2007, 05:25 AM   #4
stranger_6_7
LQ Newbie
 
Registered: Nov 2006
Posts: 24

Original Poster
Rep: Reputation: 15
Hi

I am trying to print my system information. But when i use file_get_contents("/proc/cpuinfo"), it is displaying a error message as it is read-protected. How can i read contents of this read protected file.

Thanks in Advance
stranger
 
Old 02-03-2007, 08:19 PM   #5
Shade
Senior Member
 
Registered: Mar 2003
Location: Burke, VA
Distribution: RHEL, Slackware, Ubuntu, Fedora
Posts: 1,418
Blog Entries: 1

Rep: Reputation: 46
Check the permissions on /proc/cpuinfo. It should be world readable, but may vary from distro to distro.

Also, if you're trying to do a file open on it, you should be aware that everything in /proc isn't really a file. It's a dynamic tree of what appear used as an interface to the kernel and for various data about your running system.

--Shade
 
Old 02-07-2007, 03:08 AM   #6
stranger_6_7
LQ Newbie
 
Registered: Nov 2006
Posts: 24

Original Poster
Rep: Reputation: 15
I have done this using system function
system ( vi '/proc/cpuinfo').

But to save the entire output into a variable
$sysstat = print system(vi '/proc/cpuinfo')

But $sysstat contains only the first line . How can i print the entire information present in cpuinfo.

Thanks in Advance
stranger
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Correct type of RAM for P3 Phyrexicaid Linux - Hardware 4 01-30-2007 06:54 PM
type sudo command then i cant type in a password turoblaztr Linux - General 5 01-14-2007 09:58 AM
How can I detect CPU/OS type within C++ ? fcdev Programming 3 07-25-2006 05:50 PM
command to see RAM type curos Linux - General 2 03-15-2006 10:00 AM
2 CPU and 8G ram BRAHmS Linux - Newbie 2 05-07-2004 10:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration