The Cheat-Sheet

       ,-O
      O(_))
       `-O

Yes, it is a cheat-sheet code page. To community, I believe this cheat-sheet code can be very useful enough as dirty and quick reference. I will update this page frequently. Have fun :)

1. How to perform unzipping multiple zip files?

echo -en "enter zip files directory : "
read answer
mkdir -p $answer/totalzip
cd $answer/totalzip
for i in `ls $answer | grep '\<.*zip\>'`
do
  unzip $answer/$i
done


2. How to perform mounting ISO file on Solaris

sh> lofiadm -a /export/home/you/esf.iso
sh> mount -F hsfs -o ro /dev/lofi/1 /mnt


3. How to perform compress directory into .tar.Z type file?

sh> tar cf myfile.tar My\ File &&  compress -vf myfile.tar 


4. How to perform uncompress .tar.Z type file?

sh> zcat /afs/data/myfile.tar.Z | tar xf -


5. How to setup Link Based IPMP
Active-standby concept which fjgi0 and hme0 get the same IP. Please be sure to set parameter FAILBACK=no in /etc/default/mpathd and run command below,

sh> eeprom  local-mac-address?=true
sh> hostname testbed
sh> echo "192.168.100.5	testbed" > /etc/hosts
sh> echo "192.168.100.0	255.255.255.0" > /etc/inet/netmask
sh> echo "192.168.100.1" > /etc/defaultrouter
sh> ifconfig fjgi0 192.168.100.5 netmask 255.255.255.0 broadcast 192.168.100.255 up
sh> echo "`uname -n` netmask + broadcast + group set_ipmp1 up" > /etc/hostname.fjgi0
sh> echo "group set_ipmp1 up" > /etc/hostname.hme0 


5. How to regenerate the broken or corrupted /etc/shadow file?

sh> pwconv


6. How to perform shell terminal log

sh> script -a /export/home/log_script_oktora.txt


7. How to check WWN info

sh> /opt/FJSVpfca/sbin/fc_info -a
sh> fcinfo hba-port
sh> prtconf -vp | grep ww


8. How to recognize CD/DVD-ROM device on Solaris

sh> iostat -En


9. How to check NIC link status

sh> kstat -p fjgi | grep link


10. How to create ALOM user in ILOM environment

-> create /SP/users/dummy
-> set /SP/users/dummy role=Administrator
-> set /SP/users/dummy cli_mode=alom


11. How to restart & shutdown Solaris gracefully

For restart command
sh> shutdown -y -g0 -i6
For shutdown command sh> shutdown -y -g0 -i5


12. How to recognize new inserted device(s) on Solaris

sh> devfsadm


13. How to capture prstat output periodically by schedule job on Solaris
Below, /export/home/testbox/prstat.sh is executed by every minute.

sh> touch /export/home/testbox/prstat.sh
sh> chmod +x /export/home/testbox/prstat.sh
sh> TERM=vt100 ; EDITOR=vi ; export TERM ; export EDITOR
sh> vi /export/home/testbox/prstat.sh
#!/usr/bin/bash
`(date; prstat -n 100 -c 1 1) >> /export/home/testbox/performance.txt`

sh> crontab -e
* * * * * /export/home/testbox/prstat.sh


14. How to delete and remove metadevice on Solaris
For example, we have metadevice d24 related to c0t1d0s4 slice. But at moment we decide to remove metadevice d24 remaining c0t1d0s4.

sh> metaclear d24


15. How to reset ILOM or ALOM at Sparc Enterprise T series
It is rare but needed. When ALOM/ILOM T series management hang, it is needed to reboot ILOM/ALOM from serial management. This reset method doesn't harm live machine, it will not reboot operating system. It means safe. First line command is used in ILOM environment and second line is in ALOM environment.

-> reset /SP

sc> resetsc


Leave a Reply