# this file contains all useful commands
-------------------------------------------------------------------------------------------
UNIX
-------- System Information --------
# zcat santoolkit_solaris_sparc_3.4.tar.Z | tar -xvf - (SPARC processor systems)
# zcat santoolkit_solaris_amd_3.4.tar.Z | tar -xvf - (x86/x64 procssor systems)
# cat sxrt5.0MP1.dvd1.tar.gzaa sxrt5.0MP1.dvd1.tar.gzab > sxrt5.0MP1.dvd1.tar.gz
# /usr/sbin/shutdown -y -i6 -g0
find / -type d -size +5000k -print
find / -type d -size +10000k -print
restricted-uid *
/usr/lib/acct/fwtmp <> /var/adm/wmtpx.new
PUTTY
HKEY_CURRENT_USER\Software\SimonTatham\PuTTY
sc> showplatform
#
cat sol-9-905hw-ga-sparc-dvd-iso-? > sol-9-ga-sparc-dvd.iso
explorer -w default
CAPTURE SCREEN DISPLAY
$ xwd >filename.xwd - to capture screen
$ xwud -in filename.xwd - to view the captured screen
DISK MIRRORING (METADEVICE)
SOLUTION:
RE-STABLISH A MIRROR ON THE SAME DISK
metareplace -e d5 c0t0d0s5
inetadm -m ftp tcp_wrappers=FALSE
/usr/lib/netsvc/yp/rpc.yppasswdd -D /var/yp/etc
PS1="`hostname`: "
PS1="`hostname`{`logname`}: "
UID=`id -u`
case $UID in
0) PS1S='# ';;
esac
PS1S=${PS1S:-'$ '}
HOSTNAME=${HOSTNAME:-`uname -n`}
HOST=${HOSTNAME%%.*}
# Set prompt
PS1='$USER@$HOST:${PWD##*/}$PS1S'
.profile
PATH=/usr/bin:/usr/ucb:/usr/local/bin:. # set the PATH
export PATH # so that PATH is available to subshells
# Set a prompt
PS1="{\Qhostname\Q \Qwhoami\Q} " # set the prompt, default is "#"
# functions
ls() { /usr/bin/ls -sbF "$@";}
ll() { ls -al "$@";}
# Set the terminal type
stty erase ^H # set Control-H to be the erase key
eval \Qtset -Q -s -m ':?xterm'\Q # prompt for the terminal type, assume xterm
#
stty erase \^h
who am i | cut -f2 -d"(" | cut -f1 -d")"
HOW TO:
# ufsdump 0f - /dev/md/rdsk/d6 | ufsrestore rf -
chmod u+sx /usr/local/bin/fping
SSH
if [ ! -d .ssh ]; then mkdir .ssh ; chmod 700 .ssh ; fi
cd .ssh ; if [ ! -f authorized_keys ]; then touch authorized_keys ; chmod 600 authorized_keys ; fi ; cd ..
-
CRYPT
crypt swordfish <> salaries.encrypted <-- encrypt
crypt swordfish <> new_salaries <-- decrypt
###########################
find . -name '*.*.Z' -exec mv {} /net/sb3/export/home/XLCHART/home/stdf_archive/ac20 \;
find . -name '*.stdf.Z' -mtime +180 -exec mv {} /net/sb3/export/home/XLCHART/home/data_archive/ac15 \;
find . -name '*.stdf' -mtime +7 -exec compress -f {} \;
find 2007-*/nec -name '*ETS*_07*2007*' -exec cp -p {} /ics_restored/nec/july \;
scp /temp/sg.conf 10.199.9.86:/temp/
scp -r /archive_vol02 10.160.2.110:/backup/vol02/
scp -r /archive_vol01 10.160.2.110:/backup/vol01/
set -o vi
# NIS group MAX
set ngroups_max=32
# getconf NGROUPS_MAX
/usr/lib/netsvc/yp/ypserv -d
change SYSTEM config
#mdb -kw
#rstchown/D
#rstchown/W 0
# ngroups_max/W 20 ---> set to 32
# ngroups_max/W 10 ---> set to 16
> ngroups_max/D
### kernel version ###
64% isainfo -kv
64-bit sparcv9 kernel modules
32% isainfo -kv
32-bit sparc kernel modules
amd64% isainfo -kv
64-bit amd64 kernel modules
MONITORING
vmstat 5
iostat -xtc 5 2
iostat -xcnCXTdz 10
NFS otions
ORACLE rw,hard,bg,nointr,rsize=32768,wsize=32768,noac,proto=tcp,forcedirectio,vers=3
nfs-server01:/votedisk - /voting_disk nfs - yes rw,hard,bg,nointr,rsize=32768,wsize=32768,noac,proto=tcp,forcedirectio,vers=3
SENDMAIL
/usr/lib/mail/sh/check-hostname
# svcadm refresh sendmail
# svcadm restart sendmail
# svcadm restart network/physical
# svcadm enable -r nfs/client
# svcs -l nfs/client
svccfg -v import cswapache2.xml
svccfg -s sendmail listprop
svccfg -s sendmail setprop config/local_only = false
/usr/sbin/smcwebserver start -> Start Web Console
https://hostname.domain:6789
gunzip -c foo.tar.gz | tar xvf -
or
gunzip < foo.tar.gz | tar xvf -
tar cvf - foodir | gzip > foo.tar.gz
# mount -F hsfs /dev/dsk/c2t0d0s0 /cdrom
webmin
/usr/sfw/lib/webmin/setup.sh
prtconf
prtdiag
prtfru
psrinfo
showrev
cfgadm -al
#
.
lofiadm -a /path/to/cd.iso
/dev/lofi/1 <-- output
mount -o ro -F hsfs /dev/lofi/1 /mnt
umount /mnt
lofiadm -d /dev/lofi/1 <-- remove block device
ALOM
# scadm
scadm - COMMAND DETAILS
scadm help => this message
scadm date [-s] | [[mmdd]HHMM | mmddHHMM[cc]yy][.SS] => print or set date
scadm set
=> set variable to value
scadm show [variable] => show variable(s)
scadm resetrsc [-s] => reset SC (-s soft reset)
scadm download [boot] => program firmware or [boot] monitor
scadm send_event [-c] "message" => send message as event (-c CRITICAL)
scadm modem_setup => connect to modem port
scadm useradd => add SC user account
scadm userdel => delete SC user account
scadm usershow [username] => show user details
scadm userpassword => set user password
scadm userperm [cuar] => set user permissions
scadm shownetwork => show network configuration
scadm loghistory => show SC event log
scadm version [-v] => show SC version (-v verbose)
--> HBA
CONFIGURE TAPE:
cfgadm -c configure c3
cfgadm -o show_FCP_dev -al
cfgadm -o show_SCSI_LUN -al
cfgadm -o unusable_FCP_dev -c unconfigure c3::500104f0008aa432
cfgadm -c unconfigure c3::500104f0008aa531
cfgadm -alo show_FCP_dev
luxadm -e port >>To show link status of card
luxadm -e forcelip
luxadm -e forcelip /dev/cfg/c3
luxadm -e dump_map /dev/cfg/c3FCAL Disks
luxadm probe (discovers fcal)
luxadm display Enclosure (displays information on fcal box)
luxadm reserve /dev/rdsk/c#t#d#s# (reserves device so it can’t be accessed)
luxadm -e offline /dev/rdsk/c#t#d#s# (takes a device offline)
luxadm -e bus_quiesce /dev/rdsk/c#t#d#s# (quiesce the bus)
luxadm -e bus_unquiesce /dev/rdsk/c#t#d#s# (unquiesce the bus)
luxadm -e online /dev/rdsk/c#t#d#s# (bring the disk device back online)
luxadm release /dev/rdsk/c#t#d#s# (unreserved the device for use)
luxadm remove_device BAD,f2 (removes a device from slot f2 on enclosure BAD)
luxadm insert_device BAD,f2 (hot plug a new device to slot f2 on enclosure BAD)
fcinfo hba-port
devfsadm -C
# luxadm probe
# prtconf -vp | grep wwn
# prtconf -vp | more
# luxadm -e port
# luxadm fcode_download -p >>show all vendor HBA’s
# luxadm qlgc >>show Sun/Qlogic HBA’s
—
cfgadm -c unconfigure
cfgadm -al -o show_FCP_dev
devfsadm -C
CHECK FROM VERITAS:
/usr/openv/volmgr/bin/scan
/usr/openv/volmgr/bin/sgscan
/usr/openv/volmgr/bin/tpautoconf -report_disc
CONFIGURE STORAGE:
# luxadm probe
# luxadm display controller_number
# luxadm display enclosure_name
# luxadm display logical_path
# luxadm display enclosure_name, disk_location
# luxadm fcode_download -p
GET SERIAL NUMBER
sc> showplatform
sneep -v
#/usr/platform/platform/sbin
# uname -i
ex: atpftp02{msuma}: pwd
/usr/platform/SUNW,Sun-Fire-V240/sbin
atpftp02{msuma}: uname -i
SUNW,Sun-Fire-V210
svccfg export samba > samba.xml
/usr/sfw/bin/smbpasswd -a username
ALOM +++
Server Type Management Port Type Telnet Login Telnet Password
Netra 240 and 440 ALOM admin admin
Sun Fire V210, V240, and V440 ALOM admin admin
Sun Fire V490, V890 RSC admin n1smadmin
Sun Fire T1000 and T2000 ALOM admin admin
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
SSH login sSH Password IPMI Login IPMI Password SNMP
Sun Fire V20z and V40z SP admin admin admin public
Sun Fire X2100 SP Admin admin
Sun Fire X4100 and X4200 ILOM root changeme root changeme
TRUNKING
/etc/opt/SUNWconn/bin/nettr -setup 0 device=ce members=0,1
USER LIST
pwconv - update passwd and shadow
cat /etc/passwd | cut -d: -f1 - view user name list
`ps -ef | grep proftpd | awk '{print $2}'`
/usr/bin/showrev -p - view patch installed
RSC
/usr/platform/`uname -i`/rsc/
ok
diag-console rsc
setenv input-device rsc-console
setenv output-device rsc-console
diag-console ttya
setenv input-device keyboard
setenv output-device screen
SU
su - hobbit -c "/usr/local/hobbit/client/runclient.sh start"
++++++++++++++++++
# format mutiple disk
###
# for i in 1 2 3 5
> do
> prtvtoc /dev/rdsk/c2t0d0s0 | fmthard -s - /dev/rdsk/c2t${i}d0s2
> done
++++++++++++++++++
to rename zone:
edit /etc/zones/zonename.xml to new zonename
edit /etc/zones/zonename.xml file and change zone name to new zone name, change ip address to new ip add
edit /etc/zones/index and change old zone name to new zone name.
to shutdown zone:
#zoneadm -z halt
to startup zone:
#zoneadm -z boot
to restart zone:
#zoneadm -z restart
to login to zone:
#zlogin
to check status of zones:
#zoneadm list -cv
to create zone:
#zonecfg -z
zonecfg -z atpesbsp02 set pool=atpesbsp02
pooladm -s /var/tmp/pooladm.conf
poolcfg -c 'create pool chazapp01 ( string pool.scheduler = "FSS" )'
poolcfg -c 'create pset chazapp01 (uint pset.min = 8; uint pset.max = 8)'
poolcfg -c 'associate pool chazdbp01 (pset chazdbp01)'
poolcfg -c 'associate pool chazapp01 (pset chazapp01)'
pooladm -c
pooladm
poolstat 1
zonecfg -z zone1 info --> view zone information
find / -type d -size +5000k -print
find / -type d -size +10000k -print
find /var -size +1000 -ls
find / -mount -type f -size +100 -ls | more
usermod -s /usr/lib/ssh/sftp-server atpadmin -> sftp shell
DISK SPACE
du -sk * - to check who (users) is hogging up all disk space
df -sk . - to check for capacities/availability of disk spaces
df -kl - diplay storage space
OK PROMPT
setenv - to setenv at OK prompt
printenv - to show the env at the OK prompt
watch-net - command issue at OK prompt to watch network
reset all - resetting configuration
probe-scsi-all - probe for scsi devices
stop a on win keyboard - ctrl break
SYSTEM UTILS
/usr/sbin/sys-unconfig - to unconfig the system
boot -- -r - to boot and reconfigure system at the command prompt
boot -s - boot into single user mode
/usr/sbin/reboot - reboot system
-d dump system core file before reboot
-l supress error message
-n avoid sync operation
halt - log in as root and type halt to go to OK prompt
/usr/platform/sun4U/sbin/prtdiag -v - diag of system cpu, memory
strings -o core - display strings in a core file
pkgadd -d file - package installation/removal
pkgrm file
pkgadd -d /mnt2 SUNW.. (if adding from CDROM)
patchadd dir - patch installation
/user/sbin/shutdown - system shutdown
-y
-g grace period
-l limit-state
-s single user
-o kill it
-b reboot
shutdown -r now
shutdown -y -i6 -go
chown user:student file - changing owner of a file/dir
chgrp student file - changing group ownership
chmod 755 file - change promission
newfs - constructing a new ufs file system
newfs /dev/dsk/d0t0s0
fsck -F ufs disk - check and repair a dir
fsck -y (fixes all disk)
kill -HUP - restart a process
vfstab (/etc/vfstab) - display mount disk on computer
sync - clear buffer before rebooting
format - formatting a drive
format> p (patition)
format> p (print)
create your patition assign the correct tag, flag, size
format> name (n=name "use me")
format> label
format> quit
newfs /dev/md/dsk/d0
use metatool to create meta devices /usr/opt/SUNWmd/sbin/metatool
showrev -p - patch info on unix
/usr/platform/sun4u/sbin/prtdiag - Sun part diag
MEMORY CHECK
/usr/openwin/bin/wsinfo - to check for amount of memories on machine
cd /platfrom - to change the default memory from 32-bits to 64-bits
vi ./sun4u/boot.conf
VIDEO DISPLAY
/usr/openwin/bin/resize - resize window settings
/usr/openwin/bin/xterm - lanuch xterm
x86
/usr/sbin/kdmconfig -res \? - to configure monitor's resolution (x86 platform)
/usr/sbin/kdmconfig -res \"DISPLAY VALUE"
reboot system
Sun Ultra5
/usr/sbin/M64config -res \? - to configure monitor's resolution (sparc platform)
/usr/sbin/M64config -res \"DISPLAY VALUE"
reboot system
sparc 5
#!/bin/sh
eeprom fcode-debug\?=true
eeprom nvramrc='probe-all
install-console
banner
: vsetup " 135000000,81128,76,32,64,288,1280,2,8,32,1024,COLOR,0OFFSET" ;
vsetup 4
" /sbus/cgsix@2" " override" execute-device-method drop
'
eeprom use-nvramrc\?=true
PRINTING
/usr/ucb/lprm # - removal of print job
/usr/bin/lp file - printing
/usr/ucb/lpq - display the printing queue
Setting up Printer on Unix
/usr/sbin/lpadmin -p printername -s servername
/usr/sbin/lpadmin -d printername (set default)
/usr/sbin/lpadmin -x printername (delete printer)
lpq -p printername (display printer queue)
HOSTNAME
edit /etc/nodename - to change hostname on unix machines
/etc/hosts
/etc/hostname.hme0
/etc/net/(all 3 dir)/hosts
NETWORKING (DNS, NIS, NIS+)
/etc/nsswitch.conf - to convert standalone machines to networked machine
(NIS) cp /etc/nsswitch.nis /etc/nsswitch.conf
hosts: dns files nis
NIS/YP
/usr/bin/ypwhich - show you which NIS server you are bound to
/usr/bin/ypcat - to display a NIS map
-k - option will display more information on a certain map
/usr/bin/ypinit - command that will initaize yp
-c - option that will setup a NIS client
-s - option that will setup a NIS slave
-m - option that will setup a NIS master
/usr/lib/netsvc/yp/ypstart - start yp services
/usr/lib/netsvc/yp/ypstop - stop yp services
/usr/lib/netsvc/yp - dir that contains the yp commands (ypbind, ypserv, ...)
/var/yp - dir that contains NIS related informations
(maps, binding, ...)
To setup NIS/YP
First make sure there is a Makefile in /var/yp. If you are using DNS with NIS, please comment the Makefile
#B=-b --> B=-b
B --> #B
Second set the Domainname
domainname example
domainname > /etc/defaultdomain
Third copy the nsswitch.nis file to nsswitch.conf and then edit the hosts field.
cp /etc/nsswitch.nis /etc/nisswitch.conf
vi /etc/nsswitch.conf
hosts: files dns nis
Make sure there is a resolv.conf in /etc for dns to work correctly
Run the ypinit -m command to setup the master. Once the ypinit command is run, start ypbind, ypserv, ypxfrd
Easier to run ypstart
Removing NIS
rm -r /var/yp/binding/domainname
rm /etc/defaultdomain
cp /etc/nsswitch.files /etc/nsswitch.conf
Secure NIS
Create a sercurenets files in /var/yp (/var/yp/securenets) The file follow as netmask address.
255.255.0.0 10.101.0.0
everyone in the 10.101.0.0 network can access the network
Creating Nis Accounts by hand
Get the last use userid
niscat passwd.org_dir
edit /etc/passwd /etc/shadow
/etc/passwd
user:x:uid:group:fullname:userdir:shell
foo:x:100:10:foo boy:/home/foo:/bin/sh
/etc/shadow
foo:::::::: (userid and 8 colon after it)
Create a password for the user
passwd foo
Run nispopulate to populate /etc/passwd and /etc/shadow
/usr/lib/nis/nispopulate -F passwd
/usr/lib/nis/nispopulate -F shadow
Make a new dir for the user
mkdir /home/foo
chown foo:staff /home/foo
Creatung Nis Accounts by useradd
useradd -md
useradd -u 20199 -g10 -s /bin/bash -c "war machine" war
yppasswd war
Creating Nis Slave
NIS# cd /var/yp/domain.com
NIS# makedbm -U ypservers > /tmp/ypservers
NIS# vi /tmp/ypservers
NIS# makedbm /tmp/ypservers ypservers
NIS# ypcat -k ypservers
Slave# ypinit -s master ip address
Slave# ypserv
Make sure all master & slave ip are located in hosts.
Make sure slave has access in securenets. If everything else fails restart ypserver on the master
/usr/ccs/bin/make
/usr/lib/netsvc/yp/ypstart
ypinit -c - nis client
edit /etc/hosts
/etc/defaultdomain
NIS UPDATE
hosts - make sure nis master is in /etc/hosts
domainname - make sure you have the right domain
defautldomain - make the right domian is in defaultdomain
nsswitch.conf - make sure you are using the right conf file
hosts - files dns nis
/var/yp/make - update nis database
(STANDALONE) cp /etc/nsswitch.files /etc/nsswitch.conf
hosts: dns files
(NIS+) cp /etc/nsswitch.nisplus /etc/nsswitch.conf
hosts: dns files nisplus
/etc/resolv.conf - name resulutions
search lab.epicentric.com
nameserver 10.253.254.2
nameserver 10.253.254.9
/etc/netmasks - netmask of machine
10.253.0.0 255.255.0.0
/etc/defaultdomain - domain of machine set when machine startsup
lab.epicentric.com
/etc/defaultrouter - default routing information set when machine startup
10.253.0.1
/etc/hosts - ip of machine
#
# Internet host table
#
127.0.0.1 localhost loghost
10.253.30.x sunx sunx.lab.epicentric.com
/etc/hostname.hmeo - name of machine
sunx
/etc/nodename - name of machine when you log on
sunx
netstat -rn - display routing table
netstat -a - display all open ports and connection info
route add default - gateway entry without rebooting
date 08300830 - to change the date on unix system
date
rdate tick.usno.navy.mil - to change/sync date with other unix systems
nisgrpadm - add new user to NIS admin group
visudo - editing sudo file
nisgrpadm -l - deplaying the list of admin
/etc/init.d/nfs.clients - to restart nfs clients
rsync - rsync -avz host:nodename destdir
rc directory under /etc/rc*
rc1.d - killing process
rc2.d - starting process
rc3.d - network process
Recreating nis+ credentials
nisaddcred -r user.example.com.
nisaddcred -p 1302 -p user.example.com.local
nisaddcred -p unix.1302@example.com -p user.example.com des
Setting up network cards on unix
ifconfig etho plumb
ifconfig eth0
ifconfig eth0 inet 192.168.1.186 netmasks 255.255.0.0 up
route add default gw 192.168.1.1
route add default 192.168.1.1
Cron jobs
/var/spool/cron/crontabs
/usr/sbin/cron
/etc/cron.d
minute(0-59)
hour(0-23)
day of the month(1-31)
month of hte year(1-12)
day of the week(0-6 0-sun)
crontab -e edit
-i list
SYSTEM MISC...
vi /etc/default/login - to allow remote login
comment out console=/dev/console
setenv DISPLAY machine:0.0 - setting display
/usr/openwin/bin/xhost + machine
/usr/openwin/bin/xterm
xhost + - to enable access control from remote system
xhost - - to disable access control from remote system
/usr/openwin/bin/dtpower - to remove automate power shutdown of UNIX systems
uname -a - display information about the machine
SunOS templar 5.8 Generic_108528-03 sun4u sparc SUNW,Ultra-5_10
ps -edaf - display all processes on a machine
ps -ef | grep root - display all processes on a machine that is own by root
ps -edaf| grep -v root - display all process minus root
PSI="[\u@\h]\W#" - setup prompt
/usr/bin/mesg -n/y - turn message on/off
motd - message of the day /etc/motd
set $EDITOR=vi - setting vi as default editor
set file - file completion for csh shell
set term=VT100 - fixing pico problem /editing in command line
mount - mount a drive
mount templar:/export/home /export/home
umount - unmount a drive
umount /export/home
umountall - unmount all map drives
sysdef - to list all hardware devices (pseudo and system devices
and, loadable modules and kernal tunable parameters)
arp - address resolution display and control
arp macaddress IP
-a list all phyiscal address
-d delete
-s hostname ether address
nmap probe all machines for service concurrently running on vishnu, lipstic
nmap-sS -O FP namp-O -p7 209.185.111.*
Mail problems
telnet host 25 (sendmail port)
vrty login (verify user)
control D to end telnet session
Solstice - account generation on Solaris
username, user id, primary group, comment (real name), shell, normal passwd
path, cred table setup, mail server, server
Back up on Unix tape drive
mt - mount tape
mt -f /dev/rmt/0 - rewind
mt -f /dev/rmt/0n fsf1 - fast forward
mt -f /dev/rmt/0n fsf2 - fast forward 2 archive
ufsrestore -lf /dev/rmt/0n 0 root
1 var
2 users
ufsrestore> add filename
extract
1
Setting up a machine for full duplexing
(if using /etc/rc2.d/S99...)
ndd -set /dev/hme instance 0
ndd -set /dev/hme adv_100T4_cap 0
ndd -set /dev/hme adv_100fdx_cap 1
ndd -set /dev/hme adv_100hdx_cap 0
ndd -set /dev/hme adv_10fdx_cap 0
ndd -set /dev/hme adv_10hdx_cap 0
ndd -set /dev/hme adv_autoneg_cap 0
ndd -get /dev/tcp ip_forwarding
or (if using /etc/system)
set hme:hme_adv_autoneg_cap=0
set hme:hme_adv_100T4_cap=0
set hme:hme_adv_100fdx_cap=1
set hme:hme_adv_100hdx_cap=0
set hme:hme_adv_10fdx_cap=0
set hme:hme_adv_1-hdx_cap=0
to see what the speed of your ether card is
ndd -get /dev/hme link_status
ndd -get /dev/hme link_speed
ndd -get /dev/hme link_mode
netstat -na | grep 389 - finding an open port on Solaris
Legato Networker
nwadmin -- administrator program
nwbackup -- networker backup program
nwrecover -- networker recover program
nwarchive -- networker archive program
nwretrieve -- retrieval program
RECONFIGURING DEVICES
# touch /reconfigure
# init 5
ADDING DISK
# devfsadm -c disk
RELABELING A DISK
# prtvtoc /dev/rdsk/c1t0d0s2 > /vtoc/c1t0d0 - copy the partition label of c1t0d0s2 to /vtoc/c1tod0 file
# fmthard -s /vtoc/c1t0d0 /dev/rdsk/c1t0d0s2 - partition the c1t0d0s2 drive using /vt0c/c1t0d0 file
MOUNTING DISK PARTITION
/etc/vfstab
# mountall - mount all local file system listed in /etc/vfstab
# mountall -l
DIRECTORY LOCATION
MEDIA ACCESS FILE SYSTEM ON ACCESS RAW DEVICE
First diskette drive /floppy/floppy0 /vol/dev/aliases/floppy0
First CD-ROM or DVD /cdrom/cdrom0 /vol/dev/aliases/cdrom0
First Jaz drive /rmdisk/jaz0 /vol/dev/aliases/jaz0
First Zip drive /rmdrive/zip0 /vol/dev/aliases/zip0
First PCMCIA card /pcmem0 /vol/dev/aliases/pcmem0
VOLUME MANAGEMENT
# /etc/init.d/volmgt stop - stop the volume management
# /etc/init.d/volmgt start - start the volume management
# ok prompt
boot - boot the system
boot -s - boot system in single mode
boot cdrom -s - boot system in cdrom with single mode
printenv - display all parameters' current and default values
setenv - set the specified NVRAM parameter to some value
reset-all - reset the entire system; similar to a power cycle
set-defaults - reset all parameter values to the factory defaults
probe-ide - identifies devices on the IDE
probe-scsi - identifies device on the SCSI
probe-scsi-all - identifies devices on all SCSI buses
probe-fcal-all - identifies devices on all fibre channel loops
.version - display the version and the date of the boot prom
probe-pci - probe all devices on a specific PCI bus
probe-pci-slot - probes a specfic PCI slots on a specific pci bus
.speed - display the speed of the processor andthe busses attached to the system
ok setenv boot-device disk
# eeprom boot-device
# eeprom boot-device=disk2
to change the value of the auto-boot? parameters
# eeprom auto-boot?=true
eeprom local-mac-address?=true
USER INITIZLIZATION FILES
SHELL SYSTEM-WIDE PRIMARY USER INIT. USER INIT. FILES READ SHELL PATH
INITIALIZATION FILES READ AT LOGIN WHEN A NEW SHELL IS START NAME
Bourne /etc/profile $HOME/.profile /bin/sh
Korn /etc/profile $HOME/.profile $HOME/.kshrc /bin/ksh
$HOME/.kshrc
C /etc/.login $HOME/.login
$HOME/.cshrc $HOME/.cshrc /bin/csh
template:
/etc/skel
local.cshrc
local.profile
local.login
FTP USERS
/etc/ftpd/ftpusers - file list the names of user who are prohibited from connecting to the system through FTP
BOOT PROCESS DIRECTORY
/sbin Directory
|-rc0
|--rc1
|---rc2
|----rc3
|-----rc5
|------rc6
|-------rcS
/etc/rc#.d directories
* directories contain additional scripts that start and stop the system process for that run level
/root
|-etc
|-rc0.d
|-rcS.d
|-rc1.d
|-rc2.d
|-rc3.d
/etc/init.d directory
* run control scripts are located in the /etc/init.d
/root
|
etc
|-init.d
System files that stores user account information
/etc/passwd
/etc/shadow
/etc/group
command-line-tools
useradd - add a new users
# useradd -u 100 -g other -d /export/home/user1 -m -s /bin/ksh -c "regular user" user1
usermod - modifies a user account
# usermod -m -d /export/home/usera -l usera newuser1
# useradd -G admins,ftp,www,developers jerry
userdel - deletes a user account
groupadd - add a new group entry
# groupadd -g 301 class
groupmod - modifies a group entry
# groupmod -g 400 class
groupdel - delete a group
# groupdel class
/var/adm/wtmpx - login records
whoami - display the login name
who am i - display the original user
/etc/default/login
#console=/dev/console - enable root login
console=/dev/console - disable root login
# /usr/sadm/admin/bin/printmgr& - start solaris print manager
# /etc/lp/printers/printername/configuration - configuration file of the printer
vi /etc/lp/interface/printer_name - disable printer banner
nobanner="no" to nobanner="yes"
# lpadmin -x printername - delete printername from the system
# /usr/lib/lpsched - starting lpsched daemon
# /etc/init.d/lp start
# lpstat -t - check the status of the printer
# enable printername - enable printer printername
# disable -W -r "printer under maintenance" printername - disable printing on printername
# stdprocess& - viewing standard process
# prstat - display information about active process on the system
#/usr/lib/lpshut - stopping printing services
#/etc/init.d/lp stop
# /usr/ucb/lpr -P printername filename - print using LP command
CPU PROCESS
# prtstat - display information about active processes on the system
- type q to quit the prtstat
# pgrep -l mail - view the process Id of mail services
# pkill -9 mail - killing the frozen login
COMMON PROBLEM
Cannot open '/etc/path_to_inst
OK > boot -ar
The /etc/path_to_inst on your system does not exist or is empty. Do you want to
rebuild this file [n]? y
-------- Text Editing --------
cd ~/rt/bin/ - merge 1 message into another message using rt
rt -help # gives a list of all helpful hints
rt -merge <1st> <2nd>
SHFT ZZ - to save and quit from vi
:wq
CTRL zz
-------- FILE OPERATIONS --------
uncompress - to uncompress files (*.Z)
compress - to compress file
mv file-old file-new - to move oldfile to newfile
cp file-old file-new - to copy oldfile to newfile
scp path-of-file destina tion - to secure copy
scp /export/home/jhui/file /usr/local/
unix2dos orgfile newfile - to convert text file from ISO format to DOS format
file filename - display information on a file
tar - taring a file
-xvf (extract file)
-cvf (compress file)
-tvf (show tables of content of file
-uvf (append to tar file)
tar --c tarfile (if a file begins with -)
zip
-v - verify
-g - append
ln - creating a link to a file or dir
ln -s /opt/Java/bin/java java
wc - count the number of lines, words, chars in a file
wc -l file - count line in file
scp - secure copy a file from one server to another
scp file jhui@host:/usr/local
-------------------------------------------------------------------------------------------
NT/2000
winipcfg - renewal of IP address in 95/98
ipconfig /all /release /renew - renewal of IP address in NT/2000
netsat -n - NetBT stats
net use z: \\drive\c$
net use z: \\drive\c$ /d - disconnect drive
net use z: \\drive\username pwsd /USER:\jhui
cls - clear
type - move
edit - edit
command - dos prompt (9x/ME)
Here's the string to configure a system to be the Preferred Master Browser.
\HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Browser\Parameters
Set the parameter IsDomainMasterBrowser to True or Yes. When a Preferred Master
Browser system boots it forces a vrowser election and all things else being equal
assumes the Master Browser role.
DNS for windows
winnt\system32\drivers\etc\hosts
JRUN
Starting/Stopping jrun from command line
jrun -jrundir c:\jrun -stop efb_12
jrun -jrundir c:\jrun -start efb_12
Startup Tray
mycomputer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
-------------------------------------------------------------------------------------------
DATABASES
Sybase
To dump the transaction try with no_log option as below:
dump tran master with no_log
go
If it fails
alter database master on master = 2
go
Truncate the log using the following command.
dump tran master with truncate_only
go
If any activities are going on, the log won't be truncated.
In that case you have to increase the logsegment of the master database with the following command.
sp_extendsegment "logsegment", master, d_master=2
go
scjview = java gnu interface for sybase
ORACLE
svrmgrl - server manager
lsnrctl - oracle listener
start/stop - starting and stopping listener
lsnrctl start listener
lsnrctl stop listener
sqlplus - sql
svrmgrl
svrmgrl> connect internal
svrmgrl> startup
svrmgrl> create user fooboy identified by fooboy;
svrmgrl> grant connect,resource to fooboy;
svrmgrl> quit
svrmgrl> drop user fooboy cascade;
svrmgrl> alter fooboy identified by fooboy;
svrmgrl> shutdown immediate
svrmgrl> shutdown abort
create tablespace fooboy datafile '/opt/Databases/Oracle/oradata/oradb817/fooboy.dbf' size 200m reuse autoextend on next 5k;
create user ejb identified by ejb default tablespace efs40;
SQLDBA> select userenv('LANGUAGE') "Language" from dual;
Importing and Exporting Oracle DB
exp owner=fooboy file=fooboy.dmp log=fooboy.log
imp full=y file=fooboy.dmp log=fooboy.log
imp file=fooboy.dmp fromuser=old touser=new log=fooboy.log
DB2
If you ever run into a heap size problem with DB2 You can refer to this for help.
example of a problem:
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0954C
Not enough storage is available in the application heap to process the statement. SQLSTATE=5701
Solution to problem:
I believe you can correct this error by tweaking one or more DB2 parameters.
Go into the Control Center DB2 admin console, right click on the database,
choose "Configure", click on the "Performance" tab, and try to increase some
of the "heap size" parameters. Also, make sure you're using the Type 2
COM.ibm.db2.jdbc.app.DB2Driver and not the Type 4
COM.ibm.db2.jdbc.net.DB2Driver We don't support the Type 4 driver
because it's very flaky and unstable.
The reason of the failure or message is shown since DB2 7.1 was not supported until
release of 3.5.1 but there is way you can disable the install verfication but then
you have to know all prerequist satisfied. You still need to apply the Fix pack for
DB2 7.1 and it is available at this url and the latest fo is 3.5.3
http://www-4.ibm.com/software/webservers/appserv/efix.html
Here is that option to disable the warning or error mesage in case if your installation
was not complete
1.Copy the prereq.properties file from /cdrom to /tmp
2.Edit the /tmp/prereq.properties file, and change
prereq_checker=0
3.to install, use the following command line:
install.sh /prereqfile /tmp/prereq.properties
4.Verify later admin.config file in the websphere\appserver\bin directory for the
following varialbles are correct:
dbuser,
dbpassword,
dbUrl,
dbDriver=COM.ibm.db2.jdbc.app.DB2Driver,
and jdbc dirver (db2java.zip) path is correct on the classpath.
Setting up for remote connect:
------------------------------
On the server:
* Add to /etc/services (given that you want TCP/IP support for the
instance):
db2cdb2inst1 50000/tcp # Connection port for DB2 instance db2inst1
db2idb2inst1 50001/tcp # Interrupt port for DB2 instance db2inst1
* Add TCP/IP support to the instance:
db2 update dbm cfg using svcename db2cdb2inst1
db2set -i db2inst1 db2comm=tcpip
db2 terminate"
On the client:
db2 catalog tcpip node [remoteservernamealias] remote [remoteservername] server 50000
db2 catalog db portal as [dbalias] at node [remoteservernamealias].
Troubleshooting on client:
db2 list db directory
db2 list node directory
#start the db2 admin server
db2admin start
#start the db2 instance
db2start
#create the portal database
echo "Creating the portal database..."
db2 create database portal
#create the was database
echo "Creating the WAS database for WebSphere..."
db2 create database was
#bump up the heap sizes
db2 update db config for portal using applheapsz 256
db2 update db config for was using applheapsz 256
#Connect to database and grant priviledges to portal user (Note: portal is a NIS account)
db2 connect to portal
db2 'grant createtab,connect on database to user portal'
-------------------------------------------------------------------------------------------
ERRORS
SOLARIS
If you log on to the console and the machien kicks your out. Check users quota
Machine with more than 4GB ram wil not boot remove some ram and try again
NO_MORE_SYSTEM_PTES
If a computer name is pointing to a different name then the machine itself check
/etc/nodename
/etc/hostname.hme0
/etc/host
/etc/net/*
NT LAPTOP
If you get a HOTKEY error
Local_Machine\Software\Microsoft\Windows\Current\Run\Hot Keys
NT
If you install IDE drive on an all scsi computer and bio and everything reconize the drive
but it does nto show up in my computer go to SCSI adapters adn add IDE CD-ROM(ATAPI1.2)
Dual-Channel PCIIDE controller
If system gives blue screen and will not boot, hold down F1 until setup screen comes up
set machien to factory default
If you are creating a new x start seesion with exceed and you have trouble displaying a window
telnet window
userid host
passwd unix
/usr/openwin/bin/xterm DISPLAY @d
-------------------------------------------------------------------------------------------
MISC
APACHE
./configure --prefix=/usr/local/apache --enable-shared=max
make
make install
Meta Refresh
META HTTP-EQUIV="Refresh" CONTENT="0;URL=index.jsp"
MYSQL
adding user in mysql
insert into user values('localhost', 'user', 'password(pass)','y',....'y'):
There are 14 permission to grant to user
Select_priv tables Performs operation on rows in existing tables
Insert_priv tables
Update_priv tables
Delete_priv tables
Index_priv tables create or drop index
Alter_priv tables alter tables
Create_priv tables creat a new DB tables
Drop_priv tables Drop a Db table * special note
Grant_priv tables grant other pervileges to you DB
Reference_priv tables
Reload_priv tables reload
Shutdown_priv tables shutdown
Processes_priv tables kill
File_priv tables privilege to read/write files
connection to mysql
mysql -u username -p
grant select,insert,update,delete,create on datbase to username identified by "password"
SQLPLUS
select * from all_users - display all user in Database
select * from v$version; - display version of oracle you are using
Installatin Of NT
Setup NT on intel x86 box. Create a small Fat parition for backup purpose use mainly NTFS.
Install NT using boot disk & CDROM. Make sure to perfoem surface scan on hardware before
installation of NT.
Primary Domain Controllers
NT server that maintains the accounts information for a domain. You will need to have
one PDC per domain to user for modification.
Backup Domain Controllers
Has the same characteristics as PDC except you can not modify account information
Stand Alone Server
Has own list of user accounts & does not share informations with other servers
NT Domain Controllers
A NT server that maintains a centralized list of user accounts
NT Domain
group of computers that has access to user informations
Backup
Full - normal
Copy - monthly archieve
Incremental - change since last
Differential - different schedule
Perform increamental & differential backup on nightly base and preform full backup
on weekends
NT File Permissions
Read - view the file
Write - modify the file
Execute - execution
Delete - deletion of file
Change Perm - Modify ACL
Take Ownership - Become owner of file
SOLARIS
Gear - software for unix burner
As root start gear
# GEAR mins FSTYPE
GEAR> NEWVOL file 74 ISO
GEAR> cp -r /tmp/foo/* .
GEAR> WRITECD (answer 'N' to changes)
SELVOL - select a volume
Fixing automounting of CDROM
edit /etc/vold.conf
Creating a Samba Server
root@atptestnis01 # svcs -a | grep samba
disabled Apr_23 svc:/site/samba:default
online Apr_23 svc:/network/samba:default
/etc/sfw/bin
/smbpasswd -a user1
[lscuser]
comment = lscuser
path = /export/home/lscuser
valid users = lscuser
admin users = lscuser
write list = lscuser
read only = No
Website: http://us1.samba.org/samba/samba.html
Download: http://us1.samba.org/samba/download.html
Install samba on you machine
samba will include swat (program to used to config samba)
swat uses a web interface. http://host:901
Once the program is install you must put the machine on the NT domain
all samba related command are located in that samba/bin directory
four main command need to setup samba are:
smbd - server to provide SMB/CIFS services to clients
nmbd - server to provide NetBios over IP naming service to clients
testparm - check an smb.conf configuration firl for internal correctness
smbpasswd - samba encryted password file
other command to user with samba:
smbclient - ftp-like client to access SMB/CIFS resources on servers
testprns - utility allows you to list cuurect connections to the smbd server
nmblookup - utility allows NetBIOS name queries to be made from teh UNIX machine
Starting samba
you will nee to run the smbd and bmbd daemons
/usr/local/samba/bin/smbd -D -d 0 -l /var/adm/smbd.log
/usr/local/samba/bin/nmbd -D -d 0 -l /var/adm/smbd.log
make sure smbd and nmbd is nt started by inetd. If it is you need to include the options.
smbpasswd -j DOMAIN (if exist -r NetBIOS-name)
You must edit the smb.conf file located in samba/lib for your own purpose
Using rsync
Website: http://rsync.samba.org
Download: http://rsync.samba.org/rsync/download.html
Download and install rsync on your machine
rsync should be installe don /usr/local/bin by default
Config the rsyncd.conf
rsyncd.conf is located in /etc
motd file = /etc/motd
max connections = 25
syslog facility - local3
[ftp]
path = /tmp
comment = ftp
uid = root
gid = other
read only = yes
list = yes
motd - display message to each clients on connection
log file - log all message to the file rather than syslog
pid file - write oricess if to the file
syslog facility - facility name to use when logging from the rsynce server
socket options - set socket options
module - there are many option for a module here are the main ones
comment - description of the module
path - directory in servers fiel system to make available
(option must be made in /etc/rsyncd.conf)
uid - user id to transfers to and from (default nobody)
gid - group id of transfers to and from (default nobody)
read only - set the filesystem on read only
list - make listing of directory available
To run rsync you will need to run it with a few options
rsync -avz hostname:ftp destdir
a - archive
v - verbose mode
z - compression mode
AIX
---
The command to use is: lsc
Some of the topics it gives information on are:
Processor architecture, Processor Implementation,
Processor version, CPU clock speed in MHz (approximation),
Processor width (bits), Number of CPUs, Amount of usable real memory (RAM), types and size of cache
HPUX
----
route add net 1.2.3.0 netmask 255.255.255.0 1.2.4.11 1
-------------------------------------------------------------------------------------------
Examples below are for a Solaris system.
csh(1) - in $HOME/.login
setenv DY_ROOT /usr/local/daylight/v491
set path=( $DY_ROOT/bin $path )
setenv MANPATH "$DY_ROOT/man:$MANPATH"
setenv DY_LICENSEDATA /usr/local/daylight/dy_license.dat
setenv LD_LIBRARY_PATH /opt/SUNWspro/SC2.0:$OPENWINHOME/lib:/usr/lib
setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${DY_ROOT}/lib/
sh(1) or ksh(1) - in $HOME/.profile
DY_ROOT=/usr/local/daylight/v491
PATH=$DY_ROOT/bin:$PATH
MANPATH=$DY_ROOT/man:$MANPATH
DY_LICENSEDATA=/usr/local/daylight/dy_license.dat
export DY_ROOT PATH MANPATH DY_LICENSEDATA
LD_LIBRARY_PATH =/opt/SUNWspro/SC2.0:$OPENWINHOME/lib:/usr/lib
export LD_LIBRARY_PATH
LD_LIBRARY_PATH =$LD_LIBRARY_PATH:$DY_ROOT/lib/
export LD_LIBRARY_PATH
PS1="`hostname`{`logname`}: "
|-----------------------------------------------------------------|
| This system is for the use of authorized users only. |
| Individuals using this computer system without authority, or in |
| excess of their authority, are subject to having all of their |
| activities on this system monitored and recorded by system |
| personnel. |
| |
| In the course of monitoring individuals improperly using this |
| system, or in the course of system maintenance, the activities |
| of authorized users may also be monitored. |
| |
| Anyone using this system expressly consents to such monitoring |
| and is advised that if such monitoring reveals possible |
| evidence of criminal activity, system personnel may provide the |
| evidence of such monitoring to law enforcement officials. |
|-----------------------------------------------------------------|
ok setenv input-device keyboard
ok setenv output-device screen
1. login:
2. su postgres
2.a - cd /backup/vol02/data ( added to ensure that we are using the same rtdenv.txt file )
3. pkill -u postgres
4. source ./rtdenv.txt
5. ./startSQL
nohup /usr/bin/postmaster -i -D /backup/vol02/data -B 30000 -N 600 >server.log 2>&1
pkill -HUP in.mpathd
Create a init script
Login as root and type the command:
# cd /etc/rc2.d/
# touch S99static-routes
# chmod +x S99static-routes
# vi S99static-routes
Write a shell script and append static route using route command itself:
#/bin/sh
route add net 192.168.1.0 netmask 255.255.255.0 192.168.1.254 1
route add net 10.0.0.0 netmask 255.0.0.0 10.20.110.1