Friday, 31 August 2012

Console Emulation & Installation Commands

Console emulation commands :

lscons                                                     To list the current console

lscons -b                                                To list the console at next boot

chcons /dev/tty3                                  To change the console to tty3

chcons -a login=enable /dev/tty3     Redirect console to tty3 and provide login prompt

swcons /dev/tty3                                 To change system console to tty3 temporarily



Installation specific commands :


lslpp -l                                                    To see the details of installed file sets

lslpp -ha bos.net.*                               To list the installation history of all file set in bos.net packages

lslpp -f bos.rte                                       To list the files in the bos.rte package

lslpp -w /etc/hosts                                To list the file set which contain /etc/hosts file

lslpp -p bos.net.nfs.server                   To list the pre requisites for bos.net.nfs.server file set

installp -L -d /dev/rmt0.1                   To list the installable products on the device rmt0

installp -aX -d /dev/rmt0.1 bos.net  To install all filesets within bos.net and expands file system if it requires

installp -u bos.net                                                To remove bos.net

installp -r                                               To reject the applied software

installp -c -f <product>                       To commit the <product>

installp -C                                              To cleanup an incomplete installation

lppchk -c <product>                            To check the <product>

instfix -k IX9999 -d /dev/rmt0.1      To install the file set associated with fix IX9999 from rmt0

instfix  -ik IX9999                               To verify fix IX9999 installed

BLV , System Dump, Device Related Commands





BLV COMMANDS :

bootlist -m normal -o                          To see the boot sequence in normal mode

bootlist -m service -o                           To see the boot sequence in service mode

bootlist -m normal cd0 hdisk0          To change boot sequence to cd0,hdisk0 in normal mode

bootlist -m service cd0 rmt0 hdisk0                 To change boot sequence to cd0,rmt0,hdisk0 in service mode

bosboot -ad /dev/hdisk1                    To create boot image on PV hdisk1

mkboot -cd /dev/hdisk1                     To clear the boot image

bootinfo -b                                            Specifies the bootable disk

bootinfo - t                                            Specifies the type of boot

bootinfo -e                                            Check the machine can boot from tape

bootinfo -T                                           To see the machine type

bootinfo -s hdisk0                               To see the size of hdisk0

bootinfo -r                                             To see the size of memory
SYSTEM DUMP COMMANDS :


sysdumpdev -l                                      To list the current dump destination

sysdumpdev -L                                    List the details of the previous dump

sysdumpstart -p                                   Starts dump in the primary dump device

sysdumpstart -s                                    Starts dump in the secondary dump device

sysdumpdev -p /dev/lv00                  To make lv00 as primary dump device

sysdumpdev -P -p /dev/lv00             To make lv00 as primary dump device permanently

sysdumpdev -s /dev/rmt0                  To make rmt0 as secondary dump device

sysdumpdev -z                                     To determine a new system dump occurred



Device related commands :


cfgmgr                                                   To configure devices and installs device software in system

cfgmgr -l vscsi0                                    To configure the components connected to the vscsi0 interface

lscfg                                                        To display config, diagnostics and vital product definition info

lscfg -l mem0                                        Display info about device mem0

lscfg -l ent*                                           Display info about all Ethernet cards

lscfg -v                                                   Display vpd

lscfg -v -l hdisk0                                   Display vpd of hdisk0

mkdev   -l rmt0                                    To change device rmt0 from defined state to available state

lsdev -P                                                  To lists all supported devices

lsdev -P -c disk                                     To list all supported disks

lsdev -P -r class                                     To display supported class

lsdev -P -r subclass                              To display all sub class

lsdev -C                                                 To lists all configured devices

lsdev -C -l mem0                                 To display the properties of mem0

chdev -l sys0 -a maxproc=100         To change default maxproc value to 100

chdev -l rmt0 -a blocksize=512        To change the block size to 512

chdev -l rmt0 -a ret=no                       To avoid tape retension

rmdev -l rmt0                                       To remove the device rmt0

rmdev -d -l rmt0                                   To remove the device totally from database

rmdev -l rmt0 -S                                   To change the state of the device stopped

lsparent -C -k  rs232                            To display possible parent devices which accept rs232 devices

lsparent -C -l hdisk0                            To display parent devices which accept child device hdisk0

lsattr -Dl rmt0                                       To see the default values of the device rmt0

lsattr -El rmt0                                       To see the current values of the device rmt0

lsattr -El tty0 -a login -R                     To see all possible values of the login attribute of tty0

lsconn -p scsi0                                      To list all possible connection scsi0 can accept

lvlstmajor                                              To list the available major numbers

mknod /dev/null c 2 2                        Create null device with major (2) and minor (2) nos. (c - char device)

ODM $ ERRPT Commands

ODM Commands


odmget sm_menu_opt                      

To get the objects from class sm_menu_opt

odmget -q "id=licenses" sm_menu_opt

                                To list objects that matches query id=licenses from object sm_menu_opt

odmdelete -o sm_menu_opt -q "id=licenses"

                                To delete the entries from class sm_menu_opt which agrees the query id=licenses

odmshow sm_menu_opt

                                To show the object class definition

odmdrop -o sm_menu_opt

                                To drop sm_menu_opt object class

odmchange -o sm_menu_opt -q "id=licenses" file1

                                To change the attributes from file1

ERRPT COMMANDS:


errpt                                                        To display complete summary of report

errpt -a                                                   To list complete detailed report

errpt -d H                                               To list all hardware related errors

errpt -d S                                                To list all software related errors

errpt -a -j 34564423                            To list detailed error report of error id 34564423

chitab tty002:23:respawn:/usr/sbin/getty /dev/tty

                                                                To enter the entry tty002:23:respawn:/usr/sbin/getty /dev/tty in inittab

lssrc -g portmap                                   To start tcpip

Scheduling commands

Scheduling commands :

crontab -l                                               To list the crontab entries

crontab -e                                              To edit the crontab entries

crontab -l > /si                                      To copies the entries of crontab to /si file

crontab -r                                              To remove all crontab entries

crontab -v                                             To list the submission time

/var/adm/cron/cron.allow                  File containing users who allowed cron service

/var/adm/cron/cron.deny                  File containing users denied cron service

at -l                                                         To list the jobs scheduled via at command

at -r  root.dfjdhjdh.21                         To remove the scheduled job root.dfjdhjdh.21

/var/adm/cron/at.allow                      File containing users who allowed at service

/var/adm/cron/at.deny                       File containing users denied at service

batch                                                      To run the command when the system load permits

atq  joe                                                  To list all the jobs submitted by user joe

User Related Comands

User Management :


id    To list all system identifications for current user

id -gn       To list the default group for current user

id -Gn          To list all system groups for current user

lsuser root         To list the attribute of user root

lsuser ALL               To list the attributes of all users

lsuser -a HOME ALL     To list the home directory of all users

lsuser -a ALL         To list all usernames

lsuser -a auth1 auth2 ALL   To list the authentication method for all users

lsuser -a expires ALL              To list expiry date

lsuser -a account_locked ALL          To check account lock status of all users

chuser -a login=true san                     To enable the user san

chuser -a rlogin=true san                    Enable san to login remotely 

mkuser si    Creates user si with default values in /usr/lib/security/mkuser.defalault

mkuser su=false   si      Create user si without su facility

rmuser si                      To remove user si

rmuser -p si           To remove user si and his all attributes

who                                                        List users with tty nos and ip numbers

who /var/adm/wtmp                           Lists history of login logout system startup and shutdowns

who -r                                                     To list the run level 

who am i /who -m                               To list the current user

mkgroup dcm                                       To create the group dcm

chgroup users=u1,u2,u3 dcm            To add users u1 u2 and u3 to dcm  group

rmgroup dcm                                        To delete the group dcm

chauthent                                              To change the authentication methods

Space Usage Commands

Space usage commands : 


du -k                                                       To list number of bytes in 1k blocks

du -l                                                        To list number of bytes in 512 bytes blocks

du -s                                                       To list only the total disk usage in the current directory

df -i                                                         To display no of free and used inodes

df -k                                                       To display diskspace in 1024 bytes format

Network Related Commands

Network related commands :


host 193.9.200.1                                  Resolves ip to host name (from /etc/hosts file)

host ibm                                                                Resolve ibm to ip address (from /etc/hosts file)

hostname ibm                                      To change the host name to ibm

entstat en0                                            To the status of ethernet device en0

entstat -d en0                                       To list the detailed status of device en0

no -a                                                       To list all net configurable attributes and their values

no -d thewall                                         To change thewall parameter to its default value

no -o ipforwarding=1                          To make the machine as router in tcpip networks

traceroute ibm                                      To trace the route to ibm

ping ibm                                                                To tcp ping to the machine ibm

ifconfig -a                                             To show the status of all network interfaces 

ifconfig en0                                          To show the status of en0

ifconfig en0 up                                     Turns on network card en0
ifconfig en0 down                               Turns off network card en0
ifconfig en0 detach                             Removes en0 card from the network interface list 

ifconfig en0 inet 194.35.52.1 netmask 255.255.255.0 up          

                                                                Configure en0 starts immediately

ifconfig en0 alias 195.60.60.1          Create alias ip address for en0 

route add 0 192.100.13.7                  To make 192.100.13.7 as default gateway for entire network

route add 192.100.12.0  192.100.13.7    To make 13.7 as gateway for 12.0 network

route -f                                                   To clear the gateway table

chdev -l inet0 -a hostname=si           To change the host name to si permanently

netstat -a                                               To show the state of all sockets

netstat -c                                               To show the network buffers cache

netstat -D                                              To show the net drops of packets

netstat -i                                                                To display interface statistics

netstat -r                                                To show the routing table

netstat -rn                                              To show routing table (ip will be given instead of host names)

netstat -s                                                To show the statistics of the protocols

netstat -s -p < tcp/udp/ipv6>             To show the statistics of respective protocols

Paging Space Commands

PAGE SPACE COMMANDS:


lsps -a                                                     To list out all paging spaces

lsps hd6                                                 To display the details of the paging space hd6

chps -a y paging00                              To turn on the paging space paging00

chps -a n paging00                              To turn off the paging space paging00

chps -s4 paging00                                To increase the size of the paging space in 4 LP blocks

mkps -a -n -s4 sivg                              To create a paging space on VG sivg of 4 LP size (-s4) and activate it 

immediately (-n) and activate it at every restarts

rmps paging00                                     To remove the paging space paging00

swapon -a                                             To invoke all entries in /etc/swapspaces file

swapon /dev/paging00                       To make available swap space paging00

Logical Volume Manager Commands

LVM COMMANDS

VG Commands:

lsvg                                        Display all VGs

lsvg -o                                      Display all active VGs

lsvg rootvg                                  Display info about rootvg

lsvg  -l rootvg                              Display info about all LVs in rootvg

lsvg -o |lsvg -il                            Display info about all LVs in all VGs

lsvg  -p rootvg                              Display info about all PVs in rootvg

mkvg  -s 8 hdisk1                          Create VG with name vgxx on hdisk1 with partition size 8MB

mkvg -s 8 -y sivg hdisk1                     Create VG with name sivg on hdisk1 with partition size 8MB

mkvg -s 4 -t 2 -y sivg hdisk1              Create sivg on hdisk1 with PP size 4 and no of partions 2 * 1016

chvg -a y newvg                            To cuase VG newvg automatically activated at startup

chvg -a n newvg                            To deactivate the automatic activation at startup

chvg -t 2 newvg                           To change maximum no. of PP to 2032 on vg newvg

chvg -Q n newvg                           To disable quorum on VG newvg

reorgvg  newvg                            Reorganises PP allocation of  VG newvg

extendvg newvg hdisk3 hdisk4              Add PV hdisk3 and hdisk4 to VG newvg

exportvg newvg                            Exports the VG newvg

importvg -V 44 -y newvg   hdisk2            Import the hdisk2 with name  newvg, and assign major number 44

redcucevg newvg hdisk3                    Remove PV hdisk3 from VG newvg

varyoffvg newvg                                 To deactviate VG newvg

varyonvg newvg                                  To activate VG newvg

syncvg -v sivg                                       To sync the mirrored LV in the VG sivg

mirrorvg -S -m sivg hdisk2                 To mirror LVs of sivg with hdisk2 (-m for exact mirror, -S 

forbackground  mirror)

unmirrorvg sivg hdisk2                       To remove the mirrored PV from the set.


FILE SYSTEM COMMANDS:

lsfs                                                          Lists all filesystems in the /etc/filesystems entry

lsfs -q                                                     List all filesystems with detailed info

lsfs -a                                                     To list all filesystems (default)

lsfs -l                                                       Specify the output in list format

lsfs -c                                                      Specify the output in column format

lsfs -v jfs                                                Lists all jfs filesystems

chfs -a size=24576 /si                         Change size of FS /si to 24576 x 512 bytes blocks (12 MB)

chfs -a size=+24576 /si                       Add 24576 x 512 byte blocks to FS /si

chfs -m /si /bi                                        Change the mount point from /si to /bi

chfs -A /si                                              To auto mount the filesystem si

chfs -d account /si                               Remove account attribute of /si. ( from /etc/filesystems file)

chfs -a splitcopy=/backup -a copy=2 /oracle  This will mount the 2nd copy of mirrored filesystem oracle to 

/backup in read-only mode

crfs -v jfs -g testvg -a size=64465 -m /SHIVA    Creates FS /SHIVA of type jfs in VG testvg of blocksize 64465

crfs -v jfs -d /dev/lv00 -m /SHIVA  Create FS /SHIVA of type jfs on device /dev/lv00

rmfs /SHIVA                                        Deletes FS /SHIVA and associated LV

rmfs -r /SHIVA                                    Deletes FS /SHIVA its mount point and associated LV

defragfs /sifs                                         To defragment the file system /sifs

defragfs -q /sifs                                    Display the current defrag status of the file system

fsck  -y n /dev/lv00                             To fsck the filesystem associated to /dev/lv00 assuming response "yes"

fsck -p /dev/lv00                                 To restore superblock from backup superblock  


PV COMMANDS:


lspv hdisk0                                            Display status and characteristics of the PV

lspv -p hdisk0                                       Display  PP usage of hdisk0                                                              

lspv -l hdisk0                                        To list all logical volumes on PV hdisk0

chpv -v r hdisk1                                   Close the PV (Used while removing PV without varyon)

chpv -v a hdisk1                                  Open the PV

chpv -c hdisk0                                      Clear the master boot record on PV hdisk0

migratepv  hdisk1 hdisk2                   To move PPs from PV hdisk1 to hdisk2

migratepv -l silv hdisk1 hdisk2         To migrate LV silv from PV hdisk1 to hdisk2



LV COMMANDS:

lslv -l lv00                                              Display info about LV by PV

lslv -p hdisk1                                        Display LV allocation map for hdisk1

chlv -t copy lv00                                  To change the lv00 to copy type

chlv -p r lv00                                        To change the lv00 to readonly mode

rmlv silv                                                 To remove silv

rmlv -f silv                                             To remove silv without user intervention

mklv  -s n -c 3 silv hdisk1                   To make LV silv  with three copies on hdisk1

extendlv  silv 5                                     To extend the LV silv with 5 LPs

mklvcopy -s n lvsi 2 hdisk1               To mirror LV lvsi on same PV with 2 copies

mklvcopy lvsi 3 hdisk1 hdisk2         To mirror LV lvsi on PV hdisk1 and hdisk2 with 3 copies

rmlvcopy lvsi 2 hdisk1                       Will remove one copy of  LV lsvi from hdisk1 

mklv -t jfslog -y log00 newvg 2        To create a jfslog with name log00 on VG newvg with 2LPs

logform /dev/log00                             To format jfslog volume log00