Useful Commands

From Peter Pap's Technowiki
Revision as of 01:32, 21 September 2010 by Ppapa (talk | contribs)

Jump to: navigation, search

These are a number of useful commands that I have found over the years. See the 'man' pages for more detail.


Running 64-bit or 32-bit Solaris?

This command is more relevant with older versions of Solaris, as these days Solaris is 64-bit by default. However, if you're running an older version of Solaris and need to know if it's running in 64-bit or 32-bit mode, here's how you find out:

  /usr/bin/isainfo -kv


Set network interfaces with unique MAC addresses

So you have a Sun Sparc server with multiple network interfaces. You'd expect them to have different MAC addresses right? Wrong! By default they will present the same MAC address. In order to force the machine to use a different MAC address you need to do either of the following.

From the OpenBoot PROM ('ok' prompt):

  setenv local-mac-address? true

From the OS:

  eeprom "local-mac-address?=true"


Deleting unusual file names via INODE number

Ok, so you've accidentally created a file with a special character in it's name, like ~ or ` or something just as stupid. How do you delete it when the shell won't let you escape the character. Delete it via it's INODE number.

First, find out it's INODE number:

  ls -ali

Then delete it like so:

  find . -inum INODE_NUMBER -ok rm '{}' \;


Turn off all unnecessary Network Services

I've never used this, but I can see where it would be handy when you first build a box. It turns off all unnecessary network services in one fell swoop:

  netservices limited


Cloning a Disk with ufsdump and ufsrestore

I've found this useful a few times where you want to clone a disk.

1. Mount the slice you want to copy to

  mount /dev/dsk/c0t0d0s6 /mnt

2. Use ufsdump and ufsrestore to copy the data

  ufsdump 0f- /dev/rdsk/c0t0d0s6 | (cd /mnt; ufsrestore xvf -)

3. Repeat for all disk slices (except swap of course).