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...

Debian Apt Cheatsheet


Download and build source package apt-get -b source
Download and install dependencies for source package apt-get build-dep
Download source package apt-get source
Install package "on demand" auto-apt run
List contents of a package apt-file list
List installed packages dpkg -l
Remove package and configuration files apt-get --purge remove
Search for Debian Packages
Search for packages apt-cache search
Show package dependencies apt-cache depends
Show package information apt-cache show
Show package that supplies a given file apt-file search
Show package that supplies a given file COLUMNS=132 dpkg -S
Show source package information apt-cache showsrc
Update `apt-file and auto-apt database apt-file update

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:]