Wednesday, April 15, 2009

solaris qucik sheet

Solaris QuickSheet
Compatibility note: This document is based upon Sparc Solaris 10
OBP
 All the following commands are to be run from the OBP and not
the OS. They are only valid on Sparc hardware that uses the openboot
rmware. The eeprom command can be used from the OS to view or
set openboot rmware variables.
Show the value of the auto-boot? variable
printenv auto-boot?
Set the system to not auto boot
setenv auto-boot? false
Restore the system default for auto boot
set-default auto-boot?
Show the default boot device
printenv boot-device
List the actual device path for the disk device alias
devalias disk
List all openboot variables, current, and default values
printenv
Show devices seen by openboot
show-devs
Show help on all OBP commands
help
Boot the system into single user mode from the CD ROM
boot cdrom -s
Boot the system into single user mode using the default device
boot -s
Reset the system
reset-all
Packages
Install the gcc package
pkgadd -d gcc-3.4.6-sol10-sparc-local
Check to see if gcc is installed on system
pkginfo SMCgcc /or/ pkginfo | grep gcc
Remove the gcc package
pkgrm SMCgcc
Check the installation of the gcc (SMCgcc) package
pkgchk SMCgcc
Show revisions of packages on system
showrev -p
Get expected le info and source package for a le
pkgchk -l -p /usr/sfw/bin/gcc
Verify all packages (and les) on the system
pkgchk
Display information about a package
pkgchk -l SMCgcc
Display version information about an installed package
pkginfo -x SMCgcc
List all patches on the system
showrev -p /or/ patchadd -p
List patches applied to the SUNWckr package
pkgparam SUNWckr PATCHLIST
 smpatch and updatemanager can be used to manage system patches.
Devices
Scan for new devices to the system
devfsadm
List (verbosely) all attachment points (con gurable hardware)
List all disks on system
iostat -En
Tape unit { X = device number, n = no rewind
/dev/rmt/X n
 The /dev directory contains links to /devices
 (format) slice
ags are:
wm { Writeable Mountable (ie: A lesystem)
rm { ReadOnly Mountable
wu { Writeable Unmountable (ie: swap)
Networking
Show interfaces currently installed on system, speed, and duplex
dladm show-dev { (ndd can be used to adjust speed and duplex)
List network interfaces from the global zone only
ifconfig -aZ
Remove all host speci c con guration from the system (and restart)
sys-unconfig
 Primary IP con guration les
/etc/hostname.interface
,! IP address for interface. Alternatively use ifconfig.
/etc/nodename
,! hostname for the system. Alternatively set with hostname.
/etc/defaultdomain
,! System domain name. (svcadm restart domain after change)
/etc/defaultrouter
,! gateway for the system. Alternatively set with route.
/etc/hosts
,! Linked to /etc/inet/hosts. For IPv4 addresses only.
/etc/inet/ipnodes
,! For IPv4 and IPv6 addresses. Should be in sync with hosts le.
/etc/netmasks
,! This is not a symlink to /etc/inet/netmasks.
Temporarily set IP address on hme0
ifconfig hme0 plumb up 192.168.1.17 netmask 255.255.255.0
Temporarily create an alias on hme0 (hme0:1)
ifconfig hme0:1 plumb up 192.168.1.18 netmask 255.255.255.0
Create permanent alias on hme0 interface
echo 192.168.1.18 > /etc/hostname.hme0:1
Temporarily set the default route
route add default 192.168.1.1
Permanently add the same route as above
echo 192.168.1.1 > /etc/defaultrouter
Turn o trac on qfe3
ifconfig qfe3 down
Disable an Ethernet device (qfe3)
ifconfig qfe3 unplumb
List statistics on all interfaces on system
netstat -i
List all open ports on system
netstat -an | grep LIST
List all open TCP connections
netstat -f inet
Continuously ping a host
ping -s www.tablespace.net
 Use the snoop command to capture network packets
User Management
Add a user wfavorit to system (& create home dir) using default options
useradd -m wfavorit
View the default settings for the useradd command
useradd -D
Change the default useradd setting for base directory
useradd -D -b /export/home
Delete the password for user wfavorit, force new password on login
List all user accounts that do not have passwords
logins -p
List le system usage of the /zones lesystem by user
quot /zones
Display login information for wfavorit
logins -x -l wfavorit
Change the default shell to ksh for user wfavorit
usermod -s /usr/bin/ksh wfavorit
Modify user accounts with usermod and delete accounts with userdel.
Create group accounts with groupadd, modify group accounts with
groupmod, and delete groups with groupdel.
Service Management Facility
List all services known to system and current status
svcs -a
Enable the webmin service (long FMRI)
svcadm enable svc:/application/management/webmin:default
Disable the webmin service (short name)
svcadm disable webmin
List details of the ssh(d) service
svcs -l ssh
Restart the ssh(d) service
svcadm restart ssh
Verify that the AutoFS service is running
svcs system/filesystem/autofs
Verify that the multiuser server milestone has been reached
svcs multi-user-server
Disable the telnetd service (Use -e for enable)
inetadm -d telnet
List services that the multi-user-server milestone is dependent on
svcs -d multi-user-server
List services that depend upon multi-user-server milestone
svcs -D multi-user-server
Files
/etc/vfstab { Filesystem mount table
/var/adm/loginlog { Log of login attempts
/etc/default/* { Important default settings
/etc/system { Kernel modules and con g
/var/adm/messages { Syslog location
/etc/auto * { Automounter con g les
/etc/inet/ipnodes { IPv4 & v6 host le (read before /etc/hosts)
Inspecting the system
Find the total physical memory in system
prtconf | grep Memory
Find the openboot rmware version
prtconf -V
List information on all processors in the system
psrinfo -v
Find the size of a disk
iostat -En (or use the format command)
Display info on dump device
dumpadm
List all swap devices
swap -l
Show swap usage
swap -s (Includes physical memory)
Show swap size (per device)
swap -l|grep -v swaplo|awk 'f print $1, $4/2048 "m"g'
Show swap used (per device)
swap -l|grep -v swaplo|awk 'f print $1, ($4-$5)/2048 "m"g'
Show information about a binary (bash in this example)
showrev -c /usr/bin/bash
List time of most recent reboots
last reboot

No comments:

Post a Comment