Handy commands (Solaris)

From S23Wiki
Jump to: navigation, search
  • Per partition io info:-
iostat -xPnce
  • continuing iostat info to see what's in use:

iostat -xsn

  • Processor status:-
  • View system config:-
/usr/platform/sun4u/sbin/prtdiag -v


/usr/platform/`uname -m`/sbin/prtdiag
  • Capture console output:-
  • Show pid accessing file structure:-
  • List package contents:-
pkgchk -l -d blah.pkg
  • Install package under alternate root (finish scripts will probably fail):-
pkgadd -R /usr/local/blah/ -d blah.pkg
  • Copy VTOC between disks:-
prtvtoc /dev/dsk/c0t0d0s0 | fmthard -s - /dev/rdsk/c0t1d0s0
  • Perform host lookup using naming service (ie obeying nsswitch.conf):-
getent hosts www.test.co.uk
  • Clone a box with tar (obviously it's more involved that just this):
time tar cf  - `\ls -A|egrep -v 'lost|proc'` | ssh "cd /a;tar xf -"
  • Flash a disk light using luxadm
luxadm led_on <world wide number>
  • Find all suid files modifiled since package install (or not installed from pkg)
find / -perm -u+s -exec pkgchk -p {} \;  | more
  • Fix permisions on /etc/mnttab (or if you have broken mnttab)
umount /etc/mnttab
chmod 444 /etc/mnttab
mount -F mntfs mnttab /etc/mnttab