- 论坛徽章:
- 0
|
PDF文档下载地址以后给,等《上》《下》全部写完了再贴地址
——————————————————————————————————
Sun Certified System Administrator 9 Part I Book Vol.1
Course ID:SA-239
Exam ID:310-014
Powered By 红头发(Syuu)
Preface
这本教程是根据人民邮电出版社的《Solaris学习指南》其中的PART I(SA-239)改写的,作者是Tim Gibbs.至于这个教程为什么叫Vol.1那是因为我认为原书(《Solaris学习指南》)写的实在是不适合新手阅读:很多知识点没讲到比如什么是setuid,初学者刚看会觉得很吃力.所以我把这个教程定为Vol.1.以后还会有Vol.2和Vol.3(3本必备,完全覆盖知识点).如果大家看我的这本教程仍然有点吃力的话,那就结合Vol.2和Vol.3一起看会比较好."Using the vi Editor"仍然省略,单行本另写.
希望这个教程对大家有所帮助.如有错误和不完善的地方请大家指正.我还将继续把后续教程写完.预祝大家在Solaris9学习的道路上,顺利!
红头发(Syuu)
Sept.11.2003
PS:感谢支持我的朋友们...SINCERELY!
Certifications Objective 1.01
Define System Administrator Terms
echo $SHELL:display the shell you currently used
passwd -e <user>;:change shell (root user only)
mount point:the locations (directory) on the parent file systemwhere a separate file system may be attached
kernel:
1./kernel:common kernel components for booting
2./platform/<platform-name>;/kernel:for a special type of platform
3./platform/<hardware-class-name>;/kernel:for a special type of hardware
4./usr/kernel:kernel components common to all platforms within a particular instruction set
Certifications Objective 1.02
Defining the Effects of Various man Command Options in Viewing Online Manual Pages
man <command-name>;
man pages:
1./usr/share/man
2./usr/share/man/sman*(SGML tags)
3./usr/share/man/man*(nroff tags)
4./usr/share/man/man.cf(searching order)
man -k <keyword>;
man -M <path>;:not specified by the MANPATH variable or in the /usr/share/man/man.cf file
man -a <command-name>;:all
man -f <file-name>;:search for files
then:man -s <section-number>; <file-name>;
Certifications Objective 2.01
Using OpenBoot PROM Commands
OpenBoot:
1.test hardware and initialize it
2.determine the configuration of the hardware
3.boot the system from network or disk
4.provide interactive debugging for testing hardware and software
OpenBoot commands can be entered from only 2 ways:
1.from system console
2.from a serial terminal attached to the TTYA or TTYB port on a SPARC workstation
getting into OpenBoot mode:press STOP-A(system console) or CTRL-BREAK(serial terminal)
banner:
1.display processor's type
2.OpenBoot's version
3.memory size
4.ethernet address,etc
Restricted Monitor Mode:b,c
Forth Monitor Mode:n
help:find helps in OK prompt
Certifications Objective 2.02
Knowing the Combination of Actions Required to Interrupt a Nonresponsive System
sync:synchronize disk data
STOP-A:abort
go:resume
Certifications Objective 2.03
Using Command Strings to Manipulate Custom Device Alias
setenv <variable>; <value>;
eg. setenv auto-boot? false
printenv:print variable information
.attributes:list device attributes(OpenBoot 2.x)
.properties:list device information(OpenBoot 3.x)
show-disks:list disk device on the system
device tree:SUN SPARC or ULTRA SPARC proccessor(top)>;memory;built-in controllers for mouse/keyboard/serial ports/network
>;SCSI>;disks;tapes;high-speed network controllers
eg./sbus@1f,01esp@0,40000/sd@3,0:a
nvalias <alias>; <device>;(OpenBoot 2.6&later):permanent alias
eg.nvalias seedyrom /pci@1f,0/pci@1,1/ide@3/cdrom@2,0:f
devalias <alias>; <device>;(before OpenBoot 2.6):temporary alias
the mothod of creating a pernament alias using devalias:
1.nvedit
2.key in your desired command and press Enter
3.CTRL-C to exit nvedit
4.nvstore(you must set the variable use-nvramrc? true)
nvrun:test the new command in nvedit
when you enter a command OpenBoot cannot recognize,it echoes back the command followed by a ?
Certifications Objective 3.01
Installing the Solaris Operating Environment Software on a Networked Standalone System
Solaris platform editons:
1.SPARC platform edition
2.INTEL/X86 platform edition
Solaris international editions:
1.English version
2.International version
installation options:
1.interactive installation(GUI-driven)
2.Solaris web start(JAVA-powered GUI)
3.network installation
4.default jumpstart(only a new system to be installed)
5.custom jumpstart
hardware requirements:
1.disk space,600MB at least
2.Min memory:64MB,256 MB preferably,up to 192GB
components of Solaris software:
1.software packages
2.software clusters
3.software groups
software packages:
1.pkginfo file,including the package's title,purpose,version,etc
2.pkgmap file,including the names,locations,sizesand permissions of all the files
3.preinstall script
4.the files
5.a script that is run during the removal os the software
software cluster:a collection of severial packages that logically belong together
software groups:
1.core operating environment(SUNWCreq):doesn't contain any man pages,GUI,Java,etc;takes about 700MB
2.end-user operating environment(SUNWCuser):contains man pages,CDE,Open Windows,Java runtime,Netscape;takes 1.2GB
3.developer operating environment(SUNWCprog):special for a developer,doesn't include C compiler;takes 1.5GB
4.entire distribution group(SUNWCall):takes about 2GB
5.entire distribution plus OEM support group(SUNWCXall):includes support for hardware from OEMs;takes more than 2GB
boot <device>;
eg.boot cdrom/net
default boot disk:c0t0d0
by default,Solaris populates 3 disk slices:
1./ file system on slice 0
2.swap area on slice 1
3./export/home file system on slice7
(ensuring that you must creata separate slices for the root,/usr,/var,and /opt file systems
Certifications Objective 3.02
Understanding the Function of Package Administration Commands
/var/sadm/install/contents:list all the installed files on the system
pkgadd:unpack a software package and install it,default location of the instance is /var/spool/pkg
pkgadd -n <instance>;:noninteractive
pkgadd -n -a <admin file>; <instance>;: more noninteractive
pkgadd -n -a <admin file>; -r <response file>; <instance>;:completely noninteractive
pkgadd -d <path|device>; <instance>;:pkgadd looks in that location for instance instead of in the default location /var/spool/pkg
eg.pkgadd -d /cdrom/cdrom0 <instance>;
pkgadd -s <spool>;:be copied only to a spool location,not be installed,the default spool location is /var/spool/pkg
pkginfo:gain information about a package.by default,the output is one-lne,containing the catagory,the package instance,package name
pkginfo -q <instance>;:no output,only tell you whether the package was found
pkginfo -x <instance>;:return output
pkginfo -l <instance>;:long output
(q,x,l are exclusive)
pkginfo -d <path|device>; <instance>;:looks for an uninstalled package in the location provided
pkgchk:verifying the installation of a package and check files for correctness
pkgchk -f <instance>;:try to correct any file attribute problem it finds,it is useful for checking the system's security or if someone changed the permissions on a directory
pkgchk -p <instance>;:check filename against its installed package databases
pkgchk -a <instance>; nly check file attributes
pkgchk -c <instance>; nly check file contents
pkgchk -n <instance>;:not to check files that are likely to change,such as log files and password files
pkgchk -l <instance>;:long output
pkgrm:remove a previously installed package,it will not remove a shared file
pkgrm -n <instance>;:noninteractive
pkgrm -n -a <admin file>;:more noninteractive
pkgrm -A <instance>;:absolutely remove the files,even if they are shared
Certifications Objective 3.03
Understanding the steps to Install,Remove,and Verify Which Patches Are Currently Installed
Solaris has 3 levels of patches:
1.recommended
2.security
3.product-specific
smpatch:manage patch installation
patch:
1.Solaris9.patchreport
2.9_recommended.zip
3.9_recommended.readme
once a patch has been installed on a system:
1.a directory is creata under /var/sadm/patch with the readme file and the installation log file
2.a directory is created under /var/sadm/pkg with that directory is a pkginfo file and a save directory to which the files that were replaced are copied
patchadd:install a patch and check on the currently installed patches
patchadd -d <patch>;:stopping patchadd from using /var/sadm/patch to copy thr replaced files;this means the patch can never be backed out,the only way to remove this patch is to rebuild the entire system
patchadd -u <patch>;:patchadd to replace files unconditionally
patchadd -B <path>; <patch>;:using a directory other than /var/sadm/patch to save its backups
patchadd -M <path|id……patch patch-list>;:installs mutiple patches
patchrm:remove or back out a patch from a system
patch -f <patch>;:remove this patch,even if it has been superseded by another patch
showrev:displays information about the currently running system
showrev -p:show infomation about installed patches
patchadd -p:show infomation about installed patches
showrev -w:show information about the Open Windows version installed
showrev -a:show all the information
showrev -c <command-name>;:find information about a specific command
Certifications Objective 4.01
Understanding the Solaris9 Operating Environment Bootstrap Process
the boot process:
1.boot PROM phase
2.boot program phase
3.kernel phase
4.INIT phase
boot PROM phase OST>;display system banner>;boot
from the boot device ,it reads the primary boot loader,boot block(BOOTBLK),and excute it,the boot block is always located in sector 1 through 15 of the boot device
boot program phase:when the boot block excutes,its sole function is to load the secondary boot program UFSBOOT and excute it
UFSBOOT's function:locate and load the basic kernel
UFS:the only file system that could be used for booting the operating environment
kernel phase:
the core kernel of Solaris9:
1.generic UNIX(GENUNIX), platform-independent
2.UNIX,platform-dependent
modules:pieces of software that are able to interface with and control a particular piece of hardware;these modules can be loaded dynamically,this feature allows the kernel to remain as small as possible
kernel files,GENUNIX,UNIX can be found in:
1./platform/<ARCH>;/kernel
2./platform/<ARCH>;/kernel/sparcv9
(ARCH can be returned by uname -i)
modules can be found in:
1./kernel
2.usr/kernel
3./platform/<ARCH>;/kernel
4./platform/<MODEL>;/kernel
(MODEL can be returned by uname -m)
boot -s:boot into singer-user maintance mode
boot -r:reconfigures devices during booting
boot -i:boot interactively
boot -v:prints verbose diagnostic messages during booting
/etc/system:contains all the configurations that the kernel needs to operate
system file:
1.use * to start a comment
2.non-commented lines takes 2 forms:
a.one of five commands followed by a : and argument
b.start the word set followed by a kernel parameter and its value(80-character limit)
eg:moddir:/kernel /usr/kernel /platform/sun4u/modules
rootfs:ufs
rootdev:/sbus@1,f8000000/esp@0,8000000/sd@3,0:a
exclude modules that are not used)
forceload:fs/ufs fs/procfs fs/tmpfs
forceload:sys/pipe sys/kaio sys/doorfs
set maxusers=512
set nautopush=32
INIT phase nce INIT is started,the system actually has all the requirements necessary to be functional,but none of the services has been started,it is reponsible for starting all the process that prepare the system for use
GETTY process:allows user to access the system and as users log out
/etc/inittab:the INIT process's configuration file,this file is used to describe the run levels and set the default run level at which the system will operate.run levels are defined by INIT,they are often referred to as INIT levels or INIT states
INITTAB file:
1.be composed of 4 fields,separated by a :
2.comment lines begin with #
3.four fields:
a.the ID field
b.the RLEVEL field
c.the ACTION field
d.the PROCESS field
the ID field:a unique string of 1 to 4 characters,it is used to identify the entry
the RLEVEL filed:it can be any combination of 0 to 6,if it is blank,it is interpreted as 0123456,it must not be blank for the INITDEFAULT action
the ACTION field:
1.SYSINIT:a process with the SYSINIT action is run before a console login prompt is displayed
2.INITDEFAULT:defines the default run level when the system will operate.the default is 3
3.RESPAWN:defines a process that should be started
4.WAIT:a peocess that is a WAIT action will cause INIT to pause its scanning of the INITTAB file until this process completes and terminates
5.ONCE:starts only once;the process is started when this entry is activated
6.BOOT:a process in which INIT first only begins at boot time
the PROCESS filed:specifies the command or script that is to be run when this entry is activated
Certifications Objective 4.02
Understanding and Working with Solaris Run Level
run level:
1.0 ROM mode,it is used to bring a running sytem to the OK prompt
2.S or s:single-user mode,minimum number of file systems are mounted,minimal services are started
3.1: single-user administrative mode.all the file systems are accessible,minimal services are started
4.2:standard multiuser mode.all services except the NFS and any services that relies on NFS are available
5.3:default run level.all services are available
6.4:unused
7.5:shutdown mode,it is equal to level 0,except that it also powers down
8.6:reboot mode.it's equal to level 0,except that it also reboots
/sbin/rc#(# falls in the range of 0 to 6,S or s):each run level is controlled by a run control script,named /sbin/rc#,their major function is to run other scripts.the scripts that are run by the /sbin/rc# scripts are service control script.these service control scripts can be found in /etc/rc#.d(# falls in the range of 0 to 6,S or s)
/sbin/init.d:the true location of the service control scripts that are run by the run control metascripts.it's a centralized location where all the scripts can be kept for maintainability
/etc/rc#.d(# falls in the range of 0 to 6,S or s):the run-level-specific directory where the links are kept.the /sbin/rc# scripts looks in this directory to find the scripts to start and stop the service.files in here are linked to /etc/init.d and are named K##service or S##service(## is 00 to 99)
init <run level>;:change to a new run level
telinit <run level>;:change to a new run level in an orderly manner.it will run the /sbin/rc# script
shutdown:change to another run level nicely,using the INIT process
shutdown -i <run level>; -y:not ask,change to another run level,default is S or s
shutdown -i <run level>; -y <message>;:send warning message
shutdown -g <seconds>;:after several seconds,the system will be off
halt:change to run level 0 without running /sbin/rc0 script,only be used in emergency situations
reboot:immediately reboot the system.in other words,it performs a halt and a boot command.it deos not run the /sbin/rc0 script
reboot -- <boot option>;:pass to the boot command at the PROM level
poweroff:immediately shut down the system and turn off the power,if the hardware supports it,it does not run /sbin/rc0 script.
Certifications Objective 5.01
Understanding Login Procedures
/etc/passwd:as the user logs in,the userid,groupid,home directory,and default shell are parsed from the password file /etc/passwd
the user's base environment:
1.HOME
2.LOGNAME
3.PATH(/usr/bin)
4.SHELL
5.MAIL
6.TZ(time zone)
eg.root :0:1:super-user:/:/sbin/sh
>;username:password:UID:GID:comment:home directory:initial program(shell)
/var/adm/loginlog:if you are fails to enter the correct user ID and password 5 times,the log will be written to /var/adm/loginlog,and the connectionTTY) will be dropped.by default,this file does not exist.you can use touch command to creata it
the variable CONSOLE in /etc/default/login file:determine how the root user accesses the system
1.the default setting:CONSOLE=/dev/console:the only way to login as a root user is while sitting at the system
2.#CONSOLE=/dev/console:anyone who knows the root password can login either remotely or at the system console
3.CONSOLE= :no user can login as a root user either remotely or locally.but you can login as any user and then use su command to switch to the root user
if /etc/default/su has logging enable,any su logs will be written to /var/adm/sulog file
to log off of a Solaris system:
1.type exit
2.CTRL-D
passwd <username>;:change the password
passwd -s <username>;:show present password attributes
>;its output:
name state mm/dd/yy min max warn
min:sets the minimum numbers of days required between password change for a user
max:sets the maximum numbers of days the current password is valid for a user
warn:notifies a user several days before the password expires if max is set
passwd -n <min days>; -w <warn days>; -x <max days>; <username>;
Certifications Objective 5.02
Identifying Users Who Are Currently Logged in to the System
identifies users who are currently logged in:
1.w
2.who
3.finger
command w's output:
1.user
2.TTY
3.login@:the time of the day the user logged in
4.idle
5.JCPU:the system unit time used by all processes and their children on that terminal
6.PCPU:the system unit time used by currently active process
7.what:the name and arguments of the current process
command who's output:
1.login id
2.TTY
3.login@
4.login@host or IP address
command finger's output:
1.login ID
2.TTY
3.idle
4.when
5.where:host or IP address
/var/adm/utmp:user accounting database
w -h:suppress the heading
w -l:long output(default)
w -s:short output
w -w:also long output
w -u:produces the heading
who -q nly display the names and the number of users currently logged in,when this option is used,all other options are ignored
who -r:indicates the current run level
who -m utput information about only the current terminal
who -b:indicates the time and date of last reboot
who -H:prints the headings
who -s:list only the NAME,LINE,and TIME dields(default)
who -n <number>;:display the number of users ,this option may be only used with -q option
who -d:display all processes that have expired and not been respawned by INIT,the EXIT field appears for dead process
who -p:list any other process that is currently active and has been previously spawned by INIT
finger -s:short output
finger -l:long output
finger -q nly the LOGIN NAME,TERMINALand TIME are displayed
finger -m:matches arguments only on LOGIN NAME
finger -w:suppress printing the full name in a short output
finger -p:suppress printing of the .plan file in a long form output
finger -i nly the LOGIN NAME,TERMINAL,TIMEand IDLE are displayed
finger -h:suppress printing of the .project file in a long form output
finger -f:suppress the heading
finger -b:suppress the user's home directory and shell
Certifications Objective 5.03
Adding,Modifying,or Deleting User and Group Accounts on the Local System
useradd:creats a new user account,adding information to the /etc/passwd,/etc/group and /etc/shadow files and creating the user home directory if requested
useradd -c <comment>; <username>;:known as the GECOS field
useradd -d <directory>; <username>;:defines the location of the user's home directory
useradd -e <expire>; <username>;:expires the account after a given day
useradd -f <inactive>; <username>;:if the account has not been used for some days,it will be marked inactive
useradd -g <primary group>; -G <supplentary group,……>; <username>;:defines the groups
useradd -u <uid>; <username>;:assigns the UID(numeric)
useradd -u <uid>; -o <username>;:allows the UID to be nonunique
useradd -s <shell>; <username>;:defines the user's home directory if it does not exist
useradd -k <skel-directory>; <username>;:uses the skel-directory as a model for the user's home directory
eg.useradd -u 101 -c "Syuu" -d /export/home/syuu -m -s /bin/ksh -g Noko syuu
useradd -D <username>;:displays the default values
useradd -D -b <base directory>; -e <expire>; -f <inactive>; -g <group>;:sets the default values for the specified fields
default values:
1.base directory:/home
2.skel-directory:/etc/skel
3.shell:/bin/sh
4.inactive:0
5.expire:null(unset)
groupadd:adds a new group definition to the system and modifies the /etc/group file
groupadd -g <gid>; <group-name>;
groupadd -g <gid>; -o <group-name>;:allows the GID to be nonunique
usermod:modifies existing user accounts
usermod -u <uid>; <username>;:modifies the UID to a new UID
eg.change Syuu's UID from 101 to 102:
usermod -u 102 syuu
to make this modification,the user account cannot be in use and that any files previously owned by syuu will now show as being owned by UID 101,because the association between Syuu and UID 101 has been moved.but you can correct this problem in this way:
find / -user <uid>; -print -exec chown <new username>; {}\;
or as in the previously example:find / -user 101 -print -exec chown syuu {}\;
groupmod:modifies the information of a given group
groupmod -g <gid>; <group name>;:modifies the GID
groupmod -n <new group name>; <old group name>;:modifes the group's name
userdel:deletes a user's login from the system and modifies to the /etc/passwd,/etc/group and /etc/shadow files,as well as deleting the user's home directory
userdel <username>;
userdel -r <username>;:deletes the login and home directory
groupdel:deletes a group from the system,it modifies only the /etc/group file and deletes no files that were previously owned by this group
groupdel <group name>;
Certifications Objective 5.04
Listing the Shell Initialization Files Used to Set Up a User's Work Environment at Login
initialization files:define environment variables when a shell is started
2 type of initialization files:system and user
(any variables set in the user-specific initialization file will override variables set in the systemwide files)
skeleton files:be used to populate a user's directory,are kept in /etc/skel
the initialization files for each shell:
1.Borune shell:
/etc/profile
$HOME/.profile
2.Korn shell:
/etc/profile
$HOME/.profile
$HOME/.kshrc
3.C shell:
/erc/.login
$HOME/.cshrc
$HOME/.login
the default /etc/profile and /etc/.login files check quotas,print the message of the day(MOTD) file(/etc/motd),and check for mail.if the file $HOME/.hushlogin exists,MOTD will not be printed.in this case,only the banner command will print a message to the screen
the user initialization file,.profile,starts as a template.the templates are stored in /etc/skel:
1.Borune shell:uses the template /etc/skel/local.profile
2.Korn shell:uses the /etc/skel/local.profile
3.C shell:uses both the /etc/skel/local.login and /etc/skel/local.cshrc
modifying the skeleton files distributed with the operating system is not recommended.the recommended procedure is:
1.su -
2.mkdir /usr/local/skel/syuu
3.cp /etc/skel/local.cshrc /usr/local/skel/syuu/.cshrc
cp /etc/skel/local.login /usr/local/skel/syuu/.login
cp /etc/skel/local.profile /usr/local/skel/syuu/.profile
4.chmod 744 /usr/local/skel/syuu/.*
Certifications Objective 6.01
Using Regular Expressions to Search the Contents of Files
grep options:
1.-b:prints the block number on which the pattern was found
2.-c:prints only the count of lines matching the pattern
3.-h:suppresses printing the filename containing the matching line
4.-i:turns off case sensitivity
5.-l:prints only the filenames of those matching the pattern,separated by newline characters
6.-n:prints the line number on which the matching srtring was found
7.-s:suppresses error messages about nonexist or unreachable files
8.-v:suppresses lines that matching the string
9:-w:searches for the expression as a word
the xpg4 implementation:
1.-e <pattern-list>;:specifies 1 or more patterns,patterns must be separated by a newline character,a null pattern can be specified by 2 adjcent newline characters
3.-E:matches using full regular expressions
4.-f <pattern-file>;:patterns are terminated by a newline character,a null pattern can be specified by an empty line
5.-F:matches using fixed strings
6.-q:quiet mode,does not write anything to stanard out
7.-x:considers only input lines that use all characters in the line to match an entire fixed string or regular expression to be matching lines
eg.to search for a specific process in a peocess listing and does not want the grep command to show in the output:
$ps -aef | grep ora |grep -v grep
to search for the word "openwin" in any file starting with local:
$grep -w openwin local*
local.login: setenv OPENWINHOME /usr/openwin
<output omitted>;
to determine how many occurances you have of specific error messages "memory parity error"
$grep -c -E -i 'memory parity error' *
to print the line number so you can easily find it in the file:
$grep -n -i -E 'memory parity error' *
Certifications Objective 6.02
Using Command Sequence to Display or Modify File and Directory Permissions
ls options:
1.-a:lists all entries,including those that begin with .
2.-A:the same as -a option with the exception of . and ..
3.-b:forces printing of nonprintable characters to be in the octal \xxx notation
4.-c:uses time of last modification of the inode for sorting or printing
5.-C:default output
6.-d:list only the name(not contents) if an argument is a directory
7.-f:force each argument to be interpreted as a directory and lists the name found in each slot
8.-F:marks directory with a /;symbolic links with a @;FIFOs with a |;excutable files with a *;doors with a >;>;,and AF_UNIX address family sockets with a =
9.-g:the same as -l option except the owner is not printed
10.-i:for each file,prints the inode number
11.-l:long format
12.-L:if an argument is a symbolic link,lists the file or directory the link references rather than the link itself
13.-m:streams output format;files are listed across the page,separated by commas
14.-n:the same as -l option,except the owner's UID ang group's GID,rather than the associated character strings are printed
15.-o:the same as -l option except that the group is not printed
16.-p:puts a / after each filename if the file is a directory
17.-q:forces printing of nonprintable characters in filenames as ?
18.-r:reverses the sort order
19.-R:recursively
20.-s:give size in block
21.-t:sorts by timestamp(latest first) instead of name.the default is the last modification time
22.-u:uses time of last access instead of last modification for sorting or printing
23.-x:produce multicolumn output
24.-1(one):prints 1 entry per line of output
chmod <-fR>; <absolute mode/symbolic-mode-list>; <filename>;:change permissions
-f:if chmod cannot change the mode of a file,the -f option will suppress the warning message,but chmod still didn't change the file permissions
-R:recursively
setuid:4000
setgid:2000
sticky bit:1000
sticky bits:to prevent files in a directory from being removed or renamed.if a sticky bit is enable,1 or more of the following conditions must be met for a user to delete files:
1.the user must own file
2.the user must own directory
3.the file must be writable by the user
4.the user is a root user
how to change permissions on all your data files at once:
find / -name "*.dbf" -print -exec chmod o-w {}\;
chmod +s:turns on the setuid and setgid bits
chmod +t:enables the sticky bit
Certifications Objective 6.03
Understanding the Effects of Selected Umask Value on the Permissions Assigned to Newly Created Files and Directories
you use the umask command to define the permissions on newly created files.normally,you will find the umask command in the /etc/profile because this file is referenced by all login attempts:
#sample /etc/profile
umask 022
PATH=/usr/bin:/usr/sbin
export PATH
directories,by default,have a permission set of 777;files are newly created have a permission set of 666
Certifications Objective 6.04
Creating,Modifying,and Deleting Access Control Lists
access control lists(ACLs) are used in the Solaris environment to provide granular control of file permissions.ACLs allows a sysadmin to define extended permissions for files and directories
getfacl <filename>;:display the filename,the file owner,the file group owner,and the ACL and default ACL of the file,if it exists
getfacl -a <filename>;:display the filename,the file owner,the file group owner,and the ACL of the file
getfacl -d <filename>;:display the filename,the file owner,the file group owner,and the default ACL of the file,if it exists
when multiple files are specified on the command line,a blank line separates the ACLs for each file
(only directories may containing default ACLs)
1.the user entry without a user ID(user::perm) indicates that the permissions are granted only to the file owner;if it like this:user:syuu:perm,it means only syuu has the permissions
2.the group entry without a group ID(group::perm) indicates that the permissions are granted only to the file group owner;if it's like this:user:noko:perm,it means only group named noko have the permissions
3.the mask entry indicates the ACL mask permissions.these are the maximum permissions allowed to any user entries except the file owner and to any group including the file group owner.if it's like this:mask:rw:perm,and then you want to give a user the rwx permission,but the maximum permission of the user is rw
ACL format:
#file:filename
#owner:uid
#group:gid
user::perm
user:uid:perm
group::perm
group:gid:perm
mask:perm
other:perm
default:user::perm
default:user:uid:perm
default:group::perm
default:group:gid:perm
default:mask:perm
default ther:perm
eg.1.$getfacl datafile.dbf
#file:datafile.dbf
#owner:syuu
#group:noko
user::tag
user:chealyn:---
user:miyuki:r--
group::r--
mask::rw-
other:---
2.chmod 700 datafile.dbf
3.$getfacl datafile.dbf
#file:datafile.dbf
#owner:syuu
#group:noko
user::rwx
user:nami:---
user:syuu:r--
#effective:---
group::---
mask::---
other::---
(if you are using ACLs,it is best to use setfacl rather than chmod to change the permissions)
setfacl does 1 of the following:
1.replaces its entire ACL,including the default ACL on a directory
2.adds,modifies,or deletes 1 or more ACL entries,including default entries on directories
(if you have defined ACLs,it is advisable to use setfacl instead of chmod to change the permissions on the files from that time forward,even if doing so does add administration overhead)
the default ACL is the maximum permissions that may be given
eg.if the permission is rw,but you reruest rwx,the permissions granted will be rw
setfacl <-r>; -s <acl-entries>; <filename>;:
-r:recalculate the permissions for the ACL mask entry.the permissions specified in the ACL mask entry sre ignored and replaced by the maximum permissions necessary to grant the access to all additional user,file group owner,and group entries in the ACL.the permissions in the additional user,file group owner,and group entries are left unchanged
-s <acl-entries>;:sets a file's ACL.all existing ACL entries are replaced with the newly specified ACL.you don't need to specify the entries in any certain order.the following entries are required:
1.there is 1 user entry for the file owner
2.there is 1 group entry for the file group owner
3.there is 1 other entry for nonfile owner/nongroup owner
if there are additional user and group entries,the following applies:
1.there is 1 mask entry for the ACL mask that indicates the maximum permissions allowed for user(other than the owner) and groups
2.you may not duplicate user entries with the same UID
3.you may not duplicate group entries with the same GID
if the file is a directory,the following default ACL entries may be specified:
1.there is 1 default user entry for the file owner
2.there is 1 default group entry for the file group owner
3.there is 1 default mask entry for the ACL mask
4.there is 1 default other entry
setfacl <-r>; -md <acl-entries>; <filename>;:
-m <acl-entries>;:adds or modifies 1 or more ACL entries on the file.if an entry already exists for a specified UID or GID,the requested permissions will replace the current permissions.if an entry doesn't exists for a specified UID or GID,1 will be created
-d <acl-entries>;:deletes 1 or more entries from the file
setfacl <-r>; -f <acl-file>; <filename>;:
-f <acl-file>;:use the file as input to setfacl,you may specify a - for acl-file
ACL option:
1.u(ser)::perms >;file owner permissions
2.g(roup)::perms >;file group owner permissions
3.o(ther):perms >;permissions for users other than the file owner or members of file group owner
4.m(ask):perms >;the ACL mask
5.u(ser):uid:perms >;permissions for a specific user.<uid>; can be specified as either a username or a numeric UID
6.g(roup):gid:perms >;permissions for a specific group.<gid>; can be specified as either a group name or a numeric GID
7.d(efault):u(ser):perms >;default file owner permissions
8.d(efault):g(roup):perms >;default file group owner permissions
9.d(efault) (ther):perms >;default permissions for users other than the file owner or members of file group owner
10.d(efault):m(ask):perms >;default ACL mask
11.d(efault):u(ser):uid:perms >;default permissions for a specific user.<uid>; can be specified as either a username or a numeric UID
12.d(efault):g(roup):gid:perms >;default permissions for a specific group.<gid>; can be specified as either a group name or a numeric GID
eg. toadd 1 ACL entry to file fixprog.sh,which gives user syuu only read permission:
setfacl -m user:syuu:r-- /home/sysadm/fixprog.sh
to replace the entire ACL for fixprog.sh file,which gives syuu full access,the file owner all acess,the file group owner only read/write access,the ACL mask only read access,and other no access:
setfacl -s user:syuu:rwx,user::rwx,group::rw-,mask:r--,other:--- fixprog.sh
to get the ACL form file fixprog.sh and set the same ACL on the file newprog.sh:
getfacl fixprog.sh | setfacl -f - newprog.sh
Certifications Objective 7.01
Using Commands to Display Information for All Active Processes on the System
Process Manager:/usr/dt/bin/sdtprocess
ps:displays a listing of processes running on the system.when called without arguments,it lists only those processes running as the current user and attached to the current terminal
ps command options:
1.-c:prints scheduler information in a priocntl-compatible format
2.-e,-A:lists information about each process running
3.-f:shows additional information about each process
4.-l:long format
5.-G <gid-list>;:lists information for processes for which the real group ID numbers are given in gid-list,the list must be comma delimited
6.-U <uid-list>;:lists information only about processes with a real UID given in the list that follows it,the list must be comma delimited
there are actually 2 versions of the ps command on a Solaris9 system:
1./usr/bin/ps(System V Release 4)
2./usr/ucb/ps(BSD-compatible)
ps output:
1.S:the process state
2.UID
3.PID:the process ID
4.PPID:the process ID of the parent process
5.C:the processor utilization for scheduling(obsolete)
6.PRI:priority of the process
7.NI:a nice value used in priority computation
8.ADDR:the memory address of the process
9.SZ:the total size of process in virtual memory(in pages)
10.WCHAN:the address of an event for which the process is sleeping
11.STIME:the starting time of the process
12.TTY:the controlling terminal for the process
13.TIME:the cumulative execution time of the process
14.CMD:the command name
process state:
1.O:the process is running
2.S:the process is sleeping
3.R:the process is runable and on the run queue
4.Z:the process is in a zombie state
5.T:the process is stopped due to being traced or because of a job control signal
prstat:displays process statistics on all processes on the system and refreshed them every 5 minutes,unlike the ps command,the prstat provides a built-in sorting mechanism
prstat command options:
1.-a:shows process information and summarized statistics per user
2.-n <number>;:shows only the first number matching the sort criteria
3.-p <pid-list>;:shows information only about processes with a process ID in the given list,the list must be comma delimited
4.-s <keyword>;:sorts output in descending order according to the keyword
5.-v:provides addtional process usage data
6.-G <gid-list>;:lists information for processes for which the real group ID numbers are given in gid-list,the list must be comma delimited
7.-U <uid-list>;:lists information only about processes with a real UID given in the list that follows it,the list must be comma delimited
8.-S <keyword>;:sorts output in ascending order according to the keyword
(prstat command uses the most CPU time of any process on the system)
the prstat sorts keyword:
1.cpu:sorts by process CPU usage(default)
2.time:sorts by process execution time
3.size:sorts by process image size
4.rss:sorts by resident set size
5.pri:sorts by process priority
prstat output:
1.PID
2.USERNAME:login name of the process owner
3.SIZE:total virtual memory size of the process
4.RSS:resident set size of the process
5.STATE:process state
6.PRI
7.NICE
8.TIME:execution time of the process
9.CPU:percentage of CPU used by the process
10.PROCESS/NLWP:name of the process and number of LWPs in use
11.USR:percentage of time spent in user mode
12.SYS:percentage of time spent in system mode
13.TRP:percentage of time spent processing system traps
14.TFL:percentage of time spent processing text page faults
15.DFL:percentage of time spent processing data page faults
16.LCK:percentage of time spent waiting for user lock
17.SLP:percentage of time spent sleeping
18.VCX:number of voluntary context swithes
19.ICX:number of involuntary context swithes
20.SCL:number of system calls
21.SIG:number of signals received
Certifications Objective 7.02
Understanding the Effect of Sending a Specified Signal to a Process
signal:a message sent to a process to affect its operation.Solaris9 has 42 different signals that can be sent
when a process receives a signal,it can do 1 of 3 things:
1.ignore the signal
2.take a specific action,such as closing all open files and exiting
3.take the default action for the signal
to ignore the signal or take special action,a process must have signal handlers specified.a signal handler allows a process to intercept the signal and do what the handler wants with it
to view how a process handles each signal,use psig command.the psig command takes 1 or more PIDs as parameters and prints a listing showing each signal and the process' response to it:
psig < ID>;
all signals except for 2,can be handled in this manner:
1.SIGKILL(9):can be sent to a process to force it to release any resources it is using and then die unceremoniously
2.SIGSTOP(23):is used in shell-based job control.typically,excuting CTRL-Z on an active process sends the process a SIGSTOP,which suspends the process.the same result can be achieved using the pstop command,which accepts a PID as a parameter
the complement to SIGTOP is SIGCONT(25).this signal returns a stopped process to its previous state
the psrun command can be used to send a SIGCONT to a stopped process
nice:provides a sysadmin with a simple method to change the priority of a process.by default,the nice value is set to 20.you can verify this by excuting ps -elf command,and examing the NI field.the range of the nice value is from 0 to 39.you can modify the priority like this:
nice <-n (increment)|-n (-increment)>; < ID>;
eg.to add 10 to PID 2231
nice -n 10 2231
renice:is similar to nice command except that it works on processes already excuting on the system
renice <-n (increment)|-n (-increment)>; -p <pid-list>;:change the priority according to pid-list
renice <-n (increment)|-n (-increment)>; -u <uid-list>;:change the priority according to uid-list(or username)
renice <-n (increment)|-n (-increment)>; -g <gid-list>;:change the priority according to gid-list(must be GID)
(-g,-p and -u are exclusive)
SIGHUP is sent to all processes when a controlling terminal is disconnected-for instance,when a user log off
nohup:allows a process to ignore the SIGHUP signal and continue operation even after a user at /usr/sbin/nohup and takes only 1 option
eg.to nohup a command named input_data,you would excute:
#nohup ./import_data &
this example would leave a file named nohup.out containing all output of the command in the current directory,if the user didn't have write permissions to the current directory ,it would be created in the user's home directory
common signals:
1.SIGHUP(1):generated when controlling terminal is disconnected.used by many system daemons to trigger a reread of configuration file
2.SIGINT(2):generated when a user excutes CTRL-C on the current process(excute stty -a and examine the INTR field for the exact value on your system) in a shell that supports job control
3.SIGQUIT(3):generated when a user excutes CTRL-\ on the current process(excute stty -a and examine the INTR field for the exact value on your system) in a shell that supports job control
4.SIGKILL(9):terminates a process with extreme prejudice.the process is not allowed to clean up after itself;open files could be corrupted
5.SIGTERM(15):gracefully allows a process to exit default signal sent by kill and pkill
6.SIGSTOP(23):stop a process
7.SIGCONT(25):starts a stopped process
Certifications Objective 7.03
Using Commands to Terminate an Active Process
there are 4 processes that cannot be terminated:
1.sched
2.init
3.pageout
4.fsflush
kill -l:list all signals available to kill
kill -s <signal>;:specifies signal to send
kill <signal>;:specifies signal to send
kill < ID>;:the PID to send signal to
eg.if you ant kill PID 1212,you can:
kill -s HUP 1212 or kill -HUP 1212 or kill -l 1212
(note that when specifying the signal name rather than PID,you must drop the SIG suffix)
the default signal sent by kill and pkill is SIGTERM(15),not SIGKILL(9)
pgrep:allows you to quickly retrieve the PID of a process based on a substring of the process name
eg.to retrieve the PID of the syslogd process,excutes:
#pgrep syslogd
3527
pgrep -l:long output format
pgrep -v:negation options;not matches any process except those that match the expression
pgrep -x:matches substring against process exactly
pgrep -G <group-list>;:specifies processes owned by any group in group list.this list must be comma delimited and may include GIDs or group names
pgrep -U <user-list>;:specifies processes owned by any group in user list.this list must be comma delimited and may include UIDs or usernames
pkill:is similar to pgrep except that it eliminates the -l option and replaces it with an option to specify a signal to pass
eg.pkill -HUP -x syslogd
Certifications Objective 8.01
Knowing the Types of File Systems in the Solaris Operating Environment
file system:refers to a mounted directory and a file hierachy.it is used to store and organiza groups of related directories and files.file system can exist locally or remotely
Solaris file system types:
1.disk-based file system that exist on the physical disk devices local to the system
2.virtual or RAM-based file systems that exist in the memory of the system
3.networked-based file systems that are mounted remotely,over the network,from another system
4 types of standard disk-based file systems:
1.UFS:the UNIX file system type is the default type of file system for the Solaris operating environment.this file system type is based on the BSD fast file system
2.HSFS:the high sierra and ISO 9660 file system standard type is used for mounting media with read-only data,such as CD-ROMs
3.PCFS:the personal computer file system type is used for reading and writing DOS-formatted floppy disks
4.UDF:the universal disk format file system is the industry-standard format used to store information on optical media technology.this UDF file system type is mainly used for reading information from DVDs,but it can also be used for CD-ROMs and floppy disks that contain UDF file systems
file system logging:is the process of storing transactions(change that make up a complete file or directory operation) in a log before they are applied to the file system.it offers 2 advantages:
1.it prevent file system from becoming inconsistent,therefore eliminating the need to run fsck
2.because fsck can be bypassed,UFS logging reduces the time required to reboot a system when it is stopped other than via an orderly shutdown
virtual file system:are used to improve I/O performance
1.CACHEFS:the cache file system type is used as a disk cache area to speed access to slower file systems such as CD-ROMs(HSFS) or network-based file systems(NFS)
2.FDFS:the file descriptor file system type provides specific names for operating files using file descriptor
3.LOFS:the loopback file system type is used to creata a vietual file system that allows thesystem to access files using an alternative path
4.NAMEFS:the name file system type is used by STREAMS for dynamically mounting file descriptor over files
5.PROCFS:the process file system type is used by the system by PID under /proc.deleting process files from /proc directory will not kill the processes./proc is a virtual file system and therefore uses no disk space
6.SPECFS:the special file system type provides access to character special and block devices
7.SWAPFS:the swap file system type is used to provide swap space to the system
8.TMPFS:the temporary file system type is used by /tmp file system operations.it is much faster than a disk-based file system
network-based file system:
NFS:the network file system type is used by the system to mount remote file systems from other servers over the network
Certifications Objective 8.02
Performing Common File System Administration Task
newfs nce you identify a disk partition that you would like to mount as a file system,you must run the newfs command to make it usable to the operating system
eg.newfs /dev/rdsk/c0d0s0
(3% of the actual space available has been reversed for system maintance)
fsck:checks and,if necessary,repair the integrity of file systems before they are mounted
eg.using the fsck command to check and repair a file system:
#fsck /dev/rdsk/c0d0s0
** /dev/rdsk/c0d0s0
** last mount on
** phase1-check blocks and sizes
** phase2-check path name
** phase3-check connectivity
** phase4-check reference count
** phase5-check cylinder group
<output omitted>;
possible disk problems:
1.free data blocks claimed by files
2.free data block count
3.free inode count
fsck -y <device path>;:automatically take default corrective actions when file system problems are discovered
when you log in to a system the first time,you can run the mount command or look at the /etc/mnttab file to see which file systems are currently mounted
df:shows which file systems are largest or which ones you have more space available.default is in blocks
df -k:shows in kilobytes
du:display the size of a single subdirectory contained on a file system.
du <directory name>;:shows in blocks, output is provided for every directory under current directory,as well as itself
du -k <directory name>;:shows in kilobytes
du -s <directory name>;:simply reports the total size of the specified directory in blocks
(du command discerns no difference between a file system and a directory)
remember the f in df is for file system;therefore,the df command is valid only for mounted file system.in contrast,the du command can be excuted on any directory including a file system
quot:display how much disk space each user is using in each file system,this command can be issue only by the root user
quot -a <fils system name>;:to report on all mounted file systems
quot -f <fils system name>;:report the number of files
(in fact,the quot command can be excuted only on a file system)
Certifications Objective 8.03
Understanding the Effect of the Commonly Used Options of the mount Command
file system must be mounted,or attached to the file system hierachy,before they can be accessed by users and programs on the system.of course,the root file system is always mounted,and all other file systems mount somewhere beneath it
mount:it can be used to display file systems that are currently mounted on a system or to mount an entirely new file system,to display the current fils systems ,issue the mount command with no arguments
to use the mount command to mount a fils system,you must provide it with 2 parameters:
1.the device path to the file system on the disk partition
2.the mount point directory
(the mount point directory must be created prior to issuing a mount a command,or it will fail)
the umount command requires only 1 parameter:the device path to the file system on the disk partition or the mount point directory
mount <device path>; <mount point directory>;
mount -F <FS type>; <device path>; <mount point directory>;
eg.to mount a CD-ROM:
#mount -F hsfs /dev/dsk/c0t5d0 /cdrom
mount -o <option>; <fils system>;
mount options:
1.largefiles | nolargefiles:
file system:UFS
description:determines whether the file system can contain files larger than 2GB,default is largefiles
2.logging | nologging
file system:UFS
description:logging helps prevent UFS file systems from becoming inconsisten,which means fsck can be bypassed.bypassing fsck reduces the the boot time after an unclean shutdown.default is nologging
3.atime | noatime
file system:UFS
description:determines whether the access time is updated on files.turning this option off can greatly reduce disk activity and improve performance.default is atime
4.remount
file system:all file system
description:allows changing the mount options of a file system that is already mounted
5.ro | rw
file system:CACHEFS,NFS,PCFS,UFS
description:determines whether the file system is read-only or read-write,default is rw
6.suid | nosuid
file system:CACHEFS,HSFS,NFS,UFS
description:allows(suid) or progibits(nosuid) setuid excution.default is suid
7.bg | fg
file system:NFS
description:in case the first mount attempt fails,dictates whether mount retries occur in the backgroud.default is fg
8.hard | soft
file system:NFS
description:in case the server does not respond to the mount command,dictates whether an error is returned(soft) or the mount is retried until the server responds(hard).default is hard
9.intr | nointr
file system:NFS
description:determines whether keyboard interrupts are deliverd to a process that is hung while waiting for a response on a hard-mounted file system.default is intr
10.retry=n(numeric)
file system:NFS
description:determines how many times a failed mount operation will retry
Certifications Objective 8.04
Diferetiating Between the /etc/mnttab and /etc/vfstab Files
/etc/mnttab:mounted file system table,a system-generated file that contains information about each file system that is currently mounted on Solaris9 system
/etc/vfstab:virtual file system table, a manually edited text file,owned by the root user,that determines which file systems will be mounted(and with what mount time options) during system startup
when a file system is mounted either manually or automatically,it creats an entry in the /etc/mnttab file
eg.#cat /etc/mnttab
/dev/dsk/c0d0s6 /data ufs largefiles,dev=1980006 947708660
<output omitted>;
1./dev/dsk/c0d0s6:the device path to the file system on the disk partition
2./data:the mount point directory
3.ufs:the file system type
4.largefiles,dev=1980006:the mount time options and device number
5.947708660:the time the file system was mounted
the /etc/mnttab file is an MNTFS read-only file system that provides mounted file system information directly from the kernel.if you attemp to write or if they use the -m option with the mount command to fake /etc/mnttab entries,it will cause existing programs or scripts to fail during the boot progress,several file systems are mounted automatically.by default,they are the following:
1./
2./usr
3./var
4./opt
5./proc
6./tmp
7./home or /export/home
because they have entries in the /etc/vfstab
some /etc/vfstab entries:
1.device:/dev/dsk/c0d0s6(the device path to the file system to be mounted)
2.device:/dev/rdsk/c0d0s6(the raw device path to the disk partition to fsck)
3.mount point:/data
4.FS type:ufs
5.fsck pass:2(the order or preference for fsck to follow)
6.mount at boot:yes(the mount at boot parameters;where the nondefault mount time options are listed)
the /etc/vfstab file can also contain entries that cause the system to automatically mount NFS file systems during bootup as well
in single-user mode,only some file systems are mounted,so mountall command,issued without arguments,will mount all the file systems listed in the /etc/vfstab file
the umountall command will unmount all the file systems listed in the /etc/vfstab file,with the following exception:
1./
2./usr
3./var
4./var/adm
5./var/run
6./proc
7./dev/fd
Certifications Objective 8.05
Understanding the Intended Purpose of Directories
/var/run:a new tmpfs-mounted file system,it is the repository for temporary system filesthat are not need across system reboots in this Solaris release and future release.the /tmp directory continues to be a repository for non-system files,because /var/run is mounted as a memory-based file system rather than a disk-based fils system,updates to this directory do not cause unnecessary disk traffic,this directory requires no administration,for security reason,/var/run is owned by the root user
the default Solaris file system:
1./:
file system:ufs
2./etc:
file system:ufs
description:the /etc directory is not a file system by default;rather,it is a part of the root directory's file system.it contains host-specific system administrative configuration files and database
3./export:
file system:ufs or NFS
description:the /etc directory is not a file system by default;rather,it is a part of the root directory's file system.it holds alternative versions of operating system.these alternative versions,accessed via NFS,are required by client systems whose architectures differ from that of server
4./home or /export/home:
file system:ufs or NFS
description:the standard home file system is mounted at either of these 2 directory mount points and is generally a locally mounted ufs file system but could be an NFS file system mounted remotely from an NFS server
5./opt:
file system:ufs or NFS
description:it is provided for optional,third-party software products.this file system is generally a locally mounted but could be an NFS mounted remotely from an NFS file server
6./tmp:
file system:tmpfs
description:this file system is actually mounted swap space used for the temporary storage of files.all files are deleted each time the system is booted or the file system is unmounted
7./proc:
file system:procfs
description:it is mounted and used by the system specifically for maintaining a list of active processes by PID
8./usr:
file system:ufs
description:it is used to store system files and directories
9./var:
file system:ufs
description:it is used to store system files and directories that have variable sizes,this is where the system log files are located
Certifications Objective 8.06
Accessing Data on Disks or CD-ROMs
you use the fdformat command to format the floppy disk,it accepts the following options:
1.-v:verifies proper formatting
2.-U:unmounts the disk(if it is mounted)
3.-D:formats at 720KB instead of default 1.44MB
4.-e:ejects the disk when formatting finishes
5.-f:forces format without configuration
6.-b:lables the newly formatted disk with the provided name of 8 characters or fewer
7.-z:lists all fdformat command options but doesn't actually format the disk
(when the fdformat command completes,you now have a DOS-formatted disk ready for use)
once your floopy disk has been DOS formatted,to have a ufs placed on it,you must use the volcheck and newfs commands
volcheck:verifies that you have a properly formatted floppy disk inserted into the disk device.excutes this command with the following syntax:
$volcheck -v
(this command indicates that the disk is ready to have a ufs placed on it by responding with the message "Media was founding".once this check has completed successfully,you can continue by using the newfs command)
newfs:allows you to creata a new file system.the syntax is as follows:
$newfs -v /vol/dev/aliases/floppy0
(-v option means verbose)
volrmmount:used to mount or unmount removable media such as floppy disks.it accepts the following options:
1.-i:mounts a newly inserted disk
2.-e:unmounts a currently mounted disk
eg.$volrmmount -i floppy0
you can examine the disk's contents using the ls command.2 options are presented here:
1.-L:shows symbolic links
2.-l:long format
eg.$ls -l /floppy/floppy0
ls -l /cdrom/cdrom0
eject:eject the disk
eg.$eject floppy0
$eject cdrom0
if volume management is running,and it is by default,a CD-ROM is automatically mounted to /cdrom.if volume management is not running,it can be manually mounted as follows:
$mount -F hsfs -o ro /dev/dsk/c0t0d0s0 /cdrom/cdrom0
(volume management can be turned on and off with the following commands:
# /etc/init.d/volmgt start
or # /etc/init.d/volmgt stop)
fuser:determine if any users are currently accessing a file system.it accepts the following options:
1.-u:display the names of users who own processes currently accessing the specified file system
2.-k:kills all the processes currently the specified file system
eg.$fuser -u /floppy/floppy0
$fuser -k /cdrom/cdrom0
a file system,by default is a directory,but most directories are not file systems.the difference is that a file system can be mounted and unmounted,and a single directory cannot
Certifications Objective 9.01
Reducing the Size of File and Directories for Tape Storage
tar: used to decrease the size of the files to be saved as it is a way to collect all the files together in a single place.the syntax is:
tar <c|x|t|r|u>; <plv>; <f >; <archive>; <file list>;
tar's modes:
1.c:creata,creata a new tar archive,named archive,containing file list
2.x:excat,extract the files in the file list from archive
3.t:list,list the files,the table of contents,of archive
4.r:append,appends the files in file-list to the end of archive
5.u:update,appends the files in file-list to the end of archive if they are already in the archive and have been modified since the archive was created.note that the original file is not removed from the archive
6.p:normally when tar extracts files from an archieve,they are created with ownership and permissions of the user running the command,this option instructs tar to preserve the ownership and permissions as specified in the archieve
7.l:directs tar not to cross a file system boundary when it is adding files to an archieve
8.v:verbose output
eg.$tar cf book.tar ch1.doc ch2.doc ch3.doc
$tar xf book.tar ch2.tar
(prior to Solaris2.7,all patches from Sun came compressed in a tar archieve)
compress:make a single file take up less room by using the Lempel-Ziv encoding format,the file is renamed with a .Z extension if the command is able to successfully compress a file;all other inode information is unchanged.the syntax is:
compress <-cfv>; -b <bits>; <file>;
compress's options:
1.-c:instructs compress to write its output to standard output(the screen) rather than modifying the file on disk
2.-f:forces the compress command to run without asking for verification
3.-v:instructs compress to report the percentage of compression achieved to standard output
4.-b:this option and its argument,a number between 9 and 16,determine how large a set of bits the command attempts to replace.the larger the number of bits that can be replaced,the more compressed the file will be
uncompress:takes a compressed file and uncompresses it,saving it without the .Z extension.the syntax is:
uncompress <-cfv>; -b <bits>; <file>;
uncompress's options are similar to compress's options
zcat:is exactly the same as calling uncompress with the -c options;it uncompresses the file in memory,sending the output to standard output and leaving the original file untouched.the syntax is:
zcat <file>;
pack:is a functional equivalent to compress,if pack is able to compact a file,it is saved with a .z extension.it can take a single option,-f option,to force the compacting.unlike compress,which can have pathname(directory plus filename) lengths of 1024 bytes,pack is limited to use on files where the filename is 12 bytes(usually characters) or shorter
unpack:unpack a file.the syntax is:
unpack <file>;
pcat:it is like zcat.the syntax is:
pcat <file>;
zip:this process can be thought of as similar to a compress and a tar command in reverse order,using a single command.the syntax is:
zip <-dfmu>; <-r>; <file>; <file list>;
zip's options:
1.-r:recursively search in subdirectories for files
2.-f:replaces(freshen) any files in it if they have a more recent modification date than the one store in the zip file
3.-u:is similar to -f option,except that it also adds any new files to the zip file that are not already there
(if a file is freshed from either -f or -u,the old file will be removed from the zip file)
4.-d:if zip is passed the -d option and a list of files,it deletes those files from the named zip file
5.-m:used to move the files into the zip file;once the files are compressed and copied,they are deleted from the directory
unzip:unzip a zip file.the syntax is:
unzip <-lt>; <-fnou>; -d <directory>; <file>; <file list>;
unzip's options:
1.-l:provides a list of all the files in the zip file
2.-t:the files will be unzipped in memory and their CRC will be checked
3.-f:causes files that already exist to be updated if necessary
4.-u:causes new files to be created if they do not already exist
5.-n:used to stop existing files from being overwritten by -u(used together,they will cause only new files to be created.files that already exist will not be touched)
6.-o:used to canse unzip to do unsafe overwritting of files;files that already exist are overwritten without prompting for verification
using tar and zip should provide better compression than zip alone
(patches are now distributed only in the zip format)
Certifications Objective 9.02
Understanding Regular Files,Directories,Symbolic Links,Device Files,and Hard Links
inode:an inode contains information about a file:the type of file,the owner,the access and modification times,the access permissions,the number of links to the file,the size of the file,and the physical location of the data blocks
(note that the filename and directory locations are not comtained in the inode;this information is contained in the directory entry.the data blocks contain the actual information in the file)
cylinder group:the space where the inode group lives in
as the file system is used,data blocks for one inode group could end up in the space for another inode group,this process is known as fragmentation.if a file system becomes highly fragmented,performance will degrade.the only way to reduce fragmentation is to copy all the files from the file system,recreate it ,and replace the files
ls -i:lists the inode and the name o a file
ls -l:lists the type and permissions,the links,the owner,the size,the last modification time,and the name of the file
regular files can be either text or binary
determine file type from ls -l:
1.d:directory
2.D:door
3.l:symbolic link
4.b:block special file
5.c:charater special file
6.p:FIFO(or named pipe) special file
7.s:AF_UNIX address family sockets
8.-:ordinary file
a directory does not actually co |
|