LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-07-2011, 03:57 AM   #1
bigbada
LQ Newbie
 
Registered: Mar 2011
Posts: 7

Rep: Reputation: 0
simple bash script


Write a Bash script that displays the system status according to:
- CPU,
- storage,
- disk,
- network.
The script should use a basic commands of the Linux operating system and builds a simple dashboard including as much information as possible. The system data should be saved into script variables or arrays.

Can any1 help me to do this ?

We must use: man, find, cut, sort, tee, echo, wc, ps, grep, whoami.

awk and sed is prohibited.
 
Old 03-07-2011, 03:58 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
No! We aren't going to do your homework for you! That's called "Cheating". Do your best and if you have ***SPECIFIC*** questions then please ask again.
 
Old 03-07-2011, 03:59 AM   #3
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
We must use: man, find, cut, sort, tee, echo, wc, ps, grep, whoami.
Perhaps you can start with
Code:
man find
man cut
man sort
man tee
man echo
man wc
man ps
man grep
man whoami
Kind regards
 
Old 03-07-2011, 04:04 AM   #4
bigbada
LQ Newbie
 
Registered: Mar 2011
Posts: 7

Original Poster
Rep: Reputation: 0
This is no homework. I readed all the manuals for the commands, but even know i dont know how to start
How to display system status for CPU and so on ? I dont find the command

Last edited by bigbada; 03-07-2011 at 04:06 AM.
 
0 members found this post helpful.
Old 03-07-2011, 04:07 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Please don't insult our intelligence, there is NO WAY this is not an assignment. You've pasted it in verbatim, and evn put in comments about certain commands not being allowed, which is SUCH a giveaway it's unreal.
 
1 members found this post helpful.
Old 03-07-2011, 04:10 AM   #6
bigbada
LQ Newbie
 
Registered: Mar 2011
Posts: 7

Original Poster
Rep: Reputation: 0
I say it again! Its not a homework. Its just a personal matter! If u dont believe me then nothing. I asked nicely, cuz i dont know what to do, and this is what i get. Such a kindness really.
 
0 members found this post helpful.
Old 03-07-2011, 04:15 AM   #7
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Quote:
How to display system status for CPU
http://www.google.be/search?q=linux+...ient=firefox-a
http://tldp.org/LDP/Bash-Beginners-G...ers-Guide.html

Kind regards
 
Old 03-07-2011, 04:47 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
if this was my personal issue, then my solution would probably have awk and sed all over it. Would that be OK? If not, why not?
 
Old 03-07-2011, 04:54 AM   #9
bigbada
LQ Newbie
 
Registered: Mar 2011
Posts: 7

Original Poster
Rep: Reputation: 0
No, i wanna learn it without awk/sed

I have another question.
I did
cat /etc/passwd | grep "/home" | cut -d: -f1 |
bla
blabla
blablabla
cat /etc/passwd | grep "/home" | cut -d: -f1 | wc -w
3
that counts the words
now i wanna print into echo this counted number.. how i do that?
echo "number of counted words are %d(the wc -w count must be here) " ??
 
0 members found this post helpful.
Old 03-07-2011, 09:04 AM   #10
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,566

Rep: Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901Reputation: 2901
How about you solve one problem at a time. You claim it is not homework, so i will believe you for now. Show us what you have done so far and we will assist?

So far the only help I would give is that nearly everything you have asked when searched in google seems to have many, many responses.
 
Old 03-07-2011, 09:38 AM   #11
120
Member
 
Registered: Oct 2010
Posts: 46

Rep: Reputation: 9
Perhaps the OP misses the fact that this very same set of questions/homework have been posted here before. Nobody much warms to helping a liar.
 
Old 03-07-2011, 09:38 AM   #12
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,211

Rep: Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612
Quote:
Originally Posted by bigbada View Post
No, i wanna learn it without awk/sed

I have another question.
I did
cat /etc/passwd | grep "/home" | cut -d: -f1 |
bla
blabla
blablabla
cat /etc/passwd | grep "/home" | cut -d: -f1 | wc -w
3
that counts the words
now i wanna print into echo this counted number.. how i do that?
echo "number of counted words are %d(the wc -w count must be here) " ??
Code:
someoutput=`cat /etc/passwd | grep "/home" | cut -d: -f1 | wc -w`
echo "dum de dum de dum $someoutput dum de de de"
 
Old 03-07-2011, 04:16 PM   #13
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,330

Rep: Reputation: 4473Reputation: 4473Reputation: 4473Reputation: 4473Reputation: 4473Reputation: 4473Reputation: 4473Reputation: 4473Reputation: 4473Reputation: 4473Reputation: 4473
Quote:
Originally Posted by bigbada View Post
I say it again! Its not a homework. Its just a personal matter! If u dont believe me then nothing. I asked nicely, cuz i dont know what to do, and this is what i get. Such a kindness really.
No, I don't believe you. The original question was phrased EXACTLY like a homework question would be. Saying also "we must use xxxx", says that it's an assignment, rather than just a random question.

If it WAS a random question, you'd just ASK it, and say "How could I monitor CPU with a bash script?", and not worry about the command(s) used to do it. And spell out your words....that text speak garbage isn't a good thing to post in.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Need simple bash script help rickenbacherus Linux - General 1 11-01-2006 03:44 AM
Simple bash script lp449 Linux - Networking 3 08-02-2005 05:25 PM
Simple bash script Soulful93 Programming 1 06-04-2005 08:26 PM
Simple Bash Script dmedici Programming 9 12-31-2004 04:48 AM
Help with simple bash script - please tw001_tw Linux - Software 5 12-19-2004 10:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:07 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration