One Liners for *nix

# Remove 1st Column 
awk 'BEGIN{FS=OFS="#"}{$2=$3=""}{print}')cat ldm_dump.o |awk 'BEGIN{FS=OFS=" "}{$1=""}{print}'

# Create non-existent dirs
for i in `cat /etc/vfstab|grep vx|awk '{print $3}'`; do mkdir $i; done

# Uncompress and tar install
gunzip -c prdhbs1_hbsdg.tar.gz|tar xvf -

# Veritas
vxprint -v |grep -v NAME|grep -v group |awk '{print $2" ", $5}'
# Grow and extend Vol/FS
vxassist -g spa1dg maxgrow home
vxassist -g spa1dg growby home 63989760
/opt/VRTSvxfs/sbin/fsadm -F vxfs -b 63989760 /export/home
# Find only links
ls -lah |grep ^lls -l `find / -maxdepth 1 -type l -print`

# Change 100 uids/gid - You can combine these (-user 100 -o -group 100 \) -o  means OR but sometimes the gid may be something other then dba or vica versa

find / -user 100 -print -exec chown oracle '{}'  \;find / -group 100 -print -exec chgrp dba '{}'  \;
# Get disk ids for storage team
vxdisk -o alldgs list | egrep "(sunhbsdatadg|appfsdg)" | awk '{print $1}' >>/tmp/vxdisk.ofor i in `cat /tmp/vxdisk.o `; do inq -nodots |egrep "($i)"; done|wc -lfor i in `cat /tmp/vxdisk.o `; do inq -nodots |egrep "($i)"; done>>/var/tmp/emcluns.ocat /var/tmp/emcluns.o|awk  '{print $1 " " $5}'|sed s/\://>>/var/tmp/luns.o

# Init disks for Veritas
vxdisk init xxxxxxxxxxx

# Create DG
vxdg init group disk=devicevxdg init catd0dg emc0_23a2=emc0_23a2

# Grab mount points and disk path
df |sed s/\:/" "/|awk '{print $1 "\t " $2}'|sed s/\(//|sed s/\)//|grep "/dev/vx/dsk"|awk '{print $1}'

# Get vdisks from .xml file for SAN
cat  tspspa1a.xml |grep vdisk |awk -F">" '{print $2}'|sed s/\<\//|awk -F"/" '{print $1}'|grep -v vdisk0|grep -v s10dvd|grep -v apps0
# Import DGs
for i in `vxdisk -o alldgs list |awk '{print $4}'|grep dg|sed s/\(//`; do vxdg import $i; done

# Get INQ names from ldm list
for i in `cat /var/tmp/hbsa.o|awk  '{print $2}'`; do inq -nodots |grep $i; done|awk '{print $5}'
# Kill Synergy
#spa1
pkill vtxnetdpkill VTX0pkill syndps -ef |/usr/xpg4/bin/grep -iE "vtxnetd|VTX0|synd"|grep -v grep
#hbs1
for i in `ps -ef |grep -i syn |awk '{print $2}'`; do kill -9 $i;donepkill syndpkill vtxnetdps -ef |/usr/xpg4/bin/grep -iE "vtxnetd|VTX0|synd"|grep -v grep
#List file locks
echo '::walk lock_graph | ::print lock_descriptor_t l_vnode | ::vnode2path' | mdb -k | sort -u
# Create users accounts 
cp /etc/passwd /tmp/pass; vi /tmp/pass (remove all accounts not to be created i.e. root) cat /tmp/pass |awk -F: '{ print "mkdir -p" " " $6 }'>>/tmp/mkdir.sh;sh /tmp/mkdir.sh

# Change uid/gid 
cat /tmp/pass  |awk -F: '{print "chown -R "$1":"$4 " " $6}' >>/tmp/chown.sh;sh /tmp/chown.sh
# Multible greps
/usr/xpg4/bin/grep  -e ascii -e backup -e GB -e c0t600009 size_alldisks.o

# Create vols
for i in `vxdg list |grep hbs|awk '{print $1}'`; do vxassist -g $i make aplvol 1g; vxassist -g $i make deployvol 1g; vxassist -g $i make hbskramvol 5g; vxassist -g $i make hbsomegavol 5g; vxassist -g $i make appsvol 2g; vxassist -g $i make bbcvol 1g; vxassist -g $i make  downloadvol 5g; vxassist -g $i make aetnaomegavol 5g; vxassist -g $i make  medispanvol 40g; vxassist -g $i make synergexvol 5g; vxassist -g $i make homehbsvol 27g;  vxassist -g $i make stagingvol 76g; vxassist -g $i make omegadrvol 2g; done

# Create FS
for i in `ls -1`; do mkfs -F vxfs $i; done

# Create dirs
cd /zones/xxxfor i in `cat /var/tmp/forsythe/hbs_dirs.o`; do mkdir -p $i; done;cd /zonesfor i in `cat /var/tmp/forsythe/spa_dirs.o `; do mkdir -p $i; done;cd /zones
##Parse resolv.conf & nsswitch.comn Solaris 11
# Clear clone
for i in `vxdisk -o alldgs list|grep hbs8 |awk '{print $1}'`; do vxdisk set $i clone=off; done
# Clear uuids
for i in `vxdisk -o alldgs list|grep hbs8|grep udid_mismatch|awk '{print $1}'`; do vxdisk updateudid $i; done

# User Perms
for i in `ls -1`; do grep $i /etc/passwd|awk -F: '{print $1 ":"$4 " " $1}'; done|more >>/var/tmp/perms.sh
then vi /var/tmp/perms.sh      :%s/^/chown -R /then run it
# rsync 
rsync -av --delete-after --rsync-path=/usr/local/bin/rsync  /export/home/ paz1shbsd2s1:/export/home

# rsync local homes within host for zones
for i in `zoneadm list -c|grep spa|grep paz|grep -v 2`; do rsync -avn --rsync-path=/usr/local/bin/rsync /zones/paz1sspad2s1a/root/export/home/ /zones/$i/root/export/home; done

# Patching zones from host
for i in `zoneadm list -c|grep -v global|grep -v Sol`; do zlogin $i "cd /mnt/patches/Solaris_10_CPU_070815/10_Recommended_CPU_2015-07;./installcluster --s10patchset;done
# ASM Disks
/orainst/grid/product/11.2.0.4/bin/kfod asm_diskstring=''/dev/asmdisk_sit2/*'' disks=all

# Rsync directories only no files 
rsync -av --rsync-path=/usr/local/bin/rsync --include='*/' --exclude='*' /nas/apps/sparcs*  10.93.72.71:/nas/apps

# Look at ssl cert/keys 
/usr/sfw/bin/openssl ciphers -v 'ALL:!ADH:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP'

# rsync a list of files
/usr/local/bin/rsync -av --rsync-path=/usr/local/bin/rsync --files-from=/var/tmp/ism.txt / 10.93.70.101:/  
# Create links from existing
ls -l rx* |awk '{print "ln -s " $11 " " "/"$9}'
# Populate dxfs disks for zone .xml file  
cat vfstab.vxfs |grep vxfs|grep -v "#"|awk '{print "<filesystem special=\""$1"\"" " ""raw=\""$2"\"" " " "directory=\""$3"\"" " type=\"vxfs\"""/>"}'
# Display history without numbers
history | cut -c 8-