Useful Commands
These are a number of useful commands that I have found over the years. See the 'man' pages for more detail.
Contents
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/dsk/c0t0d0s6 | (cd /mnt; ufsrestore xvf -)
3. Repeat for all disk slices (except swap of course).
How much RAM is installed?
Although you can use the 'top' command to do the same thing, as top isn't installed on all systems you may need this:
/usr/sbin/prtconf | grep -i "Memory Size"
Mounting an ISO image
1. Upload your ISO image to the box in ques4tion.
2. Use the lofiadm command to create a mountable device our of you ISO image
lofiadm -a <DOWNLOADED DIRECTORY>/isoimage.iso /dev/lofi/1
3. Mount the new device as you would any mountable device
mount -F hsfs -o ro /dev/lofi/1 /mnt
4. Once you've finished with it, unmount
umount /mnt
5. Delete the device you created in step 1:
lofiadm -d /dev/lofi/1