Operating System - Linux
1752582 Members
5008 Online
108788 Solutions
New Discussion юеВ

Re: sort -rnk2 usage way ans sz size

 
SOLVED
Go to solution
???_185
Regular Advisor

sort -rnk2 usage way ans sz size

I test two command(sort -rnk2 and sort -rn)
I want to know how different from
and I want to know how do I understand sz size. is it kylobytes?
root@:/]# UNIX95= ps -e -o ruser,sz,pid,args|sort -rn| head -10
root 2628 1320 /opt/perf/bin/midaemon
root 1587 1190 /opt/wbem/sbin/cimserver
root 918 1351 /opt/perf/bin/scopeux
root 715 1621 /opt/perf/bin/rep_server -t SCOPE /var/opt/perf/datafiles/loggl
root 658 1452 /opt/VRTSob/bin/vxsvc -r /opt/VRTSob/config/Registry
root 532 1363 /usr/sbin/swagentd -r
root 526 1187 /opt/dce/sbin/rpcd
root 455 1105 /usr/sbin/snmpdm
root 453 1624 /opt/perf/bin/alarmgen -svr 1623 -t alarmgen /var/opt/perf/data
root 442 24416 sshd: oracle@1
----------------------------------------------
root@:/]# UNIX95= ps -e -o ruser,sz,pid,args|sort -rnk2| head -10
oracle 31820 2473 ora_arc1_CDR
oracle 31820 2471 ora_arc0_CDR
oracle 31820 2463 ora_lgwr_CDR
oracle 30540 2461 ora_dbw1_CDR
oracle 30540 2459 ora_dbw0_CDR
oracle 30472 2457 ora_pmon_CDR
oracle 30320 24753 oracleCDR (LOCAL=NO)
oracle 30320 22939 oracleCDR (LOCAL=NO)
oracle 30304 22941 oracleCDR (LOCAL=NO)
oracle 30304 22651 oracleCDR (LOCAL=NO)
3 REPLIES 3
Sergejs Svitnevs
Honored Contributor
Solution

Re: sort -rnk2 usage way ans sz size

when you use sort -kX, you are defining the position of the sort key (text delineated by blank characters).
Using sort -rnk2 you sort ps output by PID in reverse order.

The SZ field displays the size of the process in memory. The value of the field is the number of pages the process is occupying. On both the Linux and HP machines, a page is 4,096 bytes.

Regards,
Sergejs
???_185
Regular Advisor

Re: sort -rnk2 usage way ans sz size

I had compared glance and ps due to memory size.
first of all,glance is like this.

Resources PID: 10683, oracleSTBYDB PPID: 1 euid: 200 User: oracle
--------------------------------------------------------------------------------
CPU Usage (util): 0.0 Log Reads : 0 Wait Reason : STRMS
User/Nice/RT CPU: 0.0 Log Writes: 2 Total RSS/VSS :100.4mb/112.1mb
System CPU : 0.0 Phy Reads : 1 Traps / Vfaults: 0/ 0
Interrupt CPU : 0.0 Phy Writes: 34 Faults Mem/Disk: 0/ 0
Cont Switch CPU : 0.0 FS Reads : 1 Deactivations : 0
Scheduler : HPUX FS Writes : 34 Forks & Vforks : 0

Second,ps command like this.

root@stby:/]# UNIX95= ps -e -o ruser,sz,vsz,pid,ppid,args|sort -rnk2|head -5
oracle 36940 147760 19792 1 oracleSTBYDB (LOCAL=NO)
oracle 36940 147760 10683 1 oracleSTBYDB (LOCAL=NO)
oracle 35916 147760 8495 1 ora_mrp0_STBYDB
oracle 31820 131376 19794 1 oracleSTBYDB (LOCAL=NO)
oracle 31820 131376 10956 1 oracleSTBYDB (LOCAL=NO)

same pid present differently between sz and rss , vsz and VSS.

How can I understand this?

Thanks.
RAC_1
Honored Contributor

Re: sort -rnk2 usage way ans sz size

The sz size is in buff pages. One buffer is of 4096bytes size.

-rnk2 --> will sort on numerical second column and reverse the order.
-rn --> will sort on first numerical column and reverse the order.
There is no substitute to HARDWORK