UnixTips.net

* use my tips at your own risk !!

* use my tips at your own risk !!

Categories

  • Other (3)
  • Scripting (10)
  • Unix (70)
  • Wordpress (2)

Powered by Genesis

Archives for November 2014

best find command

This is just one of the best find statements I have ever seen.

# find /sbin -xdev -type f -size +1024 -exec ll {} \; | awk '{print $9, $5}' | sort -rn +1 | awk '{print $1, $2/1024/1024 "MB"}' | more
/sbin/powermig 2.67188MB
/sbin/powercf 1.70703MB
/sbin/emc/emcpmgr 1.58984MB
/sbin/vxdisk 1.50439MB
/sbin/vxdg 1.45749MB
/sbin/vxrelayout 1.37262MB
/sbin/vxrecover 1.06357MB
/sbin/vxdmpadm 0.959419MB
/sbin/vxvol 0.953461MB
/sbin/vxdctl 0.916672MB
/sbin/vxlicrep 0.898438MB
/sbin/vgsync 0.882812MB

For Linux

find /var -xdev -type f -size +1024 -exec ls -l {} \; | awk '{print $9, $5}' | sort -rn -t" " -k2 |  awk '{print $1, $2/1024/1024 "MB"}' | more

Hung Solaris Zone : shutting_down state

I had a zone stuck in shutting_down state.

No matter what I did I was not able to shut it down.

But this worked.

# ps -fz myzone
     UID   PID  PPID   C    STIME TTY         TIME CMD
    root  2850     1   0   Jul 22 ?           0:00 zsched
 0040620 18081     1   0        - ?        2529:10 defunct

The problem was that I had a process on the zone that was defunct.

After several kill -9 the defunct process finally died and my zones shutdown and rebooted.

NOTE: YOU SHOULD NOT KILL zsched.