This also used to come with a program called irun, but it was really just a 'psall | head -1; psall | grep $USER'. :)
#!/usr/bin/perl use Term::Size; $psl=`ps auxfw`; @psla=split("\n", $psl); ($width, undef) = Term::Size::chars; $Iam=getpwuid($<); foreach $l (@psla) { %clen = ( "user" => 8, "pid" => 5, "pcpu" => 4, "pmem" => 4, "size" => 5, "rss" => 5, "tty" => 5, "stat" => 3, "start" => 6, "time" => 5, ); %proc = ( "user" => substr($l, 0, $clen{"user"} ), "pid" => substr($l, 9, $clen{"pid"} ), "pcpu" => substr($l, 15, $clen{"pcpu"} ), "pmem" => substr($l, 20, $clen{"pmem"} ), "size" => substr($l, 25, $clen{"size"} ), "rss" => substr($l, 31, $clen{"rss"} ), "tty" => substr($l, 36, $clen{"tty"} ), "stat" => substr($l, 41, $clen{"stat"} ), "start" => substr($l, 45, $clen{"start"} ), "time" => substr($l, 53, $clen{"time"} ), "cmd" => substr($l, 63 ) ); $_ = $proc{"user"}; if ( /root/ ) { $usercolor = "^[[0;31m"; } elsif ( /$Iam/ ) { $usercolor = "^[[0;34m"; } else { $usercolor = "^[[0;36m"; } @out = ( $usercolor, $proc{"user"}, "^[[0;33m", $proc{"tty"}, " ", "^[[1;30m", $proc{"pid" }, " ", "^[[0;37m", $proc{"pcpu"}, " ", "^[[1;37m", $proc{"pmem"}, " ", "^[[1m", $proc{"cmd" } ); $out = substr join("",@out), 0, ($width+(7*6)-3); print $out, "\n"; } #USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND #012345678901234567890123456789012345678901234567890123456789012345678 +90123456 # 1 . . 2 . .3 . .4 . 5 . 6 + 7
#shandor 986 0.0 0.0 1752 0 pts/0 SW 16:54 0:00 \_ [bash]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: psall (color ps)
by qi3ber (Scribe) on Jul 26, 2000 at 19:50 UTC | |
|
RE: psall (color ps)
by turnstep (Parson) on Jul 26, 2000 at 18:37 UTC |