[R] Output from unix PS
mohan.radhakrishnan at polarisft.com
mohan.radhakrishnan at polarisft.com
Fri Aug 16 15:38:15 CEST 2013
This is the output.
> str(data)
'data.frame': 78 obs. of 1 variable:
$
USER.......PID..CPU..MEM....VSZ...RSS.TTY......STAT.START...TIME.COMMAND:
Factor w/ 78 levels "68 4504 0.0 0.0 31680 4596 ? Ss
Aug08 0:01 hald",..: 17 18 19 20 21 22 23 24 25 26 ...
> dput(head(data,20))
structure(list
(USER.......PID..CPU..MEM....VSZ...RSS.TTY......STAT.START...TIME.COMMAND =
structure(c(17L,
18L, 19L, 20L, 21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 15L, 29L,
30L, 31L, 32L, 33L, 1L, 34L), .Label = c("68 4504 0.0 0.0 31680
4596 ? Ss Aug08 0:01 hald",
"68 4513 0.0 0.0 12348 872 ? S Aug08 0:00
hald-addon-acpi: listening on acpid socket /var/run/acpid.socket",
"68 4517 0.0 0.0 12348 864 ? S Aug08 0:00
hald-addon-keyboard: listening on /dev/input/event1",
"68 4521 0.0 0.0 12348 860 ? S Aug08 0:00
hald-addon-keyboard: listening on /dev/input/event0",
"apache 17344 0.0 0.0 174440 2372 ? S Aug11
0:00 /usr/sbin/httpd",
"apache 17345 0.0 0.0 174440 2372 ? S Aug11
0:00 /usr/sbin/httpd",
"apache 17346 0.0 0.0 174440 2372 ? S Aug11
0:00 /usr/sbin/httpd",
"apache 17347 0.0 0.0 174440 2372 ? S Aug11
0:00 /usr/sbin/httpd",
"apache 17348 0.0 0.0 174440 2372 ? S Aug11
0:00 /usr/sbin/httpd",
"apache 17349 0.0 0.0 174440 2372 ? S Aug11
0:00 /usr/sbin/httpd",
"apache 17350 0.0 0.0 174440 2372 ? S Aug11
0:00 /usr/sbin/httpd",
"apache 17351 0.0 0.0 174440 2372 ? S Aug11
0:00 /usr/sbin/httpd",
"avahi 4830 0.0 0.0 23296 1316 ? Ss Aug08 0:00
avahi-daemon: running [DCS-PRO-POL-APP2.local]",
"avahi 4831 0.0 0.0 23172 340 ? Ss Aug08 0:00
avahi-daemon: chroot helper",
"dbus 4361 0.0 0.0 21380 1004 ? Ss Aug08 0:00
dbus-daemon --system",
"gdm 5030 0.0 0.2 222128 17436 ? Ss Aug08
0:00 /usr/libexec/gdmgreeter",
"root 4292 0.0 0.0 0 0 ? S< Aug08 0:00
[rpciod/6]",
"root 4293 0.0 0.0 0 0 ? S< Aug08 0:00
[rpciod/7]",
"root 4294 0.0 0.0 0 0 ? S< Aug08 0:00
[rpciod/8]",
"root 4295 0.0 0.0 0 0 ? S< Aug08 0:00
[rpciod/9]",
"root 4296 0.0 0.0 0 0 ? S< Aug08 0:00
[rpciod/10]",
"root 4297 0.0 0.0 0 0 ? S< Aug08 0:00
[rpciod/11]",
"root 4298 0.0 0.0 0 0 ? S< Aug08 0:00
[rpciod/12]",
"root 4299 0.0 0.0 0 0 ? S< Aug08 0:00
[rpciod/13]",
"root 4300 0.0 0.0 0 0 ? S< Aug08 0:00
[rpciod/14]",
"root 4301 0.0 0.0 0 0 ? S< Aug08 0:00
[rpciod/15]",
"root 4322 0.0 0.0 10184 804 ? Ss Aug08 0:00
rpc.statd",
"root 4346 0.0 0.0 55204 764 ? Ss Aug08 0:00
rpc.idmapd",
"root 4376 0.0 0.0 10456 788 ? Ss Aug08
0:00 /usr/sbin/hcid",
"root 4382 0.0 0.0 5960 544 ? Ss Aug08
0:00 /usr/sbin/sdpd",
"root 4448 0.0 0.0 0 0 ? S< Aug08 0:00
[krfcommd]",
"root 4485 0.0 0.0 31440 1412 ? Ssl Aug08 0:00 pcscd",
"root 4495 0.0 0.0 3824 568 ? Ss Aug08
0:00 /usr/sbin/acpid",
"root 4505 0.0 0.0 21720 1060 ? S Aug08 0:00
hald-runner",
"root 4529 0.0 0.0 10256 704 ? S Aug08 1:57
hald-addon-storage: polling /dev/sr0",
"root 4565 0.0 0.0 8540 488 ? Ss Aug08
0:00 /usr/bin/hidd --server",
"root 4608 0.0 0.0 54424 1520 ? Ssl Aug08 0:00
automount",
"root 4625 0.0 0.0 26348 520 ? Ss Aug08 0:00 ./hpiod",
"root 4630 0.0 0.0 154892 6428 ? S Aug08
0:00 /usr/bin/python ./hpssd.py",
"root 4643 0.0 0.0 62652 1208 ? Ss Aug08
0:00 /usr/sbin/sshd",
"root 4652 0.0 0.0 133456 2740 ? Ss Aug08 0:00 cupsd",
"root 4666 0.0 0.0 21668 896 ? Ss Aug08 0:00 xinetd
-stayalive -pidfile /var/run/xinetd.pid",
"root 4684 0.0 0.0 66968 2320 ? Ss Aug08 0:00 sendmail:
accepting connections",
"root 4702 0.0 0.0 6480 376 ? Ss Aug08 0:00 gpm
-m /dev/input/mice -t exps2",
"root 4712 0.0 0.0 174440 3800 ? Ss Aug08
0:00 /usr/sbin/httpd",
"root 4767 0.0 0.0 135536 2800 ? Ss Aug08 0:00 smbd -D",
"root 4770 0.0 0.0 107776 1544 ? Ss Aug08 0:00 nmbd -D",
"root 4777 0.0 0.0 135536 1400 ? S Aug08 0:00 smbd -D",
"root 4788 0.0 0.0 18756 448 ? Ss Aug08
0:00 /usr/sbin/atd",
"root 4892 0.0 0.0 18440 480 ? S Aug08
0:00 /usr/sbin/smartd -q never",
"root 4897 0.0 0.0 3816 488 tty1 Ss+ Aug08
0:00 /sbin/mingetty tty1",
"root 4898 0.0 0.0 3816 484 tty2 Ss+ Aug08
0:00 /sbin/mingetty tty2",
"root 4899 0.0 0.0 3816 488 tty3 Ss+ Aug08
0:00 /sbin/mingetty tty3",
"root 4900 0.0 0.0 3816 488 tty4 Ss+ Aug08
0:00 /sbin/mingetty tty4",
"root 4902 0.0 0.0 3816 484 tty5 Ss+ Aug08
0:00 /sbin/mingetty tty5",
"root 4903 0.0 0.0 3816 488 tty6 Ss+ Aug08
0:00 /sbin/mingetty tty6",
"root 4906 0.0 0.0 167660 2608 ? Ss Aug08
0:00 /usr/sbin/gdm-binary -nodaemon",
"root 5001 0.0 0.0 194772 2356 ? S Aug08
0:00 /usr/sbin/gdm-binary -nodaemon",
"root 5003 0.0 0.0 255436 4132 ? Sl Aug08
0:00 /usr/libexec/gdm-rh-security-token-helper",
"root 5004 0.0 0.0 83896 6024 tty7 Ss+ Aug08
0:02 /usr/bin/Xorg :0 -br -audit 0 -auth /var/gdm/:0.Xauth -nolisten tcp
vt7",
"root 5017 0.0 0.1 256812 15804 ? SN Aug08
0:00 /usr/bin/python -tt /usr/sbin/yum-updatesd",
"root 5019 0.0 0.0 12940 1184 ? SN Aug08
0:00 /usr/libexec/gam_server",
"root 10358 0.0 0.0 63888 1204 ? S Aug12 0:00
sh /app/rdbapp/Jboss-4.0.3-Node1/bin/run.sh -c node2 -b 172.20.100.3",
"root 10396 2.0 19.2 2757996 1571000 ? Sl Aug12 39:10 java
-server -Xms1280m -Xmx1280m -XX:MaxPermSize=768m
-Djava.endorsed.dirs=/app/rdbapp/Jboss-4.0.3-Node",
"root 11041 0.0 0.0 74860 1152 ? Ss Aug09 0:00 crond",
"root 11119 0.0 0.0 90152 3436 ? Ss Aug12 0:00 sshd:
root at pts/2",
"root 11121 0.0 0.0 66228 1736 pts/2 Ss+ Aug12 0:00 -bash",
"root 18898 0.0 0.0 90152 3420 ? Ss 09:00 0:01 sshd:
root at pts/1",
"root 18902 0.0 0.0 66224 1640 pts/1 Ss+ 09:00 0:00 -bash",
"root 21046 0.0 0.0 90152 3444 ? Ss 12:22 0:02 sshd:
root at pts/3",
"root 21048 0.0 0.0 66240 1736 pts/3 Ss 12:22 0:00 -bash",
"root 25929 0.0 0.0 0 0 ? S 16:56 0:00
[pdflush]",
"root 25936 0.0 0.0 0 0 ? S 16:57 0:00
[pdflush]",
"root 25949 0.1 0.0 91320 4628 ? Ss 17:00 0:04 sshd:
root at notty",
"root 25951 0.0 0.0 54040 2192 ? Ss 17:00
0:00 /usr/libexec/openssh/sftp-server",
"root 26312 0.0 0.0 65892 1240 pts/3 R+ 17:48 0:00 ps aux
--sort pmem",
"smmsp 4692 0.0 0.0 57716 1768 ? Ss Aug08 0:00 sendmail:
Queue runner at 01:00:00 for /var/spool/clientmqueue",
"xfs 4758 0.0 0.0 20984 1792 ? Ss Aug08 0:00 xfs
-droppriv -daemon"
), class = "factor")), .Names =
"USER.......PID..CPU..MEM....VSZ...RSS.TTY......STAT.START...TIME.COMMAND",
row.names = c(NA,
20L), class = "data.frame")
>
Re: [R] Output from unix PS
Sarah Goslee
to:
mohan.radhakrishnan
16-08-2013 06:44 PM
Cc:
r-help
What does str(yourdata) return?
How about including
dput(head(yourdata, 20)) in your email to create a reproducible example?
Sarah
On Fri, Aug 16, 2013 at 9:08 AM, <mohan.radhakrishnan at polarisft.com>
wrote:
> My code is not complete. But the headers I see are
>
> USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
> 68 4517 0.0 0.0 12348 864 ? S Aug08 0:00
> hald-addon-keyboard: listening on /dev/input/event1
> 68 4521 0.0 0.0 12348 860 ? S Aug08 0:00
> hald-addon-keyboard: listening on /dev/input/event0
> root 4529 0.0 0.0 10256 704 ? S Aug08 1:57
> hald-addon-storage: polling /dev/sr0
>
> The last column value doesn't follow any rule.
>
> Thanks,
> Mohan
>
>
>
>
>
> Re: [R] Output from unix PS
>
>
> Sarah Goslee
> to:
> mohan.radhakrishnan
> 16-08-2013 06:01
PM
>
>
> You don't tell us your OS details or provide an actual reproducible
> example, but the error suggests that COMMAND is not one of the column
> names in your data frame.
>
> Have you checked that? When I run ps on my Fedora system, the column
> name is CMD and not COMMAND.
>
> Sarah
>
> On Fri, Aug 16, 2013 at 7:30 AM, <mohan.radhakrishnan at polarisft.com>
> wrote:
>> Hi,
>>
>> When I view this output from the unix command ''ps'' the columns seem to
>> properly aligned but it is not read properly into the data frame. The
>> aggregate function throws
>>
>> Error in aggregate.data.frame(data, by = list(COMMAND), FUN = sum) :
>> object 'COMMAND' not found
>>
>> Is there a recomendation to massage this ?
>>
>> data = read.table("D:\\p..txt",sep="\t")
>>
>> agg<-aggregate(data,by=list(COMMAND),FUN=sum)
>>
>> 68 4524 0.0 0.0 12348 872 ? S Aug09 0:00
>> hald-addon-acpi: listening on acpid socket /var/run/acpid.socket
>> 68 4528 0.0 0.0 12348 860 ? S Aug09 0:00
>> hald-addon-keyboard: listening on /dev/input/event1
>> 68 4532 0.0 0.0 12348 864 ? S Aug09 0:00
>> hald-addon-keyboard: listening on /dev/input/event0
>> root 4540 0.0 0.0 10256 704 ? S Aug09 1:02
>> hald-addon-storage: polling /dev/sr0
>> root 4576 0.0 0.0 8540 492 ? Ss Aug09
>> 0:00 /usr/bin/hidd --server
>> root 4619 0.0 0.0 122008 1540 ? Ssl Aug09 0:00
> automount
>> root 4636 0.0 0.0 26348 524 ? Ss Aug09 0:00 ./hpiod
>> root 4641 0.0 0.0 154876 6428 ? S Aug09
>> 0:00 /usr/bin/python ./hpssd.py
>> root 4654 0.0 0.0 63544 1212 ? Ss Aug09
>> 0:00 /usr/sbin/sshd
>> root 4663 0.0 0.0 134208 2744 ? Ss Aug09 0:00 cupsd
>> root 4677 0.0 0.0 21668 896 ? Ss Aug09 0:00 xinetd
>> -stayalive -pidfile /var/run/xinetd.pid
>> root 4695 0.0 0.0 66968 2324 ? Ss Aug09 0:00
> sendmail:
>> accepting connections
>> smmsp 4703 0.0 0.0 57716 1760 ? Ss Aug09 0:00
> sendmail:
>> Queue runner at 01:00:00 for /var/spool/clientmqueue
>> root 4713 0.0 0.0 6480 372 ? Ss Aug09 0:00 gpm
>> -m /dev/input/mice -t exps2
>>
>> Thanks.
>>
>>
>>
> --
> Sarah Goslee
> http://www.functionaldiversity.org
>
>
This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited.
Visit us at http://www.polarisFT.com
More information about the R-help
mailing list