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!

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.

Thanks so much it definately more clear!