ps -e -opid,vsz,rss,osz,args
find and grep in one command line.
find . -print |xargs grep -i sh
Print the rest of the line
awk '{print $1 "," $2 "," $3 "," $4 "," substr($0, index($0,$5))}' ps.txt > parsed.csv
Network Trouble-shooting
User complain application is to slowFind which process is using certain port number
# ps -ef| awk '{print $2}'| xargs -I '{}' sh -c 'echo examining process {}; pfiles {}| grep 7777'
# netstat -na |grep 7777
17.15.210.9.7777 137.15.191.92.33774 350720 0 49256 0 FIN_WAIT_2
17.15.210.9.7777 137.15.191.92.33780 525568 0 49256 0 FIN_WAIT_2
17.15.210.9.7777 137.15.191.92.33783 65024 0 49256 0 TIME_WAIT
17.15.210.9.7777 137.15.191.92.33784 65024 0 49256 0 TIME_WAIT
17.15.210.9.33507 137.15.210.9.7777 49152 0 49152 0 TIME_WAIT
127.0.0.1.33511 127.0.0.1.7777 49243 0 49152 0 TIME_WAIT
17.15.210.9.7777 137.15.191.92.32776 65024 0 49256 0 FIN_WAIT_2
17.15.210.9.7777 137.15.191.92.32777 36736 0 49256 0 ESTABLISHED
*.7777 *.* 0 0 49152 0 LISTEN
# ndd -get /dev/tcp tcp_time_wait_interval
# ndd -set /dev/tcp tcp_time_wait_interval 30000
Check Memory Allocated between Kernel and Users
# echo "::memstat" |mdb -kPage Summary Pages MB %Tot
------------ ---------------- ---------------- ----
Kernel 751429 5870 9%
ZFS File Data 176922 1382 2%
Anon 3034600 23707 36%
Exec and libs 40147 313 0%
Page cache 645848 5045 8%
Free (cachelist) 3563927 27843 42%
Free (freelist) 175735 1372 2%
Total 8388608 65536
ipcs - report inter-process communication facilities status
# ipcs -aIPC status from <running system> as of Thursday, March 27, 2014 08:26:37 AM EDT
T ID KEY MODE OWNER GROUP CREATOR CGROUP CBYTES QNUM QBYTES LSPID LRPID STIME RTIME CTIME
Message Queues:
T ID KEY MODE OWNER GROUP CREATOR CGROUP NATTCH SEGSZ CPID LPID ATIME DTIME CTIME
Shared Memory:
m 2046820368 0xe40fca34 --rw-r----- oracle dba oracle dba 30 8192 12929 9289 8:25:38 8:25:38 15:04:47
m 2046820367 0x0 --rw-r----- oracle dba oracle dba 30 1593835520 12929 9289 8:25:38 8:25:38 15:04:47
m 2046820366 0x0 --rw-r----- oracle dba oracle dba 30 16777216 12929 9289 8:25:38 8:25:38 15:04:47
m 637534211 0x431e738c --rw-r----- oracle dba oracle dba 30 8192 16241 9172 8:22:03 8:22:03 9:35:20
m 620757119 0x0 --rw-r----- oracle dba oracle dba 30 1593835520 16241 9172 8:22:03 8:22:03 9:35:00
m 620757118 0x0 --rw-r----- oracle dba oracle dba 30 16777216 16241 9172 8:22:03 8:22:03 9:35:00
m 21 0xbeb8757c --rw-r----- oracle dba oracle dba 22 8192 5053 8414 8:00:03 8:00:03 9:51:04
m 20 0x0 --rw-r----- oracle dba oracle dba 22 637534208 5053 8414 8:00:03 8:00:03 9:51:04
m 19 0x0 --rw-r----- oracle dba oracle dba 22 637534208 5053 8414 8:00:03 8:00:03 9:51:04
m 18 0x0 --rw-r----- oracle dba oracle dba 22 352321536 5053 8414 8:00:03 8:00:03 9:51:04
m 6 0x16494d40 --rw-r----- oracle dba oracle dba 47 8192 4456 9268 8:25:01 8:25:01 9:48:18
m 5 0x0 --rw-r----- oracle dba oracle dba 47 1593835520 4456 9268 8:25:01 8:25:01 9:48:17
m 4 0x0 --rw-r----- oracle dba oracle dba 47 16777216 4456 9268 8:25:01 8:25:01 9:48:17
m 2 0x1afdc6c0 --rw-r----- oracle dba oracle dba 31 8192 4363 9308 8:26:29 8:26:29 9:47:01
m 1 0x0 --rw-r----- oracle dba oracle dba 31 1593835520 4363 9308 8:26:29 8:26:29 9:47:00
m 0 0x0 --rw-r----- oracle dba oracle dba 31 16777216 4363 9308 8:26:29 8:26:29 9:47:00
T ID KEY MODE OWNER GROUP CREATOR CGROUP NSEMS OTIME CTIME
Semaphores:
s 84 0xd6077268 --ra-r----- oracle dba oracle dba 154 8:26:32 15:04:47
s 46 0x97c29ec --ra-r----- oracle dba oracle dba 154 8:26:34 9:35:20
s 12 0x913ec9ac --ra-r----- oracle dba oracle dba 154 8:26:36 9:51:04
s 8 0x408bd0e4 --ra-r----- oracle dba oracle dba 154 8:26:36 9:48:18
s 4 0x31ebae14 --ra-r----- oracle dba oracle dba 154 8:26:29 9:47:01
s 0 0x7c4d --ra-ra-ra- root root root root 1 3:08:20 15:00:37
User Memory Usage
# prstat -s size# prstat -s rss
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
12953 oracle 1785M 1762M sleep 59 0 0:02:16 0.0% oracle/258
4384 oracle 1789M 1761M sleep 59 0 0:20:29 0.0% oracle/258
12955 oracle 1784M 1759M sleep 59 0 0:02:15 0.0% oracle/258
4477 oracle 1786M 1758M sleep 59 0 0:20:58 0.0% oracle/258
4386 oracle 1789M 1757M sleep 59 0 0:19:50 0.0% oracle/258
4479 oracle 1787M 1756M sleep 59 0 0:20:40 0.0% oracle/258
13030 oracle 1779M 1752M sleep 59 0 0:00:06 0.0% oracle/1
4553 oracle 1778M 1752M sleep 59 0 0:00:57 0.0% oracle/1
12967 oracle 1774M 1751M sleep 59 0 0:08:56 0.0% oracle/1
12963 oracle 1774M 1751M sleep 59 0 0:00:06 0.0% oracle/1
12969 oracle 1774M 1751M sleep 59 0 0:00:07 0.0% oracle/1
12943 oracle 1774M 1751M sleep 59 0 0:00:20 0.0% oracle/1
12994 oracle 1774M 1751M sleep 59 0 0:00:09 0.0% oracle/1
12937 oracle 1774M 1751M sleep 59 0 0:01:19 0.0% oracle/1
12971 oracle 1774M 1751M sleep 59 0 0:00:07 0.0% oracle/1
16288 oracle 1784M 1751M sleep 59 0 0:09:49 0.0% oracle/258
16286 oracle 1784M 1750M sleep 59 0 0:09:59 0.0% oracle/258
13032 oracle 1774M 1750M sleep 59 0 0:00:10 0.0% oracle/1
12949 oracle 1774M 1750M sleep 59 0 0:08:57 0.0% oracle/1
21326 oracle 1784M 1750M sleep 60 0 0:11:04 0.0% oracle/13
13189 oracle 1774M 1750M sleep 59 0 0:00:26 0.0% oracle/1
4450 oracle 1779M 1749M sleep 59 0 0:00:50 0.0% oracle/1
12945 oracle 1774M 1749M sleep 59 0 0:00:28 0.0% oracle/1
4448 oracle 1775M 1749M sleep 59 0 0:01:26 0.0% oracle/1
4398 oracle 1774M 1749M sleep 59 0 1:13:48 0.0% oracle/1
4551 oracle 1775M 1749M sleep 59 0 0:01:24 0.0% oracle/1
8814 oracle 1775M 1748M sleep 59 0 0:00:01 0.0% oracle/1
8240 oracle 1775M 1748M sleep 59 0 0:00:02 0.0% oracle/1
4491 oracle 1774M 1748M sleep 59 0 1:12:41 0.0% oracle/1
21365 oracle 1784M 1748M sleep 60 0 0:02:58 0.0% oracle/7
4473 oracle 1774M 1748M sleep 59 0 1:16:30 0.0% oracle/1
4380 oracle 1774M 1748M sleep 59 0 1:13:20 0.0% oracle/1
4394 oracle 1774M 1747M sleep 59 0 0:00:51 0.0% oracle/1
4461 oracle 1774M 1747M sleep 59 0 0:10:09 0.0% oracle/1
4487 oracle 1774M 1747M sleep 59 0 0:00:51 0.0% oracle/1
4368 oracle 1774M 1747M sleep 59 0 0:10:20 0.0% oracle/1
8945 oracle 1774M 1747M sleep 59 0 0:00:00 0.0% oracle/1
4469 oracle 1774M 1747M sleep 59 0 0:03:48 0.0% oracle/1
4493 oracle 1774M 1747M sleep 59 0 0:01:07 0.0% oracle/1
4374 oracle 1774M 1747M sleep 59 0 0:02:44 0.0% oracle/1
4513 oracle 1774M 1747M sleep 59 0 0:01:10 0.0% oracle/1
4400 oracle 1774M 1747M sleep 59 0 0:01:07 0.0% oracle/1
4410 oracle 1774M 1747M sleep 59 0 0:01:12 0.0% oracle/1
4495 oracle 1774M 1747M sleep 59 0 0:01:05 0.0% oracle/1
4402 oracle 1774M 1747M sleep 59 0 0:01:04 0.0% oracle/1
4467 oracle 1774M 1747M sleep 59 0 0:02:38 0.0% oracle/1
Total: 271 processes, 6303 lwps, load averages: 0.19, 0.21, 0.21
Display information about the address space of a process
# pmap -x /proc/* > /var/tmp/pmap.txt# egrep "[0-9]:|^total" /var/tmp/pmap.txt
9663: /opt/IBM/WebSphere/AppServer/java/bin/sparcv9/java -XX:+UnlockDiagnost
9711: /opt/IBM/WebSphere/AppServer/java/bin/sparcv9/java -XX:+UnlockDiagnost
989: /usr/sbin/auditd
total Kb 9560 6456 184 -
9897: /opt/IBM/WebSphere/AppServer/java/bin/sparcv9/java -XX:+UnlockDiagnost
991: /usr/bin/login
total Kb 4080 3328 80 -
9944: /opt/IBM/WebSphere/AppServer/java/bin/sparcv9/java -XX:+UnlockDiagnost
9974: oracleV11STA (LOCAL=NO)
9994: /opt/IBM/WebSphere/AppServer/java/bin/sparcv9/java -XX:+UnlockDiagnost
Display kernel statistics
# kstat -p# kstat -p -c kmem_cache
# kstat -p -m vmem
# kstat -p -c vmem
Kernel Memory Usage
# echo ::kmastat |mdb -k >/var/tmp/kmastat.txtcache buf buf buf memory alloc alloc
name size in use total in use succeed fail
------------------------- ------ ------ ------ --------- --------- -----
kmem_magazine_1 16 3578 70104 1130496 66395659 0
kmem_magazine_3 32 26504 33274 1073152 1663838 0
kmem_magazine_7 64 8285 37973 2449408 13721403 0
kmem_magazine_15 128 15055 140868 18317312 9814269 0
kmem_magazine_31 256 1772 3379 892928 2679104 0
kmem_magazine_47 384 937 16968 6619136 1816530 0
kmem_magazine_63 512 446 29310 16007168 710969 0
kmem_magazine_95 768 539 1960 1605632 1472138 0
kmem_magazine_143 1152 1883 22316 26116096 774079 0
kmem_slab_cache 56 585196 629010 35536896 79538488 0
kmem_bufctl_cache 24 1620169 1708221 41279488 81971159 0
kmem_bufctl_audit_cache 128 0 0 0 0 0
kmem_va_8192 8192 530991 644096 981467136 3068930 0
kmem_va_16384 16384 373715 404832 2337800192 24111784 0
kmem_va_24576 24576 157 770 20185088 76948 0
kmem_va_32768 32768 392 752 24641536 50345 0
kmem_va_40960 40960 154 486 21233664 77627 0
kmem_va_49152 49152 164 165 8650752 44645 0
Reference: http://docs.oracle.com/cd/E19253-01/816-5041/casestudy-27/index.html