LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-25-2009, 02:27 AM   #1
arunarora
LQ Newbie
 
Registered: May 2009
Posts: 7

Rep: Reputation: 0
Linux Version number and hardwares list


Hi,

I am looking for a C/C++ code to get the Linux Version number and the hardwares list in the system like drive size, RAM size etc.

Also, Is is possible to get the OS version and hardwares list using same code on any linux flavour?? For e.g. Fedora, ubuntu, Debian etc?

Can anyone suggest some code for this.

Any help is greatly appreciated.

Thanks
Arun
 
Old 05-25-2009, 03:03 AM   #2
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
You can use the 'hwinfo' program, or 'uname', or 'lspci -vvv', 'lsusb', 'dmidecode', 'hardinfo', 'hwdata', OR you can use

'cat /proc/interrupts, iomem, ioports, irq, slabinfo, kallsyms, stat, swaps, keys, key-users, sysrq-trigger, kmsg, latency_stats, cpuinfo, meminfo, vmstat, diskstats, mounts, dma, mpt, mtrr, etc ...

You may or may not have all of these, or might have some different ones. Only one /proc/<name> at a time.
 
Old 05-25-2009, 04:02 AM   #3
arunarora
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Hi AwesomeMachine,

Thanks! I really appreciate your answer with a number of Linux commands in it to try. I haven't tried them all but I assume I will get the results I want, from these.
But, as I wrote I want some solution which I could code, so should I assume to execute the required commands in C/C++ code using system() or execl()??
Will this solution work for all Linux flavors or on the widely used flavors altleast like RHEL, Fedora, Ubuntu, Debian, CentOS, OpenSuse etc. I want to deploy an app that will send the system details about of the end-user system, their web activities, hardwares list, installed and currently running applications. The app will send the details to a server which provides the admins the usage behaviors in the network.

Any more pointers will really help.

Thumbs up!
Arun
 
Old 05-25-2009, 04:07 AM   #4
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
If you're doing a homework problem, I can see why you would want to code in C/C++, but shell scripting is how these commands would automated, customized. You can parse the output to a gui using grep, and sed.
 
Old 05-25-2009, 04:20 AM   #5
arunarora
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
The requirement is to code in C/C++ itself. So, I wont be able to use shell scripting directly. And this app is not a GUI app but an application that will run in background as a daemon. So, I need to write in C/C++ itself.
So, should I write a shell script and call it using C program or should I call the commands using code itself and then parse the output programmatically?
 
Old 05-25-2009, 05:04 AM   #6
arunarora
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
The requirement is to write the app in C/C++ itself. So I cannot use shell scripting directly. Also this is not a GUI app, instead its a client program that will run in background like daemon. So, should I write a shell script and the call it in C code or should I call the required commands programmatically? any suggestions.
 
Old 05-25-2009, 05:11 AM   #7
arunarora
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
sorry for reposting the reply, Network Blues :-(
 
Old 05-25-2009, 06:02 AM   #8
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Just take a look at the source code of say:
http://ezix.org/project/wiki/HardwareLiSter
 
Old 05-25-2009, 07:21 AM   #9
arunarora
LQ Newbie
 
Registered: May 2009
Posts: 7

Original Poster
Rep: Reputation: 0
I saw the app and it should help me with my work. Thanks
Now I can move onto my other query, how can I get all the application activity on user computers including app name, time of day, duration, version, etc. I need to know which applications are running currently in user's computers.

Any help, code snippet.

Thanks a lot.
Arun
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting the Linux Distribution Name and Version Number s&j Linux - General 9 08-12-2012 06:22 PM
linux supporting most hardwares jestinjoy Linux - Hardware 1 02-25-2008 12:34 PM
Program Version Number In Linux Is A Joke mbrocknroll General 24 11-17-2007 06:25 PM
Recommend me Linux Hardwares anindyanuri Linux - Hardware 7 12-10-2006 04:45 PM
Where can I found List of Hardwares supported by Red Hat Linux arbignay Linux - Hardware 1 06-08-2005 04:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:20 PM.

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