Beth's Favorite Unix Commands

To add a user from commandline:
If user has accounts on other unix boxes, use same UID on all systems.
useradd -m -d /export/home/[username] -g[primary group #] -u[UID to assign] -s /usr/bin/ksh [username]

To list drive info on VxVm controlled Arrays:

LuxParse 2.0 ...for script updates, visit: CuddleTech

run: 'luxadm probe' to get array names
syntax for lux_parse.pl:
lux_parse.pl [array name]

or vxprint -g brsdg -ht

To Kill a large number of processes based on a common value:
ps -aef | grep -i WHATEVER | awk '{print $2}' | xargs kill -9 $1

To chmod a large directory tree including files:
find . -name '*.GIF' | xargs chmod g+w

To monitor / log some process based on PID:
while true; do WHATEVER <pid>, sleep 5; done

To enable CDE on startup
/usr/dt/bin/dtconfig -e

To export X-display to local:
on local machine: xhost +
on remote machine: DISPLAY=mymachine.mydomain.com:0.0; export DISPLAY
when done, on local machine: xhost -

To switch modes without reboot:
init 1 - single user mode
init 3 - normal run mode
init 6 - reboot

To remove files by patten match, oldest first:
ls -rt | while read file; do if [[ $file = *.png ]]; then print removing $file ...; rm $file; fi; done

Installing a Boot Block:
Error: The file just loaded does not appear to be executable.
Reason: Boot block on the hard disk is corrupted .Boot the system in single user mode with cdrom and reinstall boot block.
Fix: installboot /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0t3d0s0
Example: usr/sbin/installboot /usr/platform/sun4u/lib/fs/ufs/bootblk /dev/rdsk/c0t0d0s0

Console  Key Sequences:
Quit: ctrl-]
Stop-A: ~ ctrl-b

Sendmail Commands:
sendmail -q R<string> : process queued for recipient <string> only
sendmail -q S<string> : process queued from sender <string> only
makemap hash file_out < file_in (not for use on aliases)

Misc Commands:
netstat -I hme# <interval>: monitor interface connections
find <dir> -size +{blocks}: find large files
df -F ufs -o i: check for free inodes/inode status


Beth's Favorite Links to Unix Stuff


SE ToolKit
  Solaris Performance Monitoring software

Sun Compatible HDD listing from SunSolve

Seagate Disks by Model Number

FreeBSD.org

Cool Unix Commands