basics
This pages are intended to help Solaris beginners..
Let us start with some basic commands
1 ls | ls –l :To list the files at current location
2 mkdir :
3 cd
4 df | df –k :To view disk free
5 du :To view disk usage
6 cat >
7 pwd :To view current location
8 rm
9 cp :
10 mv :
11 touch :
12 chmod <>
group & other | i.e. : r=4 w=2 x=1 by total 7
13 clear : To clear the screen
14 man
15 bc :Binary count
16 cal :To view calculator
17 banner
18 date :To view date
19 find / -name
20 grep :
21 getent :
22 wc
23 sort
24 head -<100> :
25 tail -<100>
26 ln
number, link count increases
27 ln –s : for soft link If source is lost entire content is lost, L will
be at the front of filename
28 useradd –m –d
:To create a user account | u-user id, g-pri.
group, G-sec. group, m-mk dir, d-path
29 passwd :
conjunction with passwd command for changing all passwd file information
30 usermod |userdel
31 groupadd –g
32 /usr/sadm/bin/smuser add -- -n
33 /usr/sadm/bin/smuser modify -- -n
34 /usr/sadm/bin/smuser delete -- -n :
35 smgroup | :same as above 3 To create, modify and to delete a smgroup
36 smc& To invoke the SMC tool in GUI mode
37 umask
i.e “/etc/profile” | attains default – restarted
38 vi
39 Prtconf :To view system config–memory, peripheral
40 prstat –a :To view the system process status
41 Psrinfo –v : To view information about the processor
42 iostat -En |-xtc 5 : To view the i/o device status
43 Sdtprocess :To view the current system process status
44 sar :
46 Format :To make slices in an hard disk
47 devfsadm –v :To identify the hardware changes
48 devfsadm –C : To invoke cleanup | then only –v fn works
49 newfs /dev/rdsk/c#t#d#s# :To make a new file system on the disk
50 mount /dev/dsk/c#t#d#s# / :
51 Dmesg :To view the diagnostic messages
52 Eeprom : To view the environment messages
53 uname –m | -a :To view the m/c name, version, archi. etc.,
54 /usr/platform/”uname-m”/sbin/prtdiag –v :To view the entire system status includes
memory, cpu, patches, os-version, etc.,
55 pkgadd –d
btw_only copies the pkg to spool directory
56 pkgchk
57 pkginfo :
58 pkgrm
59 pkginfo |wc –l :To check for number of packages installed
60 fstyp –v /dev/rdsk/ctd#s# :To check for the current “minfree” value
61 tunefs –m # /dev/rdsk/ctds :To set minfree value i.e #% with that of root
62 fsck –o f,p /dev/rdsk/ctds# To run file system check | -o f, p for yes to all
63 fsck –o b=# /dev/rdsk/ctds To restore backup sup. Block|#-sup. Block
64 quot |-af root To view summarized FS ownership
65 mountall To mount all FS which have entry at vfstab
66 mountall –l To mount only the local FS listed in ‘vfstab’
67 umount
68 umount -f ---do--- To unmount forcible | may affect data
69 Umountall To unmount all mounted FS includes N/W
70 umountall –l To unmount all locally mounted FS
71 fuser
72 fuser –ck
73 Volcheck :To check whether the floppy is ready or not
74 /etc/init.d/volmgt start : To start the volume mgt | to stop, give stop
75 mount –F hsfs –o r0 /dev/dsk/ct#d#s# /cdrom :To mount a cdrom manually
76 mount –F pcfs /dev/diskette/pcfs :To mount a floppy drive manually
77 tar –xvf
78 patchadd
79 patchrm
80 init 0 To OK prompt
81 init 1 To single user mode
82 init 2 To multi user without network
83 init 3 To console – super user | multiuser with nfs
84 init 5 To shutdown the server
85 init 6 To restart the server
86 init s To single user mode
87 shutdown –y –g <#> -i
mode| # - grace time in seconds
88 Halt To switch over to OK prompt suddenly
89 poweroff | Reboot Alternate command to switch-off & restart
90 who –r To view the current run level
91 who | -a To view all logged-in users in the local sys
92 who –m To view the current user name alone
93 whoami | who I am To view effective user | To view actual user
94 rusers –l To identify all users logged in through n/w
95 finger |-m
96 last |
97 last -n 5 reboot To view only the last five reboot activity
98 chown root : sys
/var/adm/loginlog
To activate loginlog entry i.e. to note the
failure login |you must create the directory
99 su
100 chown
101 chmod 1777
Sticky bit permission | user can access dir
102 chmod 4555
103 chmod 2555
104 lpadmin –d
105 lpstat –d To view the systems default printer
106 lp
107 reject
108 disable
109 enable
110 accept
111 /usr/lib/lpsched | lpshut
(or) /etc/init.d/lp start | stop
To start the LP printer service | To stop
the LP printer service
112 lp –d
113 lpstat –a
114 lpmove
115 at
116 crontab –e |-r to remove job To assign a job in crontab – it opens a editor
117 at -l & crontab –l To view the AT and crontab content
118 ufsdump 0uf /dev/rmt/0n
/dev/dsk/c#t#d#s#
To perform backup | 0-full backup, uupdate{/
etc/dump dates}, 0-drive or disk
number i.e for incremental, n-no rewind
119 ufsrestore rvf /dev/rmt/0 To restore the backup
120 ufsrestore i /dev/rmt/0 To view the list of files present in the tape
121 mt status |rewind |offline To view the status| To rewind | To eject
122 mt fsf count To move the tape forward count records
123 fssnap –F ufs –o
bs=/var/tmp /export/home
To perform a snapshot backup which
usually stores at /dev/fssnap/0
124 fssnap –i To display a list of snapshot ct avail in sys.
125 prtvtoc /dev/rdsk/ct0ds2 >
/
to an file through prtvtoc
126 fmthard –s /
To copy the structure from /
make available on the destiny hard disk
Solaris Commands For SA-I & SA-II
4
Vi Editor Commands
S.No Commands Functions
1 vi
2 Esc h To move the cursor left - command mode
3 Esc l To move the cursor right - command mode
4 Esc j To move the cursor down - command mode
5 Esc k To move the cursor up - command mode
6 Esc i To Enter into Insertion mode
7 Esc x | 4x To delete a character | deletes 4 character
8 Esc X | 4X To delete left i.e. Back-Space
9 Esc R To over-write a character
10 Esc o To insert a line below the cursor
11 Esc O To insert a line above the cursor
12 Esc u Undo
13 Esc G To move to the last line first character
14 Esc w To move word by word right
15 Esc b To move word by word left
16 Esc H To move to the first line of the current page
17 Esc M To move to the middle of the current page
18 Esc L To move to the last line of current page
19 Esc I To move to the beginning of the line &
append
20 Esc A To move to the end of the line & append
21 Esc dw To delete a word to the right
22 Esc dd To delete the current line completely
23 Esc yy To copy the current line – yanking
24 Esc p To paste the copied content
25 Esc yw To copy a word – cursor must be at the
starting
26 Esc J To join two separate line
27 Esc ~ To change the case i.e. upper to lower & Vvia
28 Esc : wq To save & quit a file – EX-command mode
29 Esc : wq! To save & quit a file forcibly
30 Esc : !sh To go to shell temp. & type Exit to come
back
31 Esc : r!
32 Esc : r
file
33 Esc : q To quit the file without saving
34 Esc : q! To quit the file without saving – forcibly
35 Esc : w To save the file and continue working
36 Esc ZZ To save & quit the file
37 Esc : set nu To assign the number for the lines
38 Esc : set nonu To remove the assigned number for the lines
39 ctrl f Page down
40 ctrl b Page Up
OK Prompt Commands
1 stop a To get into OK prompt
2 stop d For extensive post diagnostics
3 stop n To set default parameter |press until kbd led
flashes
4 boot cdrom To boot from cdrom
5 boot cdrom –s To boot and get into single user mode using
cdrom
6 boot –r To reconfigure |config result will be at
/reconfigure
7 Boot To boot through the default configuration
8 boot disk To boot via specified disk|devalias - entry
must exist
9 boot –s To get into the single user mode
10 boot –a For interactive booting
11 boot –v Detailed device information to the console
12 Help To get command details at OK prompt
13 Printenv To print the environment detail
14 setenv
15 reset-all To save the changes and followed by reboot
16 set-defaults To set the values to the manufacturers
setting
17 set-defaults To set the value for a specific parameter
alone
18 probe-scsi | -ide To check for internal scsi/ide status
19 probe-scsi-all |-ide-all To check for internal & external scsi/ide
status
20 probe-fcall-all To check for fiber optics status
21 Devalias To view the alias name & to which its
mapped
22 nvalias
the list
23 nvunalias
24 show-disks To see the physical add of all drives i.e. sec
storage
25 .version To view the version, Ethernet address
details etc.,
26 .speed To view cpu speed, bus speed, etc.,
27 .enet-addr To view only the Ethernet address
28 Showdevs To view all the devices i.e. secondary
storage only
29 Banner To view the ip, mac add, subnet mask etc
30 watch-net To view the status of NIC card
31 watch-net-all To view the status of NIC and network cable
Abbreviation
1 Hme Network Interface Card
2 Qfe Quad Fast Ethernet
3 c0t0d0s0 Controller Target Disk Slice
4 Sparc Scalable Process Architecture
5 UFS Unix File System – for disk mgt
6 HSFS | under ufs High Sierra FS – for SCSI cdrom’s
7 PCFS | under ufs PC-DOS Formatted FS – for floopys
8 NFS | under Distributed FS Network File System – for network
9 TmpFS | under Pseudo FS Temp. FS – for avoid Overhead writing
10 SwapFS | under Pseudo FS Swap FS – for Kernel use
11 FDFS | under Pseudo FS File Descriptor FS – for explicit names
12 Explicit Name It’s the representative of Directory’s
13 ProcFS | under Pseudo FS Process FS –for currently running proc.
14 MntFS | under Pseudo FS Mount FS – for locally mounted FS
Important Locations
1 /etc/profile umask value | profile during login
2 /etc/path_to_inst Physical address mapping - for kernel
3 /usr/bin/dmesg
/usr/sbin/dmesg
Diagnostic message will be here dmesg _shows the content of this files
4 /etc/default/kbd kbd –I _ To initialization above file
Put # before keyboard_abort=disable |this is for preventing stop A in console
5 /var/sadm/install/contents Contains details about installed packages
6 /var/spool/pkg Default location for adding a package
7 /var/sadm/pkg It has the currently installed package
8 /etc/vfstab _ Manual Entry Entries for mounting FS during booting
9 /etc/mnttab _ Auto Entry Entries for currently mounted FS
10 /var/sadm/patch It has the currently installed patches
11 /usr/bin Mostly all commands will be here
12 /var/adm/utmpx Who command reads this location Alone
13 /var/adm/wtmpx last -n command reads this location
14 /var/adm/loginlog _ create it To view the failed login attempts
15 /etc/default/su To view the switching attempts | For this remove
# in console= /dev/console and put #in more /var/adm/sulog
16 /etc/default/login_ edit this file for root logging restrictions |
If PASSREQ=no then null password for root
If #console=/dev/console _ remote root login is allowed,
if no # _ only through single machine,
if console=
17 /etc/ftpd/ftpusers Users listed here are not allowed for ftp
18 /var/spool/lp It holds the request and the print Queue
19 / var/lp/logs It holds the history of the printer jobs
20 /etc/lp It has the LP server configuration
21 /etc/hosts _ manual entry contains IP and hostnames of sys. In n/w
22 /etc/cron.d/at.deny|cron.allow To restrict users from using AT & Cron
Hints & Purposes
1 Host Bus Adopter All harddisk will have a common HBA
2 Max 7 Slices Only 7 slices are possible in a hard disk
3 Slice S2 – Back Up Points entire disk – cant be changed or used
4 SUNWCxall Entire Distribution with OEM support 64 bit
5 SUNWCall Entire Distri 64 bit – no 3rd party support
6 SUNWCprog Developer Sys Supp –only manuals & network
7 SUNWCuser End User Sys Supp – limited network support
8 SUNWCreg Core Sys Support – no network
9 Web Installation 1st Installation CD then 1 of 2 CD & 2 of 2 CD
10 JumpStart Installation Installing the OS through network
11 Vi Editor – 3 Modes Command, Insert and Ex-Command Mode
12 OE file system Disk based(ufs), Distributed(nfs) & Pseudo(swap)
13 File Types – 4 types Regular, directories, symbolic link & device files
14 Device naming Logical, physical(actual) & instance(kernal) name
15 Sd n | dad n For scsi | ide n-number – instance name
16 NV Ram – EEPROM Removable chip, inbuilt Lithium battery, host id
17 # before any line in a file This makes that particular line or process inactive
18 Booting of Sun System
Post, generic devi ce drivers, loads config done
by admin, other default parameter, then OS files
19 Backup Superblock It resides at several areas of disk| for restoration
20 Cylinder group – size Default size is 16 cylinders per group
21 Boot block – active for ‘/’ Boot strap program resides here – 15 disk sector
22 Pointer types Direct Pointer and Indirect Pointer
23 “Minfree” Value It’s the space utilized by the operating sys in root
24 Preen During sys boot fsck runs at Non Intractive mode
25 Vol Mgr -/etc/vold.conf Automatically mounts the cdrom and floopy
26 105050-01 patch name 105050 is base code & 01 is the revision number
27 sys wide & user environ While user logs this files get executed by shell
28 Restoresymtable This is a image file of tape formed in hard disk
29 /etc/hosts It is an link to /etc/inet/hosts
30 /opt Common location for utilities and 3rd party tools
31 RSC Remote System Console |consist of serial, n/w mgt port and modem
32 LOM Light Out Management | consists of only serial port and not a part of OS.
33 ALOM Advanced LOM | Consists of serial port and a part of OS and also an
n/w mgt port.
34 SCC System Controller Card | nvram data are stored here its an removable card – resp’ble for booting
35 KVM switch Keyboard Video Mouse switch |common unit
36 Part Number Identity Number 300-4250 |product-exact no/.
Steps Involved In Restoring Root From Tape
ok boot cdrom –s
$ newfs /dev/rdsk/ c0t0d0s0
$ mount /dev/dsk/ c0t0d0s0 /a
$ cd /a
$ ufsrestore rf /dev/rmt/0
$ cd /usr/platform/”uname-m”/lib/fs/ufs
$ installboot bootblk /dev/rdsk/c0t0d0s0
$ umount /a
$ fsck /dev/rdsk/c0t0d0s0
usr/bin -> for all users usr/sbin -> only for root
1 sys-unconfig _ sys restarts To get into the network config. Section
2 ifconfig –a To view ip, mac add, subnet mask,etc status
3 ifconfig hme0
as to make the network up
4 ifconfig hme0 up | down To enable network interface | disable
5 snoop
6 rpcinfo –p |
7 rpcinfo –d
| To reactivate your service again
8 etc/init.d/init.wbem status| start | stop To view the status of the SMC service |To
start service | To stop service
9 Smc To open SMC
10 smc edit To open SMC toolbox editor
11 pagesize | default is 8192 b To view the size of memory page
12 /var/sadm/smc/toolboxes/smc/smc.tbx &
/var/sadm/smc/toolboxes/this_computer/this_computer.tbx
Default location for SMC toolbar smc edit command will make effect on this
two files
Introduction To IP - Version IV
/etc/rcS.d/S30network.sh _solaris 8|/etc/rcS.d/S30rootusr.sh _sol 7 & below
During booting of sys these files get exe. This uses ifconfig utility & searches
etc/hostname.xxn to identify instance |xx _ hme/nic
/etc/inet/hosts _ this can be used instead of DNS,
It contains ip,hostname, nickname, comments.
Starting server processes :
To start and stop any event at starting
During the booting of system, the inetd daemon starts few services like
DNS, etc. which are not automatically start at boot time. We can view the list of services
that were started by inetd are at /etc/rc2.d/S72inetsvc. Apart from this file the inetd
consults the /etc/inetd.conf to find the service to activate.
In order to stop any event init just put # before the service in the /etc/rc2.d/S72inetsvc
and then execute pkill-HUP inetd command for instant effect.
important files responsible for the network
/etc/nodename Hostname of the server eg: bomexport
/etc/hostname.xxn Hostname of the service or server
/etc/inet/hosts All IP address and hostname of other servers
/etc/net/ticlts/hosts Hostname of the server twice – transport layer independent
/etc/net/ticots/hosts Hostname of the server twice – transport layer independent
/etc/net/ticotsord/hosts Hostname of the server twice – transport layer independent
Either edit these files or else give sys-unconfig in order to configure the network
SWAP Expansion
#swap –s _ to display the virtual swap area
#swap –l _ to display the physical swap area
Adding swap space by slice:
_ create a slice of required size in hard-disk
_ add the entry for that slice in /etc/vfstab for an permanent effect
_ swap –a /dev/dsk/c#t#d#S# | to activate the swap space
Adding swap space by file:
_ #mkfile
_ #also add an entry in the /etc/vfstab for an permanent effect
e.g: export/swapfile -- -- swap -- no --
Removing a swap space:
_ #swap –d
_ remove the entry from the /etc/vfstab
_ delete the slice or file to free the utilized space
Crash Dump
#dumpadm _ its to activate the crash dump device for the fore-coming fault
Procedure to read the crash message:
_ cd /var/crash/”uname-n”/ -> log-into this location
_ mdb unix.# vmcore.# | mdb or adb
when you execute above command the prompt will change as below
> |when prompt is as shown
> ::status
> $c
> $q |to quit the prompt
when there is no prompt type $p>
then you will get the prompt as >
NFS - Network File System
_ Allows the multiple computers to use the same file, to reduce storage cost,
provide data consistency & reliability.
_ NFS daemon starts only when the system enters the run level 3
1 /etc/init.d/nfs.server start | stop To start & stop the NFS service manually
2 share –F nfs –o
3 mount –F nfs
4 unshare –F nfs
5 shareall -F nfs To share all resources listed in /etc/dfs/dfstab
6 unshareall –F nfs To un-share all resources listed as above
7 dfshares –F nfs
8 dfmounts -F nfs
9 mountall -r -F nfs To mount all remote file resources
10 umountall -r -F nfs To un-mount all remote file resources
1 /etc/dfs/dfstab Local resources that as to share at boot time
2 /etc/dfs/sharetab Currently shared local resources – auto entry
3 /etc/dfs/fstypes Default file-system for remote file system
4 /etc/rmtab FS that remotely mounted by NFS – auto entry
5 /etc/dfs/nfslog.conf NFS logging configuration file
6 /etc/default/nfslogd Configuration files for the nfslogd daemo n
Syslog functions - configuring system messaging
The syslogd daemon and the input from /etc/syslog.conf files work together to facilitate
the syslog messaging for the OE
It can write message to the system log , centralized log host , messaging a user or at
the system console.
For this put the entry in /etc/syslog.conf file. The entries are the type of error [ i.e.
user.err ] and the action field [ i.e. /filename _ the target file, @host _ for specific host,
user _ for specific user, * _ for all logged in users ]
Daemons involved: /etc/rc2.d/S74 syslog
# /etc/init.d/syslog start | stop _ this is to start and stop the daemon.
Auto FS
It provides an automatic mounting using NFS protocol
Its an client side service
Components of auto-mount facility:
Auto FS file system, Auto-mountd daemon, Auto-mount command , Auto FS file system
mount-point is defined in the auto-mount maps on the client system.
Configuring Master Map:
For all types of auto sharing methods the entry must be here. Hence this remains the
base entry for all sharing methods. Edit /etc/auto_master
----------------------entries-------------------
+auto_master # +_ indicates that consider automountd daemon
/home auto_home -browse, (or) -nobrowse
--------------------------------------------------
#automount _ reactivate the above file again
Then shared resources get mounted below the /home/
This map is only for general directory’s, and common sharing files (eg: softwares). In
case 1 server is down then it can be get from other. Edit /etc/auto_direct
----------------------entries-------------------
/usr/share/man -ro, soft ser1, ser2, ser3:/usr/share/man
--------------------------------------------------
#automount _ reactivate the above file again
Indirect Map Entries:
This mapping is for user home directories and for their files.
Edit /etc/auto_home
----------------------entries-------------------
magi server_primary:/export/home/babu
--------------------------------------------------
procedure:
_ Create the account for the user in both the servers with same UID & GID
_ Put the entry for auto_home as shown above for a desired user e.g. babu
_ # passwd –h babu | in secondary server (/export/home/babu)? /home/magi | change
the home dir as desired
_ # cd /home/magi |in sec server to enter into the pri servers home dir. After all this files
are edited just type #automount -t
Comments