Saturday, October 15, 2005

dtlogin default language to en_US.UTF-8 (2)

1) cp /usr/dt/config/Xconfig /etc/dt/config/Xconfig
2) Dtlogin*language: en_US.UTF-8

Friday, October 14, 2005

dtterm - no blinking cursor

~/.Xdefaults-`uname -n` :
Dtterm*blinkRate: 0

Thursday, September 01, 2005

Show information about a command

showrev -c ls

Sunday, August 28, 2005

Show all non-system accounts

logins -u

Saturday, August 27, 2005

Show processor frequency

prtdiag

Show logins with no password

logins -p

Incremental backup with cpio

find . -newer /backup_marker -print | cpio
*Use either backup.log or previous backup as a marker.

Forward tape to the 4th file set

mt -f /dev/rmt/0n fsf 3
*Uses nonrewind device, so the tape stops at the right place. Skips three end-of-file markers, so stops at the beginning of the fourth.

Copy files preserving ownership and permissions

find . -print | cpio -p /new_location

Do not rewind the tape after use

/dev/rmt/0n
*n stands for nonrewind

Fastest way to rewind a tape

< /dev/rmt/0
*Since it is a standard device, it will be rewound after each access.

Alternative to more

pg
+2 scrolls 2 pages forward
-2 scrolls 2 back

If a system fails to boot because of /etc/system

boot -a
and
specify /dev/null as a system file to set kernel parameters to default

Arguments and environment vars of a process

pargs PID
pargs -e PID

List loaded modules, load new, unload loaded

modinfo
modload
modunload

Watch process state at the kernel level

truss -p PID

Wednesday, July 06, 2005

Cancel Print Jobs

List jobs first:
1) lpstat
Then, cancel:
2) cancel

Disable/Enable a Printer

1) To disable:
/usr/bin/disable HPLaser
2) To enable:
/usr/bin/enable HPLaser
Make sure to give full path, since bash shell has a clashing enable command.

Show Current Print Queue on Printer "moon"

lpstat -o moon

Three ways to check Print Scheduler status

1) pgrep -l lpsched
2) svcs -l print/server
3) lpstat -r

List Default Printer

lpstat -d

Allow/Deny Users to Print

By default, all users are allowed to print.
1) This will allow only sergey to print:
lpadmin -p HPLaserJet6MP -u allow:monalisa.phy.vanderbilt.edu\!sergey
2) The following line will be added to /etc/lp/printers/HPLaserJet6MP/users.allow :
monalisa.phy.vanderbilt.edu!sergey
3) If the file
/etc/lp/printers/HPLaserJet6MP/users.allow
exists, then users.deny file is ignored.

Printer Settings Directory

/etc/lp/printers/

List Printer Info

lpstat -lp

Tuesday, July 05, 2005

Stopping a Service

Find proper FMRI name:
1) svcs -a | grep ssh <-- outputs network/ssh:default
Stop the service (disable temporary):
2) svcadm disable -t network/ssh:default
Make sure that the service is stopped:
3) svcs -l network/ssh:default | grep enabled <-- outputs: enabled false (temporary)

Enabling a Service

Find the proper FMRI name:
1) svcs -a | grep rlogin <-- output is network/login:rlogin
Check if the service is enabled:
2) svcs -l network/login:rlogin | grep enabled <-- output is true or false
Use -r to recursively enable all dependencies:
3) svcadm enable -r network/login:rlogin

Disabling a Service

If the service has dependents, you won't be able to disable it. Check dependents of rlogin:
1) svcs -a | grep rlogin <-- output is svc:/network/login:rlogin
2) svcs -D network/login:rlogin
3) svcadm disable network/login:rlogin

List Service Status

1) svcs -a | grep sendmail
Then, omit svc:/ and use:
2) svcs -l network/smtp:sendmail

Sunday, July 03, 2005

Default init Levels

/etc/inittab does not have initdefault entry anymore. Instead, svcadm configures run levels. Scripts multi-user-server.xml, multi-user.xml, and single-user.xml are located in /var/svc/manifest/milestone/

Saturday, July 02, 2005

Reconfigure SPARC Hardware

reboot -- -rv
-- <-- tells reboot that the following flags are going to be parameters for boot PROM command
-r <-- tells boot command to reconfigure devices (same as creating /reconfigure file)
-v <-- verbose

Friday, July 01, 2005

Display Hard Disk Data

1) format
2) partition
3) print
Slice 2 is the size of the HD.

Thursday, June 30, 2005

Running Processes Info

prstat -t <-- combined by user
prstat -s rss <-- the largest ones first

vi Editor Commands

0 <-- go to the beginning of the line
$ <-- go to the end of the line
ZZ <-- save and quit

Two ways to show patch info

showrev -a <- is a binary, so outputs faster
patchadd -p <- script

Wednesday, June 29, 2005

Backup Utility

rsync is a great backup utility. It can be used to do inceremental and full backups. http://rsync.samba.org has sample shell scripts that will do backups. rsync has a flag to do incremental backups over an SSH tunnel - saves bandwidth and is secure.

List Files of a Package

pkgchk -v SUNWmozilla <-- will list all the files of SUNWmozilla package just like `rpm -ql mozilla` command.

What Package does the File Belong to?

pkgchk -l -p /usr/bin/ls
-l <-- list info
-p <-- path to file

The equivalent of `rpm -qf /path/to/file` to learn what package owns a file.

Tuesday, June 28, 2005

`locate` Utility for SPARC

After installing pkg-get from blastwave.org, download and install findutils:
pkg-get -i findutils
Now, I can use `glocate` and `gupdatedb` commands.

SPARC - changing resolution

/usr/sbin/m64config -prconf <-- prints out current resolution and supported modes.
/usr/sbin/m64config -res 1024x768x85 <-- changes current resolution to the one specified if supported.

Monday, June 27, 2005

Booting From a CD on SPARC

Trying to boot from a CD, I was getting this error:
Can't open boot device
Followed this procedure:
1. Rebooted with Stop+a and got "ok" prompt
2. show-disks command and picked option a) for cdrom
3. nvalias cdrom ^Y (hit Ctrl+y) and appended 3,0:f at the end, which identifies the cdrom as a slave device on the secondary IDE port.
4. reset-all <- at this point the machine reboots.
5. Stop+a and use "boot cdrom" to boot SPARC installer.

Configure CDE Key Bindings

Copy the file from /usr/dt/config/C/sys.dtwmrc to ~/.dt/dtwmrc
Edit the file. I had to change from Alt to Ctrl, since only right Alt worked.

Using cdrw to Create CDs

cdrw -C -i cdimage.iso
-C is important, since it tells cdrw to use the actual CD size, which can be 80 min but not the default 74 min. I was getting an error that iso image was too large while burning Solaris Express CDs until I used the -C option.
cdrw -l will list the burning device.

Saturday, June 25, 2005

Single User Mode from CD - delete root passwd

1. Stop-A
2. Insert the CD and type at the prompt:
boot cdrom -s
3. mount the hd:
mount /dev/dsk/c0t0d0s0 /a
4. set the terminal type:
export TERM=vt100
5. vi /a/etc/shadow
delete root's encrypted password string
6. unmount /a and init 6

Proper Way to Shutdown Solaris 10

shutdown -i5 -g60 -y
-i5 = init 5
-g = grace period 60 sec
-y = confirm shutdown

$SHELL for root

In Solaris 10, I can change the shell for root from /sbin/sh to /bin/bash:
usermod -s /bin/bash root
It will not cause any issues if I cannot log into /bin/bash for some reason. I will be automatically thrown into /sbin/sh then.
Using /bin/bash turns on autocomplete for commands and lists my previous commands with upper arrow key. Nice!
* still better to do "exec /usr/bin/bash" in .profile

Solaris 10 stty erase for root

Put the following in .profile:
stty erase ^H
Make sure that ^H is the result of Ctrl+V+Backspace

Flash Archive for Solaris 10

Solaris 10 has an awesome utility called Flash Archive. It is a cloning program that allows me to create either full or differential images of systems. I can do a complete backup of my system with it. I use "flarcreate" command and put my image on a mounted NFS share. Later, when I need to reclone, I boot from Solaris Express install CD and point to the NFS share. Here is Sun's manual:
http://docs.sun.com/app/docs/doc/817-5668

Solaris 10 Links

Solaris has some cool web sites:
http://www.cuddletech.com/blog/ <-- This is an awesome blog. I've been learning a ton from just reading through it.
http://www.blastwave.org <-- These guys offer a ton of Linux tools, and they are super easy to install with their pkg-get utility. You configure the sources just like in apt-get, yum or jigdo and then type pkg-get -i mplayer to install mplayer.
http://www.sunfreeware.com <-- Haven't tried this web site yet, but it looks quite handy.