2. Write a shell script that produces some summary information of the system at a particular moment


 
Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions 2. Write a shell script that produces some summary information of the system at a particular moment
# 1  
Old 05-15-2011
2. Write a shell script that produces some summary information of the system at a particular moment

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!

1. The problem statement, all variables and given/known data:



2. Relevant commands, code, scripts, algorithms:



3. The attempts at a solution (include all code and scripts):



4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):


Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).

I am trying to figure this out and I am not getting it at all can someone please help with this as I am ignorant to shell scripting. below is the required information

1. 1. A list of the people currently logged in and for how long they are up.
2. A list of processes currently running, showing the userid, process id, CPU and memory usage, and command name. Sort these by either userid or process id (your choice, you don't have to support both), but make sure whichever you sort by is the first column.
3. Another list of processes, showing only the top 10 based on memory usage, sorted by memory usage. Include the same fields as above, but showing memory usage in the first column.

Hint: Make use of ps, who, echo, mail ....

###############################################
Here is what I have so far

ps -e | sort -n -r | head -n 10

Not sure where to go from here!!!

Baker college of Jackson, Michigan USA
Instructor Sohail Sadiq, LUX/211---- Not an online course so do not have a direct link to virtual class!
# 2  
Old 05-15-2011
Given that this is for an assignment, I'll only make a few suggestions that should allow you to figure it out.

First, check out the man page for the who command. This should help with your first requirement.

Secondly, ps -e probably isn't going to give you enough information based on your requirements. Again check the man page, particularly the -o option. This will be key in meeting the second requirement of having your sort field be the first column.

Yes, piping the output of the ps command through the sort and head commands will indeed give you the desired output for the last part of your assignment, so you are on the right track. Right now you need to tailor the ps command to generate the needed data in the output.

Man pages are nicely linked from the unix.com site (see the top menu bar) for a fair few number of UNIX flavours. This should make getting a handle on these commands easier.

Hope this helps to get you going again.
# 3  
Old 05-15-2011
Thanks so much it definately more clear!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to write config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

2. UNIX for Dummies Questions & Answers

How to write Config shell script to pass variables in master shell script?

Dear Unix gurus, We have a config shell script file which has 30 variables which needs to be passed to master unix shell script that invokes oracle database sessions. So those 30 variables need to go through the database sessions (They are inputs) via a shell script. one of the variable name... (1 Reply)
Discussion started by: dba1981
1 Replies

3. Shell Programming and Scripting

Need a shell script to compare two directories and produces the output

Hi, I am using solaris OS 10 and Bash shell.I need a script which will compare the two directories and produces the output. Step 1: In detail say suppoose I have machine one and have a directory dir1. Script should iterate through the directories and subdirectories inside and produce the output... (10 Replies)
Discussion started by: muraliinfy04
10 Replies

4. OS X (Apple)

OS 10 lässt sich nicht mehr installieren...ubuntu läuft als system im moment....hilfe!

hello, I have installed on my MacBookPro Ubuntu via Boot Camp, but bootcamp has deletet that MacOS partion and created just one new and installed ubuntu. Now I can not install MacOS 10 from the DVD, the gray screen comes when I use the "C" key during the boot process. it starts booting... (2 Replies)
Discussion started by: ingwio
2 Replies

5. SuSE

Write shell script using menu-driven approach to show various system

QUESTION: Write shell script using menu-driven approach to show various system configuration like 1) Currently logged user and his logname 2) Your current shell 3) Your home directory 4) Your current path setting 5) Your current working directory 6) Show Currently logged number of... (1 Reply)
Discussion started by: bboyjervis
1 Replies

6. Shell Programming and Scripting

read -n1 -r -p "Press..." key / produces error in bash shell script

Hello! Sorry, for my not so perfect english! I want to stop bash shell script execution until any key is pressed. This line in a bash shell script read -n1 -r -p "Press any key to continue..." key produces this error When I run this from the command line usera@lynx:~$ read... (4 Replies)
Discussion started by: linuxinho
4 Replies

7. UNIX for Dummies Questions & Answers

Write a script to extract information from a db

Hi I need to put together a script that will search certain tables in a db and send that data to a csv file. Basically I am importing data to a db and I want to write a script to check that all information was imported correctly. Thank you (1 Reply)
Discussion started by: ladyAnne
1 Replies

8. Shell Programming and Scripting

how to write a shell script to login to a system which is interactive.

Can anybody help me to write a shell script to login interactive system once u open a connection using telnet it will ask for USERCODE: PASSWORD: DOMAIN: (1 Reply)
Discussion started by: sudhakaryadav
1 Replies

9. Shell Programming and Scripting

Create Summary file containg information

Folks, I have multiple files in a folder containing some information (there is around 100 of them). What I would like to do would be able to import some of the information into a summary text file so that it will be easier to read a glance. The name of the files all start with the naming... (4 Replies)
Discussion started by: lodey
4 Replies

10. UNIX for Dummies Questions & Answers

System Summary Tools

Are there any system sumary tools for Linux? What are some good ones for Solaris and HP-Ux? (2 Replies)
Discussion started by: vader
2 Replies
Login or Register to Ask a Question