[BusyBox] suggestions for "ps"

Robert Urban urban at UNIX-Beratung.de
Tue Jul 5 22:14:58 UTC 2005


Hello,

First of all, thanks very much for doing something tremendously useful!

I haven't been paying attention for a while, so maybe these suggestions
are superfluous.

I'm using

	BusyBox v0.60.5 (2004.06.13-19:39+0000) multi-call binary

for an embedded router/firewall project.

currently the output of ps looks like this:
[root at router init.d]# ps ax
  PID TTY     Uid        Size State Command
    1         root        748   S   init       
   71         root        584   S   /sbin/syslog-ng 
   75         root        428   S   /usr/sbin/acpid 
   87         root       1184   S   /bin/bash /bin/healthd 
   92         root       1724   S   /usr/sbin/sshd 
  101         root        444   S   /usr/sbin/crond 
  110         root       1200   S   /bin/sh /usr/sbin/adsl-connect 
  121         root       1380   S   /usr/sbin/dhcpd 
  126 tty2    root        528   S   /sbin/getty 38400 tty2 
  127 ttyS0   root        524   S   /sbin/getty -L ttyS0 9600 vt100 
  128 tty3    root        436   S   /usr/bin/tail -f /var/log/messages 
  217         nobody      828   S   /usr/sbin/pdnsd -d -s -p /var/run/pdnsd.pid
20715 tty1    root       1276   S   -sh 
20841         root        752   S   /usr/sbin/pppd pty /usr/sbin/pppoe -p /var/
20842         root        432   S   /usr/sbin/pppoe -p /var/run/pppoe.conf-adsl
20869         root       1864   S   /bin/ntpd -p /var/run/ntpd.pid 

as you can see, sometimes there's a TTY, sometimes not.  This makes
it hard to write scripts that need to grab a particular column,
for example "Command".   It would see useful to put a place-holder,
"-" suggests itself, in the TTY column when there is no TTY.

Also, another useful feature to make scripting easier would be an
option to display only the executable-name portion of the "Command",
rather than the whole command.  This would make it much easier to
determine if a program was running:  instead of having to

	ps | grep proggy | grep -v grep

a simple

	ps --no-long-arg-list | grep proggy

would do it.

thanks again,

Robert Urban




More information about the busybox mailing list