Determine and interact with running processes

por | 22 agosto, 2008

### ps ###


1. ps, ps -ef (includes all processes)
2. pgrep – searches process list for matching programms
3. pkill – searches process list for matching programs and kills them

4. pwdx 1064 what directory is running a process
5. prstat ( like top in linux )
6. prtdiag – display system diagnostic information

Currently running:

1. ps


[ssybl0:~]$ ps
PID TTY TIME CMD
1030 pts/2 0:00 bash
1034 pts/2 0:00 ps

All the programs
2. ps -ef


[ssybl0:~]$ ps -ef
UID PID PPID C STIME TTY TIME CMD
root 0 0 0 19:19:06 ? 0:20 sched
root 1 0 0 19:19:08 ? 0:00 /sbin/init
root 2 0 0 19:19:08 ? 0:00 pageout
root 3 0 0 19:19:08 ? 1:06 fsflush
daemon 310 1 0 19:19:32 ? 0:00 /usr/sbin/rpcbind
root 7 1 0 19:19:09 ? 0:08 /lib/svc/bin/svc.startd
root 9 1 0 19:19:09 ? 0:29 /lib/svc/bin/svc.configd
root 335 1 0 19:19:34 ? 0:02 /usr/lib/inet/inetd start
daemon 315 1 0 19:19:32 ? 0:00 /usr/lib/nfs/statd
carlosap 968 965 0 20:07:00 ? 0:00 /usr/lib/ssh/sshd
root 366 364 0 19:19:34 ? 0:00 /usr/sadm/lib/smc/bin/smcboot
root 118 1 0 19:19:23 ? 0:00 /usr/lib/ldoms/drd
smmsp 542 1 0 19:19:41 ? 0:00 /usr/lib/sendmail -Ac -q15m
root 364 1 0 19:19:34 ? 0:00 /usr/sadm/lib/smc/bin/smcboot
daemon 316 1 0 19:19:32 ? 0:00 /usr/lib/nfs/nfs4cbd
daemon 117 1 0 19:19:23 ? 0:01 /usr/lib/crypto/kcfd
root 356 342 0 19:19:34 ? 0:00 /usr/lib/saf/ttymon
root 370 7 0 19:19:34 console 0:00 /usr/lib/saf/ttymon -g -d /dev/console -l console -m ldterm,ttcompat -h -p ssyb
daemon 321 1 0 19:19:33 ? 0:00 /usr/lib/nfs/lockd
root 159 1 0 19:19:23 ? 0:01 /usr/sbin/nscd
root 228 1 0 19:19:25 ? 0:00 /usr/sbin/cron
root 358 1 0 19:19:34 ? 0:00 /usr/lib/utmpd
root 157 1 0 19:19:23 ? 0:00 /usr/lib/sysevent/syseventd
root 170 1 0 19:19:24 ? 0:01 /usr/lib/picl/picld
daemon 317 1 0 19:19:32 ? 0:00 /usr/lib/nfs/nfsmapid
root 365 364 0 19:19:34 ? 0:00 /usr/sadm/lib/smc/bin/smcboot
root 220 1 0 19:19:25 ? 0:00 /usr/lib/efcode/sparcv9/efdaemon
root 342 7 0 19:19:34 ? 0:00 /usr/lib/saf/sac -t 300
carlosap 1030 1028 0 21:05:53 pts/2 0:00 -bash
root 453 1 0 19:19:40 ? 0:00 /usr/sbin/vold -f /etc/vold.conf
root 482 1 0 19:19:41 ? 0:00 /usr/sbin/syslogd
root 444 1 0 19:19:40 ? 0:00 /usr/lib/autofs/automountd
root 445 444 0 19:19:40 ? 0:00 /usr/lib/autofs/automountd
noaccess 837 1 0 19:19:55 ? 1:38 /opt/se6000/java_1.5.0/usr/java/bin/java -server -Xms64m -Xmx512m -XX:+Backgrou
root 562 1 0 19:19:42 ? 0:00 /usr/lib/snmp/snmpdx -y -c /etc/snmp/conf
root 540 1 0 19:19:41 ? 0:00 /usr/lib/sendmail -bd -q15m
root 559 1 0 19:19:42 ? 0:00 /usr/sfw/sbin/snmpd
root 502 1 0 19:19:41 ? 0:05 /opt/SUNWsefms/sbin/./wrapper-solaris-sparc-32 /opt/SUNWsefms/sbin/../System/wr
root 965 523 0 20:06:57 ? 0:00 /usr/lib/ssh/sshd
root 523 1 0 19:19:41 ? 0:00 /usr/lib/ssh/sshd
carlosap 1042 1030 0 21:31:18 pts/2 0:00 ps -ef
root 532 502 0 19:19:41 ? 1:13 /opt/se6000/java_1.5.0/usr/java//bin/java -DSUNWsefms=../ -Xms8m -Xmx128m -Djav
carlosap 1028 1025 0 21:05:53 ? 0:00 /usr/lib/ssh/sshd
root 548 1 0 19:19:41 ? 0:04 /usr/lib/fm/fmd/fmd
root 580 1 0 19:19:42 ? 0:00 /usr/lib/dmi/dmispd
root 584 1 0 19:19:42 ? 0:00 /usr/lib/dmi/snmpXdmid -s ssybl0.ssy.gob.mx
root 620 1 0 19:19:45 ? 0:06 /opt/SMgr/agent/jre/bin/java -classpath /opt/SMgr/agent/SMagent.jar devmgr.laun
root 1025 523 0 21:05:50 ? 0:00 /usr/lib/ssh/sshd
root 975 970 0 20:09:55 pts/1 0:00 -bash
carlosap 970 968 0 20:07:00 pts/1 0:00 -bash
root 666 1 0 19:19:46 ? 0:00 /usr/dt/bin/dtlogin -daemon

Search all instances of sshd
pgrep sshd the same effect like ps -ef |grep sshd


[ssybl0:~]# pgrep sshd
968
965
523
1028
1025


[ssybl0:~/docs]$ prtdiag
System Configuration: Sun Microsystems sun4v Sun Blade T6300 Server Module
Memory size: 3968 Megabytes

================================ Virtual CPUs ================================

CPU ID Frequency Implementation Status
------ --------- ---------------------- -------
0 1000 MHz SUNW,UltraSPARC-T1 on-line
1 1000 MHz SUNW,UltraSPARC-T1 on-line
2 1000 MHz SUNW,UltraSPARC-T1 on-line
3 1000 MHz SUNW,UltraSPARC-T1 on-line
4 1000 MHz SUNW,UltraSPARC-T1 on-line
5 1000 MHz SUNW,UltraSPARC-T1 on-line
6 1000 MHz SUNW,UltraSPARC-T1 on-line
7 1000 MHz SUNW,UltraSPARC-T1 on-line
8 1000 MHz SUNW,UltraSPARC-T1 on-line
9 1000 MHz SUNW,UltraSPARC-T1 on-line
10 1000 MHz SUNW,UltraSPARC-T1 on-line
11 1000 MHz SUNW,UltraSPARC-T1 on-line
12 1000 MHz SUNW,UltraSPARC-T1 on-line
13 1000 MHz SUNW,UltraSPARC-T1 on-line
14 1000 MHz SUNW,UltraSPARC-T1 on-line
15 1000 MHz SUNW,UltraSPARC-T1 on-line
16 1000 MHz SUNW,UltraSPARC-T1 on-line
17 1000 MHz SUNW,UltraSPARC-T1 on-line
18 1000 MHz SUNW,UltraSPARC-T1 on-line
19 1000 MHz SUNW,UltraSPARC-T1 on-line
20 1000 MHz SUNW,UltraSPARC-T1 on-line
21 1000 MHz SUNW,UltraSPARC-T1 on-line
22 1000 MHz SUNW,UltraSPARC-T1 on-line
23 1000 MHz SUNW,UltraSPARC-T1 on-line

======================= Physical Memory Configuration ========================
Segment Table:
--------------------------------------------------------------
Base Segment Interleave Bank Contains
Address Size Factor Size Modules
--------------------------------------------------------------
0x0 4 GB 4 2 GB MB/CMP0/CH0/R0/D0
MB/CMP0/CH0/R0/D1
2 GB MB/CMP0/CH3/R0/D0
MB/CMP0/CH3/R0/D1

========================= IO Configuration =========================

IO
Location Type Slot Path Name Model
----------- ----- ---- --------------------------------------------- ------------------------- ---------
MB/NET0 PCIE MB /pci@780/pci@0/pci@1/network@0 network-pciex8086,105e
MB/NET1 PCIE MB /pci@780/pci@0/pci@1/network@0,1 network-pciex8086,105e
MB/PCI-EM0 PCIE 0 /pci@780/pci@0/pci@9/SUNW,emlxs@0 SUNW,emlxs-pci10df,fc20 LPem11002+
MB/PCI-EM0 PCIE 0 /pci@780/pci@0/pci@9/SUNW,emlxs@0,1 SUNW,emlxs-pci10df,fc20 LPem11002+
MB/USB0 PCIE MB /pci@7c0/pci@0/pci@1/pci@0/usb@0 usb-pciclass,0c0310
MB/USB1 PCIE MB /pci@7c0/pci@0/pci@1/pci@0/usb@0,1 usb-pciclass,0c0310
MB/USB2 PCIE MB /pci@7c0/pci@0/pci@1/pci@0/usb@0,2 usb-pciclass,0c0320
MB/SAS-SATA PCIE MB /pci@7c0/pci@0/pci@2/scsi@0 scsi-pciex1000,58 LSI,1068E

============================ Environmental Status ============================
Fan sensors:
All fan sensors are OK.

Temperature sensors:
All temperature sensors are OK.

Current sensors:
All current sensors are OK.

Voltage sensors:
All voltage sensors are OK.

============================ FRU Status ============================
All FRUs are enabled.


…. NEXt PACKAGE MGMT ……