SunOS 5.10: Quick Notes


Where are programs like make, gcc, python, etc?

They are all under /usr/ccs/bin and /usr/sfw/bin.

Utilities like whoami are under /usr/ucb

You should set them in your PATH.


Setting up the default gateway under SunOS

Run route add default x.x.x.x and also add the IP to the /etc/defaultrouter file such that it will survive a reboot

This is analogous to route add default gw x.x.x.x under linux.


Extracting a .tar.gz archive

Run gzip -dc File.tar.gz | tar xf - to extract File.tar.gz

This is analogous to tar -xzf File.tar.gz under linux.

What does the linux ‘top’ CPU fields stand for?

The first few lines of the top command looks similar to this:

Tasks: 137 total, 1 running, 136 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 4.2%sy, 90.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 5.8%st
Mem: 786432k total, 715152k used, 71280k free, 61012k buffers
Swap: 2096472k total, 18304k used, 2078168k free, 168068k cached

The fields on the second line breaks down the CPU usage into 8 categories.

us: user CPU used by user processes
sy: system CPU used by system/kernel processes
ni: nice CPU used by processes that were reniced
id: idle CPU not used
wa: io wait Essentially idle CPU waiting on IO devices
hi: hardware irq CPU used to service hardware IRQs
si: software irq CPU used to service soft IRQs
st: steal time CPU time which the hypervisor dedicated (or ‘stole’) for other guests in the system.

RRDTool yum dependencies on CentOS

If you are trying to compile RRDTool (at the time of writing, 1.4.5) on CentOS 5.x, you will need install the following packages on yum:

yum install cairo-devel libxml2-devel pango-devel pango libpng-devel freetype freetype-devel libart_lgpl-devel

Then, just compile rrdtool as usual:

wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.5.tar.gz
tar -xzf rrdtool-1.4.5.tar.gz
cd rrdtool*
./configure --prefix=/opt/rrdtool
make
make install

Redirecting / Merging stdout and stderr streams

To merge the standard out and standard error streams from a program, use 2>&1.

Example: umount /adsf/asdf 2>&1 will output the errors into standard out instead of standard error as usual.

Note that:

  • 2 is the file descriptor for stderr.
  • 1 is the file descriptor for stdout.
  • & accepts a file descriptor which can then be treated as a file.

Thus, 2>&1 in turns ‘writes data’ from stderr into stdout.

Reset MySQL Root Password

Here’s a quick way to reset your mysql root password. Replace ‘NewRootPass’ with your new root password and run the following as root.

/etc/init.d/mysql stop
mysqld --skip-grant-tables --user mysql &
mysql -u root -e "UPDATE mysql.user SET Password=PASSWORD('NewRootPass') WHERE User='root'"
/etc/init.d/mysql restart

Note: This was done on CentOS. You might need to adjust the path to mysql’s startup scripts accordingly.