The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
option followed by : taking next option if argument missing with getopts gurukottur Shell Programming and Scripting 2 03-17-2008 09:46 AM
what is gcc -e option in C useless79 High Level Programming 3 12-05-2007 10:36 AM
su option lesstjm UNIX for Advanced & Expert Users 1 11-02-2005 10:54 AM
-h option Raom UNIX for Advanced & Expert Users 1 10-25-2005 10:19 PM
cut -f option 435 Gavea UNIX for Dummies Questions & Answers 1 11-10-2003 02:50 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 05-10-2007
Registered User
 

Join Date: Nov 2006
Posts: 17
Question ps with --sort option

Good morning,

Using command
Code:
root@slackware:~# ps -e -O sz --sort sz
part of the output is:
Code:
  PID    SZ S TTY          TIME COMMAND
 ...
   57   358 S ?        00:00:00 /usr/sbin/syslogd
   60   347 S ?        00:00:00 /usr/sbin/klogd -c 3 -x
  103   347 S ?        00:00:00 udevd
  119   353 S ?        00:00:01 /sbin/dhcpcd -d -t 60 eth0
  869     0 S ?        00:00:00 [khubd]
  894   354 S ?        00:00:00 /usr/sbin/inetd
  898   820 S ?        00:00:00 /usr/sbin/sshd
  909   395 S ?        00:00:00 /usr/sbin/crond -l10
  911   396 S ?        00:00:00 /usr/sbin/atd -b 15 -l 1
  914  1362 S ?        00:00:05 sendmail: accepting connections
  917  1270 S ?        00:00:00 sendmail: Queue runner@00:25:00 for /var/spool/c
...
No matter what is the --sort option, the output is sorted by PID.
How can I sort the list by the SZ column ?

Thank you in advance
Reply With Quote
Forum Sponsor
  #2  
Old 05-10-2007
Shell_Life's Avatar
Registered User
 

Join Date: Mar 2007
Location: Bahia, Brazil
Posts: 695
Jonas,
See if this would work for you:
Code:
ps -e -o "osz pid s tty time comm" | head -1
ps -e -o "osz pid s tty time comm" | tail +2 | sort -n
Reply With Quote
  #3  
Old 05-10-2007
Registered User
 

Join Date: Nov 2006
Posts: 17
Yes it works.

Thank you
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:11 AM.


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

Content Relevant URLs by vBSEO 3.2.0