Results 1 to 6 of 6
I need help writing my first script. When I run this script I need these information to be display:
1) The number of cores the system is using
2) The ...
- 09-08-2008 #1Just Joined!
- Join Date
- Sep 2008
- Posts
- 26
need command line help
I need help writing my first script. When I run this script I need these information to be display:
1) The number of cores the system is using
2) The CPU thats related to the core
3) Video card type
4) Number of video cards the system is using
5) Memory type
6) How much memory the system has
7) Last user that logged in
Please advise on the command lines I need to display these information. Thanks in advance. (I am working with Debian Linux)
- 09-08-2008 #2Is this a homework question??
Originally Posted by sidebrake 
Hint: You can get an awful lot of info you are after from the /proc directoryCan't tell an OS by it's GUI
- 09-08-2008 #3Just Joined!
- Join Date
- Sep 2008
- Posts
- 26
- 09-08-2008 #4Just Joined!
- Join Date
- Sep 2008
- Posts
- 26
when i use the command:
"cat /proc/cpuinfo | grep 'model name' | cut -d: -f2"
i get this output:
"Dual-Core AMD Opteron(tm) Processor 2222"
"Dual-Core AMD Opteron(tm) Processor 2222"
"Dual-Core AMD Opteron(tm) Processor 2222"
"Dual-Core AMD Opteron(tm) Processor 2222"
how do i make it so it will do a count for me instead of display all 4 outputs... for example i am looking for something like this:
"Dual-Core AMD Opteron(tm) Processor 2222 = 4"
Please advice thanks!
- 09-09-2008 #5Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
That's the basic idea on shell scripting. I changed cut by sed because I preffer it, and it can also take rid of that space that there was in front of the model name (just after the : colons that you use as a field delimiter).Code:COUNT=$(cat /proc/cpuinfo | grep 'model name' | sed -e 's/.*: //' | wc -l) echo -n $(cat /proc/cpuinfo | grep 'model name' | sed -e 's/.*: //' | uniq) = $COUNT
- 09-09-2008 #6Just Joined!
- Join Date
- Sep 2008
- Posts
- 26


Reply With Quote
