San Francisco

dave spink toolset




SOLARIS COMMANDS:

SYSTEM INFO FILES ACCOUNTS ACCESS
QUOTAS FILE SYSTEMS IN USE PACKAGES
SERVICES NIS CRON CONFIGS
PRINTING KORN SHELL ARCHIVING OPEN BOOT PROM



SYSTEM INFO

General
isainfo -kv or b ;determine 32 bit or 64 bit
pagesize ;display memory page size
uptime ;also show load over 1, 5, and 15 minute averages
/usr/platform/sun4u/sbin/prtdiag ;print system diag information
/usr/sbin/prtconf | grep -v not ;only list attached devices
sysdef -i | grep -i semmni ;list hardware, system, kernel parameters semaphores
locale ;to see what char sets your profile is using
psrinfo ;display cpu stats
psradm -f 1 ;offline cpu 1
cat /etc/name_to_major ;see map of device type to major number
cat /etc/path_to_inst ;see history of what devices the minor numbers reference
prtvtoc /dev/rdsk/c0t0d0s2 > datafile ;save VTOC to a file
last reboot ;reads /var/adm/wtmpx which records all logins and logout cmds
Display
dtterm -name d1de0100 -ls -sl 5000 -bg lightblue -fg black -display @d ;via X Server
xud -out /tmp/testfile -display d1de0199:0.0 ;from serverA send screen to d1de0199 in file
xwud -in /tmp/testfile -display d1de0199:0.0 ;display the file that was saved on remote server
xrdb -query ;check server that your display is on has X listening
vi /etc/dt/config/Xservers ;Xserver video config file
fbconfig -dev jfb0 -res 1280x1024x76 -defdepth 24 ;set res and depth
m64config -res 1280x1024x76 -depth 24 ;config M64 graphics accelerator
Raid Controllers
/usr/lib/osa/bin/healthck -a ;A1000 health check
/usr/lib/osa/bin/rm6 ;A1000 raid manager
/usr/sbin/sccli --list ;3310 list controllers
/usr/sbin/sccli /dev/rdsk/c2t0d0s2show disks ;3310 show disks




FILES

General
pr -m fruit fruit2 file3 ;merges files side by side
du -ks vlsOut.log ;a file open in memory with "ls" may show different size
> filename ;if open in memory ls shows same size, run du -ks to see real size
ff /dev/dsk/c0t0d0s0 ;provide a list of path names and inode numbers
mkfile 20m /export/data/swapfile ;20Mb swapfile on /export partition
tr '[a-z]' '[A-Z]' < intro ;translate all lowercase letters to uppercase
cut -d: -f1,6 /etc/passwd | tr : ' ' ;cut two fields out of passwd and translate : with spaces
cut -c1-8 ;extract the first 8 characters
cut -c5- ;extract to the end of the line
cut -c1-8,18- ;extract the first 8 characters, then from 18 to end of line
cut -c1,13,50 ;extract chars 1, 13 and 50
ls -in ;shows inode & UID / GID
ls -c ;ctime = modified inode via mv,cp,chmod
ls -t ;mtime = written time
ls -u ;atime = read time via cat, more, less
ls -V test-file2 ;shows ACLs on file
file filename ;determine text, data, exe or ELF
strings ;extract printable chars in a binary file
touch -m 07231100 testfile ;creates test file with date / time stamp
sort names | uniq ;removes duplicates if they are consecutive occuring
sort names | uniq -d ;lists duplicate lines
sort /etc/passwd | cut -f1 -d: | uniq -d ;find duplicates
dd if=/dev/zero of=/shareX/testfile.out bs=1048576 count=1000000 ;create file 1MB IOs
dd if=/shareX/testfile.out of=/dev/null bs=131072K count=1000000 ;read file 128KB chunks
File Security
chmod 4555 executable_file ;4 suid, -r-sr-xr-x runs as owner, rather than who starts
chmod 2555 executable_file ;2 sgid, -r-xr-sr-x runs as group, rather than who starts
chmod 1777 public_dir ;ls -ld /tmp is drwxrwxrwxt protects file in a public writable
chmod g+s shared_dir ;files created in directory belong to the dir group
setfacl -m user:user8:6 fi.txt ;user8 has read and write on file.txt
setfacl -m m: 6 file.txt ;sets ACL mask i.e. maximum permissions allowed for all users
getfacl file.txt ;show access control list
setfacl -d u:user8 file.txt ;note no permissions used
File Search
find . -type f -print | xargs rm ;to overcome "arg list too long"
find ./ -perm -4000 ;disregard anything that has a zero, search for suid
find ./ -user 0 ;all files owned by root
find ./ -size +19646c -exec ls -l {} \; ;file over certain size
find ./ -type l ;returns symlinks
find ./ -mtime +90 ;files written over 90 days
find ./ -type f -ls ;finds file and provides full ls listing
find ./ -user 1000 -exec rm {} \; ;finds files with UID 1000
find ./ -type d -prune -o -name t.t -print ;find files without recursive directory
grep -v root /etc/group ;display only lines that does not contain the pattern
ps -ef | grep -v grep | grep srdf_check.sh ;don't include your grep in output
egrep '(Network | uucp) Admin' /etc/passwd ;searches for "Network Admin" or "uucp Admin"
fgrep '*' /etc/system ;search string, will not use as not meta char
Sed
sed -n l /etc/vfstab ;if fields are separated by a tab then > is shown
sed '/pattern/d' filename ;deletes line if pattern matches
sed '/pattern/p' filename ;print stdout
sed 's/xxx/yyy/g' filename ;subsitute
sed '#,#d' filename ;removes line # to line #
sed '#d' filename ;removes only one line #
sed '#,$d' filename ;removes line # to the last line
sed '$d' filename ;removes only the last line
sed '/root/d' /etc/group ;removes root for listing of /etc/group
sed -n '/Dante/p' dante ;only print match, not all lines
sed 's/^........//' file ;removes first eight chars of the file via subsitute
sed 's/$/ EOL/' ;place chars at end of line
sed 's/ */:/g' ;finds something with two spaces and replaces with :
sed -e 's/Me/YOU/g' -e 's/poet/POET/g' file ;subsitute with multiple edits
Awk
awk '{print $3, $4 }' ;the , provides a one char space
awk '{print $3 " " $4}' ;the " " provides 4 char spaces
awk '{print $3, "hello", $5 "\t" $9,"hi"}' ;t for tab
FSALL=`df -k | grep $myvar | awk '{ total += $2 } END { print total }'` ;sum allocated file system
FSALL=$(echo "scale=2; $FSALL / 1048576" | bc); echo $FSALL" GB" ;display sum in GB
FSUSE=`df -k | grep $myvar | awk '{ total += $3 } END { print total }'` ;sum allocated file system
FSUSE=$(echo "scale=2; $FSUSE / 1048576" | bc); echo $FSUSE" GB" ;display sum in GB
FSFRE=`df -k | grep $myvar | awk '{ total += $4 } END { print total }'` ;sum allocated file system
FSFRE=$(echo "scale=2; $FSFRE / 1048576" | bc); echo $FSFRE" GB" ;display sum in GB




ACCOUNTS

groupadd -g 502 drstest ;create group
passmgmt -m -s /etc/ftponly spi0004 ;set shell for user
pwconv ;creates and updates /etc/shadow with info in /etc/passwd
finger -m username ;display user info, -m says use only uid not comment info
finger -m username@remotehosts ;file .project or .plan is displayed if they exist, need rw-r--r--
rusers -l ;like who but for remote systems, needs rpc.rusersd daemon
groups user5 ;group membership
grpck ;check /etc/group for syntax errors
pwck ;check /etc/passwd for syntax errors




ACCESS

Cron
/etc/cron.d/cron.deny ;exists by default, has precedence if user in both deny and allow
/etc/cron.d/cron.allow ;does not exist by default, if exists only users in file create cronjobs
/etc/cron.d/at.deny ;exists by default
/etc/cron.d/at.allow ;doesn't exist by default, if exists only users in file create 'at' jobs
/var/spool/cron/crontabs/ ;location of user crontab files
crontab -e ;edit crontab, ensure EDITOR=vi
crontab -r username ;remove crontab file
at -m -t MMDDhhmm ;enter cmd, press ctrl-d
at -l ;list at jobs
Remote
ssh dspink001@uxnbpr08 ;user account must exist on remote system
ssh -l dspink001 uxnbpr08 ;user account must exist on remote system
ssh -l dspink001 uxnbpr08 ls ;executing a program on a remote system, if that user is allowed
Disks
cfgadm -o show_FCP_dev -al ;see access to disks




QUOTAS

quot -af ;disk space -a all file systems, f for number of files




FILE SYSTEMS

General
cat /etc/default/fs ;for a local file system usually LOCAL=ufs
cat /etc/dfs/fstypes ;for a remote file system usually nfs NFS
/usr/sbin/newfs /dev/rdsk/c1t3d0s0 ;create file system
/usr/sbin/newfs -N /dev/rdsk/c1t3d0s0 ;list alternate superblocks
/usr/lib/fs/ufs/mkfs -G -M /current/mount /dev/rdsk/cXtYdZsA newsize ;grow ufs
tunefs -m %free /dev/rdsk/c1t3d0s0 ;increase min free area
fsck /dev/rdsk/c0t0d0s0 ;only way to check a file system not in /etc/vfstab
fsck /opt ;file system details need to be in vfstab
fsck -y -o -f /dev/rdsk/c0t0d0s0 ;-y assume yes response, -f force regardless of clean flag
fsck -o b=32 /dev/rdsk/c0t0d0s0 ;using backup superblock at number 32
du -kd / | sort -n ;don't cross mount points
df -F ufs -o i ;see inodes available
swap -l ;list details of swap
swap -a /export/data/swapfile ;add swap
dumpadm -d /dev/dsk/c1t0d0s1 ;set dump device to swap
dumpadm -s /var/crash/d1de0008 ;set save core directory
coreadm -e global -g /var/core/core.%f.%p.%u. ;system wide
mount ;list file system mounted
mount -r -F hsfs /dev/dsk/c0t0d0s0 /mnt ;mount cdrom on SUN v240
/etc/mnttab ;file is updated by mount cmd
/etc/vfstab ;lists all file systems to be mounted automatically
/usr/sbin/showmount -e ar7320-220 ;show NFS exports
/usr/sbin/showmount -a ar7320-220 ;see what is NFS mounted
/usr/sbin/nfsstat -m ;show information about each NFS mount
mount -o ro, nosuid /dev/dsk/c0t0d0s7 /mnt ;prevents execution of setuid programs
umount -f mount_p ;new to Solaris 8 - force umount
mountall ;mounts local and remote
umountall ;umounts all except /, /var, /var/adm, /var/run, /proc, and /dev/fd
fuser -cu /oracle ;list processes accessing system and userid
/usr/sbin/vold ;auto cdrom
/etc/init.d/volmgt stop ;stop auto mount for cdroms
fstyp /dev/rdsk/c0t0d0s0 ;file system type
fstyp -v /dev/vx/dsk/oratempdg/oratemp ;to find block size used on the veritas file system
dd if=/dev/rdsk/c0t0d0s2 of=/dev/dsk/c0t2d0s2 bs=128k ;copy file system at block level
dd if=/dev/sda1 of=/dev/sdb1 bs=4096 conv=noerror ;duplicate one hard disk partition to another hard disk
dd if=/dev/zero bs=8192 count=1250000 of=/test/testfile ;sync write to appliance
dd if=/dev/urandom bs=1024 count=1000 of=/test/testfile.bin ;async write, 1MB random bytes, it writes them sequentially.
Solaris Volume Manager
metastat ;display configuraion
metastat -p ;display status for metadevice or hot spare pool
metafree d100 ;script - see sunhelpdesk.com, for soft partition size
metattach d100 4g ;attach metadevice
metadb -i ;check meta database
metaclear -r -f d52 ;clear meta with force
metareplace -e d3 c1t1d0s3 ;attempt a rync




IN USE

Processes
top ;use "r" to change process priority, "k" to kill
echo $$ ;echo current pid
mpstat 1 ;check xcall not more than 400 per second
vmstat 5 ;check cpu
ptree 7371 ;see process tree
pgrep -l lockd ;display name of process along with PID
tty ;identifies name of the terminal window /dev/pts/12
pkill dtmail ;terminate process name
pcred PID ;print the credentials, effective, real, uid & gid
pldd PID ;list dyanmic libraries
pfiles PID ;info on open files
pmap PID ;info on address space
/usr/ucb/ps auwwx | grep 13641 ;full process info
prstat -s rss ;process listing by most used memory
Memory
swap -l ;list details of swap
swap -s ;summary
prtswap ;memtool - prints swap utilization
prtmem ;memtool - shows physical memory utilization
memps ;memtool - shows witch processes are using the most virtual memory
ipcs -s | wc -l ;print info about active semaphores
ipcs -b ;semaphores, shared memory segments
ipcrm -m 800 ;semaphores, remove this share memory segement
Network
ping -s -R -n -i eri0 d2pr0005 1500 5 ;ping with 1500 bytes, 5 times
ping -s 10.140.128.255 ;good info on what systems are available on network
traceroute 172.20.4.110 ;will display resolved hostnames
netstat -sP tcp | grep tcpListenDrop ;determine if server is handling queues
netstat -sP tcp | grep tcpHalfOpenDrop ;determine if server is victim of SYN flood
netstat -r ;show table-driven routing as fqdn
netstat -i 10 ;show interface stats
netstat -a ;list which ports are reserved & established
snoop | egrep -i 'nfs|ack|ftp' ;only display nfs,ack,ftp stuff
snoop -v arp ;trace of arp
snoop -o /tmp/output udp dhcp ;trace udp and dhcp
File Descriptors
ulimit -a ;display limits in ksh
ulimit -n 2048 ;set limits in ksh
limit -a ;display limits in csh
limit descriptors 2048 ;set limits in csh
I/O Usage
iostat -xnz c3t50060482D5309446d404s2 5 ;disk io for specific device
iostat -xntc 5 300 ;disk io
iostat -xne 5 ;display name is descriptive format rmt0
iostat -xe 5 ;display name as kernel see st20
iostat -ne ;find a cdrom
iostat -En ;see disk soft, hard and transport errors
psio 5 ;disk i/o per process, http://users.tpg.com.au/adsln4yb/psio.html
/opt/RICHPse/bin/se disks.se ;convert sd names into physical disks
Kernel Modules
modinfo ;display info about loaded kernel modules
modload -p misc/obpsys ;loads OBP Symbol Table kernel module into running system
forceload: misc/obpsys ;loads OBP Symbol Table kernel module via /etc/system file
modinfo | grep obpsym ;get ID of loaded module
modunload -i 89 ;unloads inactive kernel module
truss ls ;trace system calls, library calls
cat /usr/include/sys/errno.h ;explain truss err meanings




PACKAGES

Packages
/var/sadm/install/contents ;all packages info
pkginfo | more ;has three sections category / pkginst / name
pkginfo -l SUNWman ;detailed
pkginfo | wc -l ;determine how many pkgs installed
pkgrm SUNWaudio ;may warn about possible package software dependencies
pkgchk SUNWaudio ;checks contents
pkgchk -v SUNWaudio ;list the files in the package
pkgchk -p /etc/passwd ;check if contents have changed since package was installed
pkgchk -l -p /usr/bin/showrev ;list information on the files that make up the package
pkgadd -d . -a ./pkg.yes ;adds all packages
pkg-get -i ghostscript ;www.blastwave.org
Patches
ls /var/sadm/patch ;directory of all patches installeda
showrev -p | grep 105050 ;check current version
patchadd -d 105050-01 ;-d does not back up the files to be patched, patch cannot be removed
./backoutpatch . ;removes patch, see previous commands
find / -name 105050-01 -print ;find location of installed patch




SERVICES

Startup
/sbin/init 6 ;or any init value runs rc0 kill scripts
/usr/sbin/shutdown 5 ;or any init runs rc0 kill scripts
/usr/sbin/halt ;immediate to OBP prompt, no rc0 kill scripts
/usr/sbin/poweroff ;immediate to poweroff, no rc0 kill scripts
/usr/sbin/reboot ;sync on disk, no rc0 kill scripts, reboots to multi-user
/usr/sbin/reboot -d ;forces a system crash
shutdown -y -g 120 -i 0 "Disk repairs" ;nice method
shutdown -i6 ;notifies uses, default 60 seconds
Network Services
/etc/init.d/inetsvc stop ;start
/etc/init.d/inetsvc start ;stop
/usr/sbin/inetd -s -t & ;-s run standalone, -t enables TCP tracing for incoming connections
/etc/inet/inetd.conf ;for each service listed, inetd tries to bind to a port
/etc/inet/services ;list of ports registered for binding to
/etc/rpc ;list of rpc program numbers
rpcinfo ;displays program number, version, protocol, ports
rpcinfo -p d1de0199 | grep sprayd ;list rpc services on a host
rpcinfo -d sprayd 1 ;unregister rpc program
rcpinfo -u servera mountd ;determine if specific service is running on a server
rpcinfo -d mountd 1 ;unregister rpc program
logger -p user.err System rebooted ;add one-line entry into system log file
Shares
dfshares ;what is being share
share -F nfs -o anon=n ;sets effective UID for unknown users, default is EUID of nobody.
share -F nfs -o anon=0 ;the EUID for access to set to the UID of user accessing resource
share -F nfs -o anon=-1 ;access is denied
share -F nfs -o ro,log=global /testd ;enable logging, must set log=tag in /etc/nfs/nfslog.conf
Network Time Protocol
/etc/rc2.d/S74xntpd ;xnptd process is started if /etc/inet/ntp.conf exists
/etc/inet/ntp.conf ;contents determines if daemon starts in server or client
/etc/inet/ntp.server ;server template, client is ntp.client
xntpdc , xntpdc> ? ;ntp query program
xntpdc> host ;query other hosts
xntpdc> host time-server-d ;set current host to time-server-d
ntpq , ntpq> ? ;ntp query program
ntpq> peers ;obtain list of server peers
Domain Naming Service
nslookup portofnapier.co.nz ns2.safenz.net ;query this record on ISP host for DNS
dig @c1pr0001.cpships.com ldmsdep.cpships.com ;dig replacement for nslookup
dig @e.root-servers.net . ns>db.cache ;gets latest copy of root hints file
dig @192.203.230.10 portofnapier.net.nz ;query root hints server
dig @202.46.190.130 portofnapier.net.nz ;query DNS server returned from root hints
dig @ns2.safenz.net portofnapier.net.nz ;query DNS server returned from 202.46.190.130
set d2 ;set debug mode
set type=ns ;query name servers
set type=mx ;query mail records
set type=ptr ;query pointer records
pkill -INT in.named ;write cache to file /var/named/named_dump.db
pkill -USR1 in.named ;increase debug level by 1 /var/named/named.run
pkill -USR2 in.named ;return to normal i.e. debug level 0 no debug
pkill -HUP in.named ;reread all config
/usr/local/sbin/named -u 53 -g 53 -q -d 9 ;turn on debug for named




NIS

yppush -d cpships.com -v hosts.byname ;forces modified maps to slaves
ypxfr passwd.byname ;synchronises local maps with NIS master maps, run from time to time
ypset 10.0.0.x ;forces client to bind to NIS server, good for testing
ypwhich ;returns name of NIS server that is supplying NIS services
ypwhich -m ;list all databases on masterserver
ypcat passwd ;entire map contents are displayed but no the key itself
ypcat -k passwd ;entire map contents plus key is displayed
ypmatch spi0004 passwd ;like grep
ypinit -m ;initialise master, ask you to enter NIS slave servers
ypinit -c ;initialise client
ypinit -s 'nis master' ;initialise as a slave, pull all maps
ypstart ;starts NIS master daemons
make ;build or refresh NIS database maps, must be from source i.e. /etc or /var/yp
ypstop ;stops NIS master daemons
ypcat hosts ;print values from NIS database, not ypcat hosts.byname.pag
ypcat -x ;see list of relationships for cating maps or cat /var/yp/nicknames
ypmatch user1 passwd ;match a user in password database
ypxfr hosts.byaddr ;forces slave to pull this map from host master
yppasswd or passwd ;user changes password
yppoll passwd.byuid ;use to check serial numbers on master and slave
rpc.yppasswdd /etc/passwd -m passwd ;updates passwd map and pushes to slaves




CRON

cat /etc/crontab ;display system crontab
tail -f /var/log/cron ;cron log
cat /var/spool/cron/root ;see cron entries created by user root
at -f mycmds.txt noon ;run job with commands in file at noon
atq ;see queued jobs




CONFIGS

General
cat /etc/nsswitch.conf ;search order
/etc/dfs/dfstab ;each line share cmd, nfs.server rc3 scripts contains shareall cmd
/etc/rmtab ;nfs clients updated by mountd, remove stale entries to allow remount
/etc/dfs/fstypes ;default types if -F not used
/etc/default/mpathd ;ipmp configuration file
/etc/inet/ntp.conf ;ntp configuration file
/etc/init.d/rootusr ;file used to create OS routing entries
/usr/local/etc/sudoers ;sudoers file
/etc/default/telnetd ;default settings
/etc/default/login ;CONSOLE=/dev/device -root can only log at system console
Routing
/etc/defaultrouter & /etc/notrouter ;prevents routes daemons from starting
ndd -set /dev/ip ip_forwaring 1 ;two nics default routing and sets this value
route add net 128.50.3.0 d1de0199 1 ;add a network route,
route add host d1de0199 10.140.130.18 -interface ;add a host route; uses interface
route add default 10.140.128.1 ;add a default route
route delete 128.50.3.10 d1de0199 ;delete host route
route delete net 129.50.3.0 d1de0199 ;delete network route
route get 128.50.2.0 ;lookup and display route destination
route monitor ;reports changes to routing tables
route flush ;flush tables of all gateway entries
route change ;change aspect of route e.g. gateway
route add 224.0.0.0 `uname -n` 0 ;add multicast address
in.routed -q ;keep from broadcasting i.e. keep in quiet mode
in.routed -s ;makes a multi-homed system advertise it's routes
in.routed -v /var/adm/routelog ;log actions to file
in.routed -s -t ;log actions to screen
in.rdisc -a -s ;used by hosts, sends messages to discover
in.rdisc -r ;runs if two nics and no /etc/notrouter
in.rdisc -r -T 100 ;used by routers, change advertise from 600 seconds to 100
Arp
arp -a ;examine arp cache, may appear to hang as tries resolve
arp -a ;use to test if there are duplicate IP addresses
arp -s hostname ethernet_address ;create static entry
arp -d hostname ;delete i.e. there is no flush of arp
arp -f filename ;add entries from a file
/usr/sbin/in.rarpd -a ;the -a gets a list of interfaces and starts rarpd
/usr/sbin/in.rarpd -ad ;put rarp deamon in debug mode
Internet Layer
ifconfig -a ;if root you also see mac address
ifconfig hme1 ether 0a:0:20:77:dc:7b ;change ether number on interface
ifconfig hme0 down ;take down
ifconfig hme0 plumb ;open an interface, sets streams needed for tcp/ip
ifconfig hme0 netmask 255.255.252.0 +up ;set netmask
ifconfig hme0:1 plumb 128.50.1.100 up ;configure virtual interface
ifconfig hme0:1 down unplumb ;must first take interface down and then unplumb
ifconfig hme0 inet6 plumb up ;plumb IPv6 interface
ndd /dev/ge link_speed ;see 100Mbps 1 or 10Mbps 0
ndd /dev/ge link_status ;see up 1 or down 0
ndd /dev/ge link_mode ;0=half, 1=full
ndd /dev/ip ip_forwarding ;see 0 for not forwarding or 1 forwarding
ndd /dev/tcp ? ;show tcp values
ndd -get /dev/tcp tcp_xmit_hiwat ;tcp window send buffer size
ndd -get /dev/tcp tcp_recv_hiwat ;tcp window receive buffer size
ndd -set /dev/ip hme0:ip_forwarding 1 ;set IP forwarding specifing interface
ndd -set /dev/ip ip_forwarding 1 ;as above
ndd -set /dev/ip ip_addrs_per_if 8192 ;set number of possible virtual addresses to 8192
ndd -set /dev/eri adv_100fdx_cap 1 ;set full duplex, note there is no =1
dladm show-linkprop -p mtu igb1 ;set details including MTU value and possible sizes
dladm show-phys | grep up ;interface speed
dladm show-link | grep up ;;interface and vnic
dladm show-dev | grep "link: up" ;see ixgbe instance
ipadm show-if ;state
ipadm show-addr ;ip address
ipadm show-addr -o all ;see address




PRINTING

/etc/init.d/lp start ;print services started
/etc/init.d/lp stop ;print services stopped
/usr/lib/lpshut ;stop LP print service
/usr/lib/lpsched ;start LP print service
accept printerB ;permits request to be queued
reject -r "reason" printerB ;rejects print requests
enable printerB ;activates a printer
disable -W -r "reason" prtB ;deactivates, W waits till job is finished
/usr/ucb/lpr -P printerB filename ;atomic style
/bin/lpr -P host1:printerB filename ;posix style
lp -d printer test.txt ;specify printer
lpadmin -d hp8100n_1 ;set default printer
lpstat ;check status of print job
lpstat -d ;display default printer
lpstat -o ;status of output requests
lpstat -a ;list available printers
cancel -u request id ;-u removes all requests for that user




KORN SHELL

fc -l 1 ;show history starting from first cmd
fc -e - xx ;xx is history number, runs this previous cmd
r 160 ;alias for fc -e - xx, runs cmd in history
alias dir='ls -lF' ;sets dir alias
unalias dir ;remove alias
function num { who | wc -l; } ; create function
num ;assuming function num exists, see typeset -f
typeset -f ;displays a list of all functions
typeset +f ;displays just the functions names




ARCHIVING

script t.txt ;log all cmds into a file, Ctrl-D when finished
tar cvpfE - PR1 | ( rsh SERVER "cd /oracle ; tar -xvpf - ") ;tar and copy to remote system
tar cvpfE - PR1 | (cd /backup ; tar xvpf - ) ;tar and move locally
tar cvpfE - . | (cd /oracle/TMP ; tar xvpf - ) ;tar and move from current directory
rsync -avz --rsync-path=/usr/local/bin/rsync --progress /interfaces d1pr0001:/ ;copy directory to target server
zcat file.tar.Z | tar tvf - ;- means take input from cmd being piped
gzcat file1.gz ;view files compressed with gzip
rcp myfile.txt d2pr0004:/tmp ;copy file to remote system
rcp d2pr0004:/tmp/myfile.txt myfile.txt ;copy file from remote system
ufsdump 0uf /dev/rmt/0 /export/home ;full backup to tape device
ufsdump 0uf host2:/dev/rmt/0 /export/home ;uses tape device on remote host
ufsdump 0S /export/home ;determine full system backup size
ufsrestore rf /dev/rmt/0 ;restore entire file system
ufsrestore ivf /dev/rmt/0 ;i interactive restore
mt status ;status of magnetic tape
mt rewind ;rewind tape
mt offline ;rewind and unload tape
mt fsf ;forward skips count tape files
mt -f /dev/rmt/0n fsf 1 ;positions tape to beginning of the second tar record
mt -f /dev/rmt/0 offline ;rewinds and takes tape offline