Solaris and Sun/Oracle cheatsheet


Init levels

0 Go into boot prompt (OK).
1 Put the system in system administrator mode. All file systems are mounted. Only a small set of essential kernel processes are left running. This mode is for administrative tasks such as installing optional utility packages. All files are accessible and no users are logged in on the system.
2 Put the system in multi-user mode. All multi-user environment terminal processes and daemons are spawned. This state is commonly referred to as the multi-user state.
3 Start the remote file sharing processes and dae mons. Mount and advertise remote resources. Run level 3 extends multi-user mode and is known as the remote-file-sharing state.
4 Is available to be defined as an alternative multi-user environment configuration. It is not necessary for system operation and is usually not used.
5 Shut the machine down so that it is safe to remove the power. Have the machine remove power, if possible.
6 Stop the operating system and reboot to the state defined by the initdefault entry in /etc/inittab.
reboot -- -x
Reboot and issue boot -x (boot to non-cluster mode) at boot prompt.
`reboot -- -xs`
Reboot and issue `boot -xs` (single user, non-cluster mode) at boot prompt.
`reboot -- -r`
Reboot and issue boot -r (reconfigure) at boot prompt.

Continue reading Solaris and Sun/Oracle cheatsheet...

Shell cheatsheet


The following may not apply to all shells.

Job control

  • Resume job after suspend: ctrl-q
  • Resume job in background: bg <job number>
  • Resume job in foreground: fg <job number>
  • Suspend delay (suspend at stdin): ctrl-y
  • Suspend: ctrl-z

Command line laziness

  • Recall history line 66: !66
  • Recall last command: !!
  • Recall last arguement from last command: !$
  • Recall all arguements from last command: !*
  • Clear shell history: history -c
  • Delete shell history entry: history -d <number>
  • Rename rpmnew files:

    find -type f -name "*.rpmnew" | sed 's/\(^.*\)\(\.rpmnew\)$/mv -f \1\2 \1/' |sh
  • Search and replace files in place:

    find /path -name "*.*" -exec | perl -pi -e 's///g' {} \;
  • vi cli editing: set -o vi Now esc to enter command mode where vi keys work. Pressing enter returns to normal mode.

POSIX regular expression cheatsheet


Alphabetic [:alpha:]
Alphanumeric [:alnum:]
Control characters [:cntrl:]
Hex numbers [:xdigit:]
Lowercase [:lower:]
Nonespace characters [:graph:]
Numbers [:digit:]
Printable [:print:]
Punctuation [:punct:]
Tab or space [:blank:]
Uppercase [:upper:]
White space [:space:]

Multipathd testing


  1. Format and mount the SAN LUN.
  2. Start a write to the mounted filesystem cat /dev/zero >> /pathto/mnt/testfile &
  3. Now connect to the multipath daemon in interactive mode multipathd -k
  4. View current paths with show maps topology

    multipathd> show maps topology reload: mpath5 (360060e801045249004f2a5f900000031) dm-7 HITACHI,DF600F [size=128G][features=0][hwhandler=0][rw] _ round-robin 0 [prio=1][active] _ 1:0:0:4 sdb 8:16 [active][ready] _ round-robin 0 [prio=0][enabled] _ 2:0:0:4 sdc 8:32 [active][ready]

  5. There are two paths shown as sdb and sdc. Delete one path. del path sdb

  6. Suspend with ctrl-z and check that the write is still happening. ls -l /pathto/mnt If testfile is still growing then the path sdc is working.
  7. Resume multipath with fg 2. Re-add the path. add path sdb
  8. Now remove the other path. del path sdc
  9. Again suspend iwth ctrl-z and check that the test file is growing. If so then resume multipath and re-add the path. add path sdc
  10. Testing complete. Exit with ctrl-c. Kill the write job with kill %1. Remove the test file.