Results 1 to 2 of 2
Hello all:
I'm not a student, but while working on a job I was asked get a simple script to perform the following task and would like to ask for ...
- 03-02-2010 #1Just Joined!
- Join Date
- Mar 2010
- Posts
- 1
Help please... User and process listing...
Hello all:
I'm not a student, but while working on a job I was asked get a simple script to perform the following task and would like to ask for some help.
I need a script for a Unix server, using as few lines as possible, that will generate a list of users that have active processes on the server and the number of processes for each of those users.
I know the basic scripting and syntax of creating structured code creation as I had to take a bunch of programming classes in college, and have created many batch apps in the Windows command line world.
I'm assuming there is a show process command, and for some reason I want to say it's something like sho usr or close to that. This script will e run under the root user.
If it was commented out that would be really great too, as I enter the world of open source.
Would someone please be so kind to assist me or have an old one lying around?
Many thanks in advance for your consideration,
Mo-
- 03-02-2010 #2
Why would you need a script to be as few lines as possible? I could understand if this was a homework assignment, but it's for work you said.
The problem with your question, is that you just say you need the script for UNIX, not which version of unix, or more importantly, which shell for unix. a ksh (default on AIX, and I believe Solaris) script will be slightly different in some cases than a bash script (default on Linux), which will both be DRASTICALY different from a csh script.
because you're posting on a linux forum, I'll assume you have access to bash.
Advanced Bash-Scripting Guide read this
and on unix run
man ps
man grep
man wc
and if that isn't enough, perl is installed on almost every unix I've ever worked with, it is the swiss army chainsaw of scripting. It is difficult to read other people's code 99% of the time, but once you learn perl, you can do almost anything.New to the internet, technical forums, or the hacker / open source community??
Read this to learn good posting habits http://www.catb.org/~esr/faqs/smart-questions.html
RHCE for RHEL version 5
RHCT for RHEL version 4


Reply With Quote