Solaris Systems Administration 1

Solaris Sys Admin 1 Commands + Initialisation Files


#This file and these commands should only be used by students 
#who have attended one of our system adminstration courses.

#If you do not understand the commands or the context in 
#which they are specified below, then I suggest that you
#do not use them as you can cause damage to your server.

#This is a complimentary file and the commands below should 
#only be used by those with the necessary skills.  Therefore 
#use these commands at your own peril.

#This file assumes that you are working in the Korn Shell as 
#root and uses Korn shell variables, shell options and aliases

#CONTENTS OF $HOME/.profile file - shell variables
PS1=`hostname`':$PWD# '
HISTFILE=$HOME/.sh_history
HISTSIZE=500
EDITOR=/usr/bin/vi
ENV=$HOME/.kshrc
PATH=/sbin:/usr/sbin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/dt/bin:/usr/openwin/demo:/usr/openwin/bin:/etc:


if [ -f /usr/bin/ksh -a -x /usr/bin/ksh ]
then
SHELL=/usr/bin/ksh
export PS1 HISTFILE HISTSIZE EDITOR PATH ENV SHELL
/usr/bin/ksh
fi

#CONTENTS OF $HOME/.kshrc file - aliases and shell options

alias ini='cd /etc/init.d'

alias zctar='zcat 122420-01.tar.Z | tar xvf -'

alias ifp='ifconfig -a'

alias conf='cat /etc/nsswitch.conf'

alias smc_stat='/etc/init.d/init.wbem status'

alias smc_stop_start='/etc/init.d/init.wbem stop;sleep 5;/etc/init.d/init.wbem start'

alias ser='cat /etc/services'

alias s='smc'   # add ampersand before final single quote

alias pcont='cat /var/sadm/install/contents'

alias sulog='echo tail -20 /var/adm/sulog;tail -20 /var/adm/sulog'

alias insdata='more /var/sadm/install_data/install_log'

alias pti='more /etc/path_to_inst'

alias ll='ls -lF'

alias prtdiag='/usr/platform/sun4u/sbin/prtdiag -v'

alias al='alias'

alias ls='ls -F'

alias daemon='ps -ef | more'

alias dt='dtterm -fb helvetica -bg navyblue -fg white '# add ampersand before final single quote

alias d1='dtterm -bg blue -fg yellow '# add ampersand before final single quote

alias d2='dtterm -bg yellow -fg black '  # add ampersand before final single quote

alias vol='volcheck -v /dev/diskette'

alias flop='cd /floppy/floppy0'

alias x='cd /export/home'

alias pro='/usr/dt/bin/sdtprocess'  # add ampersand before final single quote

alias scap='/usr/dt/bin/netscape'  # add ampersand before final single quote

alias xis1='xeyes -fg black -bg grey -outline red -bd yellow -center yellow'  # add ampersand before final single quote

alias ej=eject

alias 

j=jobs

alias h='history -127'

alias cl=clear

set -o vi

set -o trackall

. ./.profile # SOURCE .profile - make variables part of the current process
. ./.kshrc	# SOURCE .kshrc - define aliases and shell options active in the current process
 
alias
 
xis1
 
bg %4
  
fg %4
  
xis3
 
fg %1
  
xis1
 
bg %1
  
fg %1
  
xis1
 
fg %1
kill -24 1548
kill -25 1548
cat .profile
cl
echo uname -n
echo `uname -n`
echo 
hostname
echo `hostname`
cl
print $(hostname)
cat .profile
kill -24 1548
cl
alias 
xis1
xeyes -fg orange -bg blue -outline red -bd yellow -center white   # add ampersand at end of line
xeyes -fg white  -bg blue -outline red -bd yellow -center white   # add ampersand at end of line
cat .profile
x=5
y=$x
echo $y
x=$x999999999
echo $x
echo "$x"
x="$x999999999"
echo $x
x=5
echo $x
x=$x
echo $x
echo $x:kkk:kkk
echo $PATH
PATH=$PATH:/usr/openwin/demo
cat .profile
cat .kshrc
set -o
date > fred
cat fred
 
who > fred
 
cat fred
 
set -o noclobber
 
date > fred
  
date >| fred
 
cat fred
 
date > fred
  
cat .profile
 
cat /etc/hosts
 
sed '1,5d' /etc/hosts
  
cat /etc/hosts
 
sed '1,5d' /etc/hosts | nawk '{ print $2 }'
 
sed '1,5d' /etc/hosts | nawk '{ print $2 }' > basket
  
cat basket
 
ls -la | more
  
echo + > .rhosts  # do you really want to do this at work?
 
cat .rhosts
  
for tabby in `cat basket`
do
rcp .profile .kshrc $tabby:/
echo $tabby
done
 
ls -lart | more
  
cat .profile
 
x=5
  
echo $$
  
ksh
  
echo $$
  
echo $x
  
exit
 
echo $x
  
echo $$
  
export x
 
ksh
  
echo $$
  
echo $x
  
x=56000
  
export x
 
exit
 
echo $$
  
echo $x
  
set +o vi
  
set -o vi
  
x=56000
  
cl
 
pkill xeyes
  
cl
 
ls
 
chmod 700 fred
  
ls
 
ls -l
  
who > jim
  
ls -li jim
 
mv jim phil
  
ls -li phil
  
df -k

mv phil /var

ls -li /var/phil

cd /sbin

ls

cd /proc

ls

cd

cp fred /tmp

cat > bill

cat bill

touch z1 z2

ls -l z*

cat ls

cat /usr/bin/ls

strings /usr/bin/ls

ls

date > z1

rm z2

cat z1

ls -li z1

ln z1 z2

ls -l z*

ls -il z*

who >> z2

ls -il z*

ln z2 z3

ls -il z*

cp z3 z4

ls -il z*

date > z4

ls -il z*

mkdir vince

mv z3 vince

ls -il z*

find / -inum 21

df -k

cl

cd /devices

ls

cd pci@8,600000/

ls

cd SUNW,qlc@4/

ls

cd fp@0,0/

ls

cd

cd /devices

ls

cd /dev/dsk

ls

ls -l

cd

devfsadm
  
format
 
cd /devices  # This is a Sunblade on Solaris 9
  
ls
 
cd pci@8,600000/
 
ls
 
cd SUNW,qlc@4
  
ls
 
cd fp@0,0
  
ls
 
cd

df -k
  
cd /dev/dsk
  
ls -l
  
cd
 
cl
 
vi hosts
 
format
 
prtvtoc /dev/rdsk/c2t3d0s2
 
mkdir vtoc
 
prtvtoc /dev/rdsk/c2t3d0s2 > /vtoc/c2t3d0s2
  
fmthard -s /vtoc/c2t3d0s2 /dev/rdsk/c2t3d0s2
 
alias vol
  
pgrep vold
 
ps -ef | more
  
man ls
 
ps -ef | more
  
cat /vtoc/c2t3d0s2
 
cl
 
ls > fred
  
ls -l fred
 
who > dave
 
ls -l dave
 
newfs /dev/rdsk/c2t3d0s0    #be careful with your symbolic nomenclatures
 
newfs /dev/rdsk/c2t3d0s1    #if you mistakenly run this command on a slice with 
							#active users, prepare for some unpaid overtime.
newfs /dev/rdsk/c2t3d0s3
 
newfs /dev/rdsk/c2t3d0s4
 
fstyp -v /dev/dsk/c2t3d0s0 | grep minfree
  
tunefs -m 2 /dev/rdsk/c2t3d0s0
 
cd
 
mkdir brazil peru
  
mount /dev/dsk/c2t3d0s0 /brazil

mount # notice the default options given to /brazil
  
mount -o nointr,ro,nolargefiles,nosuid /dev/dsk/c2t3d0s1 /peru
  
df -k

mount
  
cd /brazil
 
ls -l > freddy
 
who >> freddy1
 
date >> freddy1
  
ls fred*
 
mkdir sven
 
cd sven
  
ls > jim
 
umount /brazil
 
cd
 
umount /brazil
 
df -k
  
mount
  
cd /brazil

cd
 
mount -o nointr,nolargefiles /dev/dsk/c2t3d0s0 /brazil
 
mount
  
df -k
  
cd /brazil
 
ls
 
cd
 
umount /brazil
  
cd brazil
  
ls
 
ls > freddyyy
  
df -k
  
ls
 
mkdir bananas
  
cd
 
mount -o nointr,nolargefiles /dev/dsk/c2t3d0s0 /brazil
 
cd /brazil
 
ls
 
cd
 
df -k
  
umount /brazil 
 
cp /etc/vfstab /etc/vfstab.bak
 
vi /etc/vfstab
 
df -k
  
umountall
  
df -k
  
mountall
 
df -k
  
mount
  
alias vol
  
vol
  
alias flop
 
flop
 
alias flop='cd /floppy/floppy0'
  
flop
 
cd /floppy/floppy0
 
/etc/init.d/volmgt stop
  
/etc/init.d/volmgt start
 
pgrep vold
 
vol
  
flop
 
cp /.profile /.kshrc .
 
ls -la
 
alias ej
 
ej
 
cd
 
ej
 
ls -la | more
  
\ls
  
ls
 
alias | grep ls
  
\ls
  
df -k
  
cd /brazil
  
ls
 
fuser -cu /brazil
  
id
 
pwd
  
man fuser
  
fuser -cu /brazil
  
who
  
exit
 
fuser -cu /brazil
  
cd /brazil
 
ls
 
fuser -cu /brazil
  
fuser -ck /brazil
  
fuser -cu /brazil
  
cd

fuser -ck /brazil
  
df -k
  
umount /brazil
 
cd /peru
 
fuser -cu /peru
  
echo $$
  
umount -f /peru
  
df -k
  
umountall
  
mountall
 
fsck /peru
 
df -k
  
umount /peru
  
fsck /peru
 
cd /brazil

ls

vi freddy1
 
fsck /brazil
 
newfs -N /dev/rdsk/c2t3d0s0
  
fsck -o b=32 /dev/rdsk/c2t3d0s0
  
cat /var/mail/root
 
cl
 
newfs /dev/rdsk/c2t3d0s4
 
df -k
  
ls -l | nawk '{ print $9 }'
  
\ls -l | nawk '{ print $9 }'  #switch the ls alias off and use the ls command
 
\ls -l | nawk '{ print $1, $9, $3 }'
 
dk
 
df -h
  
cat -vet /etc/vfstab
 
alias
  
EDITOR=/usr/bin/vi
 
export EDITOR
  
crontab -l
 
crontab -l > mycron
  
vi mycron
  
vi mycron
  
crontab mycron
 
alias 

cons
 
dtterm -C -bg blue -fg yellow -name "Console - $$ $LOGNAME"  # add ampersand after command
  
vi .kshrc
  
crontab -e
 
/etc/init.d/cron stop
  
/etc/init.d/cron start
 
at 15:40
 
date
 
at 15:45
 
date
 
at noon tomorrow
 
atq
  
at -l
  
at -r 1148468400.a
 
cd /var/spool/cron/atjobs  
  
ls -l
  
atq
  
cd ..
  
ls
 
cd crontabs/
 
ls
 
cat root
 
cd

cat /var/adm/messages
  
cl
 
echo $$
  
smc   # add ampersand after command
 
pgrep vold
 
ptree 2203
 
ptree
  
alias
  
prtdiag
  
more /etc/path_to_inst
 
vol;flop
 
/etc/init.d/volmgt stop
  
/etc/init.d/volmgt start
 
vol;flop
 
cd
 
cl
 
man fuser
  
df -k
  
umountall
  
df -k
  
mountall
 
cl
 
fsck -y /dev/rdsk/c2t3d0s0
 
admintool # add ampersand after command
 
cat /etc/passwd
  
cat /etc/group
 
cat /etc/shadow
  
grep :10: /etc/passwd
  
cat /etc/group

useradd -u 442 -d /export/home/sven -mc "Sven GE x256" -s /bin/ksh -g 10 -G 14 sven

id
 
id -a
  
id -a sven
 
useradd -u 424 -d /export/home/nancy -mc "Nancy D" -s /bin/ksh -g 10 -G 14 nancy
  
cat /etc/passwd
  
cat /etc/group
 
cat /etc/shadow
  
passwd nancy
 
cat /etc/shadow
  
cd /export/home
  
ls
 
ls -l
  
mkdir ulrika
 
ls -l
  
chown ulrika ulrika
  
chgrp staff ulrika
 
ls -l 

chown ulrika:staff ulrika
  
cd ulrika
  
ls

ls > fred
  
mkdir jim
  
ls -l
  
cd ..
  
chown -R ulrika:staff ulrika
 
cd ulrika
  
ls -l
  
cd
 
cat /usr/sadm/defadduser
 
useradd -D
 
vi /usr/sadm/defadduser
  
useradd -u 999 -d /export/home/ken -mc "Ken Barlow" ken
  
cat /passwd
  
cat /etc/passwd
  
cat /etc/group
 
passwd ken
 
cat /etc/shadow
  
smc  # add ampersand after command
 
cat /etc/passwd
  
cp .profile .kshrc ~mike
 
cd /export/home
  
ls
 
ls -la
 
chmod -R 755 mike
  
cp .profile .kshrc ~mike
 
cd
 
cp .profile .kshrc ~mike
 
cd /export/home
  
ls -la
 
cd
 
cp .profile .kshrc ~sven
 
cd ~sven
 
ls -la
 
chown sven:staff .kshrc
  
ls -la
 
groupadd -g 300 sales
  
cat /etc/group
 
vi /etc/default/su
 
cons
 
su - sven
  
cat /etc/default/login
 
who
  
vi /etc/default/login
  
mail
 
who
  
exit
 
vi /etc/default/login
  
who
  
whoami
 
cd /var/adm
  
ls
 
cat sulog
  
cat /var/adm/sulog
 
cd
 
touch /var/adm/loginlog
  
chmod 600 /var/adm/loginlog
  
chown root:sys /var/adm/loginlog
 
cat /var/adm/loginlog
  
ls -l $_
 
vi /etc/default/login
  
cat /var/adm/loginlog
  
cat /etc/default/login
 
cl
 
vi /etc/default/login
   
finger root

finger sven
  
last
 
last sven
  
last reboot
  
exit
 
cl
 
su sven
  
exit
 
id
 
whoami
 
who am i
 
cat /var/adm/sulog
 
whoami
 
cat /var/adm/sulog
 
cat /etc/default/su
  
clear
  
more /var/adm/sulog
  
cat /etc/default/passwd
  
vi /etc/default/passwd
 
ls -l /etc/shadow
  
ls -l /usr/bin/passwd
  
touch madonna
  
ls -l $_
 
touch madonna
  
chmod 755 madonna
  
touch madonna
  
ls -l $_
 
chmod 4755 madonna
 
ls -l $_
 
chmod 6755 madonna
 
ls -l $_
 
chmod 4755 madonna
 
chmod 2755 madonna
 
ls -l $_
 
ls -ld /tmp
  
cl
 
ls -ld /tmp
  
cd /tmp
 
ls -la
 
cd
 
mkdir sticky
 
ls -ld sticky
  
chmod 777 sticky
 
ls -ld sticky
  
chmod 1777 sticky
  
ls -ld sticky
  
find / -type d -perm -1000

find / -type f -perm -4000
 
find / -type f -perm -2000
 
date
 
who
  
cl
 
snoop blake4
 
vi /etc/hosts.equiv
  
cl
 
cat /etc/hosts.equiv
 
vi /etc/hosts.equiv
  
vi /etc/default/login
  
who
  
who -r
 
init 0
 
vi /etc/vfstab
 
init 6
 
init 0
 
cd /platform
 
ls
 
cd sun4u
 
ls
 
cd kernel
  
ls
 
cd
 
cat /etc/default/login
 
cat /etc/system
  
cp /etc/system /etc/system.bak
 
vi /etc/system.bak
 
grep -v '*' /etc/system.bak
  
grep '^[^*]' /etc/system.bak
 
cat /etc/inittab
 
cat /etc/init.d/volmgt
 
pgrep vold
  
/etc/init.d/volmgt stop
 
pgrep vold
  
/etc/init.d/volmgt start
  
pgrep vold
 
cat /etc/inittab
 
cat /etc/init.d/volmgt
 
ksh
  
ls
 
echo $?
  
ls-z
 
echo $?
  
ksh
  
exit 99
  
echo $$
  
ksh
  
exit 99
  
echo $?
  
cat /etc/init.d/volmgt
 
cat /etc/inittab
 
vol;flop
 
cd
 
cat /var/adm/sulog
 
last

last | grep sven
 
last sven
 
cat /etc/inittab
 
cd /sbin
 
ls rc?
 
ls -li rc?
 
cd /etc
  
ls -l rc?
  
cd /etc/rc2.d
  
ls
 
cd /etc/init.d
 
ls
 
ls -l
  
cat volmgt
 
cp volmgt banner
 
ls -l volmgt
 
ls -l 

banner
 
chgrp sys banner
 
ln banner /etc/rc2.d/S77banner
 
ln banner /etc/rc2.d/K77banner
 
vi banner

banner fred
  
./banner start
 
./banner stop
  
init 6
 
vi /etc/hosts
  
who
  
alias sd
 
sd
 
ifconfig -a
  
init 0
 
eject cdrom
  
cl
 
alias
  
pcont
  
ls
 
more contents
  
grep showrev contents
  
cd
 
clear 

pkginfo | more
 
pkginfo -l | more
  
pkginfo -l SUNWman
 
pkginfo | wc -l
  
cd /var/sadm/pkg
 
cd

pkginfo -d /cdrom/cdrom0/s0/Solaris_9/Product | more
 
ej cdrom
 
cd /var/sadm/pkg
 
pkgrm SUNWzlib

cd /cdrom/cdrom0/s0/Solaris_9/Product
  
pkgadd -d . SUNWzlib


cd
 
vol;flop
 
cp /.sh_history .

ls -l /var/sadm/patch
  
patchadd 108881-16

ls -l /var/sadm/patch

patchrm 108881-16

#Boot Prom commands

ok	banner

ok	printenv

ok	devalias

ok  reset-all

ok  setenv auto-boot? false

ok  reset-all

ok  probe-ide

ok  probe-scsi

ok  probe-scsi-all

ok  show-disks

ok  set-defaults

ok  nvalias sven /hardware_path@0,0

ok  setenv boot-device sven

ok  boot 

ok  nvunalias sven 

BDV-SKILLS-UK

Learning Resources

Latest News

News

Links

 
Solaris Sys Admin 1 Commands + Initialisation Files
Solaris Sys Admin 1 Commands + Initialisation Files