The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
find and replace command in one line using one command vasikaran UNIX for Dummies Questions & Answers 10 08-20-2008 07:40 AM
how to? launch command with string of command line options TinCanFury Shell Programming and Scripting 5 04-28-2008 03:06 PM
Add line command felixwhoals UNIX for Dummies Questions & Answers 3 12-16-2007 08:12 PM
how to tell which OS via command line hankooknara UNIX for Dummies Questions & Answers 4 05-15-2007 08:39 PM
How do I get ssh to run a command in one line? LordJezo Shell Programming and Scripting 2 07-01-2004 08:54 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #8 (permalink)  
Old 07-13-2004
Registered User
 

Join Date: May 2004
Posts: 66
Stumble this Post!
Thank you guys! you're all best!
Reply With Quote
Forum Sponsor
  #9 (permalink)  
Old 07-14-2004
Registered User
 

Join Date: May 2004
Posts: 66
Stumble this Post!
Quote:
Originally posted by Perderabo
On Linux, the g is legal and says to keep process group leaders. And yes the command is legal without a minus sign. On SunOS, I get an error message. It kinda works on HP-UX, but only because "ps xyzzy" works too.
i'm trying to make this script to work on both Linux and SunOS, is there a different command that i could use in place of ps that would do the same thing? Like you said SunOS won't allow ps gu...
Reply With Quote
  #10 (permalink)  
Old 07-14-2004
Registered User
 

Join Date: Jul 2004
Location: New York State
Posts: 65
Stumble this Post!
The command "ps -ef" says to return extended information information on ALL processes. This sould work on any flavor of unix
Reply With Quote
  #11 (permalink)  
Old 07-14-2004
Registered User
 

Join Date: May 2004
Posts: 66
Stumble this Post!
Quote:
Originally posted by beilstwh
The command "ps -ef" says to return extended information information on ALL processes. This sould work on any flavor of unix
Thanks for your reply, but "ps -ef" does not give me %CPU, Start time, State....etc or the process.
Reply With Quote
  #12 (permalink)  
Old 07-14-2004
Registered User
 

Join Date: Jul 2004
Location: New York State
Posts: 65
Stumble this Post!
Try this one on your system.

ps -e -o user,pid,ppid,pcpu,stime,etime,time,comm
Reply With Quote
  #13 (permalink)  
Old 07-14-2004
Registered User
 

Join Date: May 2004
Posts: 66
Stumble this Post!
Quote:
Originally posted by beilstwh
Try this one on your system.

ps -e -o user,pid,ppid,pcpu,stime,etime,time,comm
when i pipe this command to grep for a $user, the header get cut off. how do i fix that?

Code:
ps -e -opid= -opcpu= -oc= -oargs=|grep "${user}"
This command does the same thing, the head gets cut off. without the grep for user then the head displays...
Reply With Quote
  #14 (permalink)  
Old 07-14-2004
Registered User
 

Join Date: Jul 2004
Location: New York State
Posts: 65
Stumble this Post!
Try

ps -e -o pid,pcpu,comm|head -n1;ps -e -o pid,pcpu,comm|tail +2|grep "${user}"
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:19 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0