Tuesday, January 30, 2007

How to Invoke an xterm Window in an Emergency

Many Solaris systems I come across nowadays have had the window functionality removed/disabled from the user's menu or desktop. Why? The system administrator doesn't want prying eyes or users tinkering around and causing problems. But as a systems administrator, this modification can be quite frustrating during a troubleshooting effort. Here's what I do to get around that particular inconvenience/modification. Obviously, this trick can be disabled, too.

Hold down the following keys at the same time: Alt+Shift+Ctrl+Esc

--Don't let go of the aforementioned keys--

Then select "!"

This will give you the default menu and the option to display a UNIX window. After you are done with the window, return the desktop to the customized environment via the default menu's restart the workspace manager option.

Monday, January 08, 2007

View a Directory Structure Recursively

Oftentimes you will want to view the contents (subdirectories) of a directory but may not want to change directories. Why? Traversing deep directories takes valuable time.

Here's what you can do with the ls (list) command coupled with few options and then pipe the output to the more command.

#cd /home/esofthub
#ls -ltrR | more
This command syntax will allow you to view the contents in a long list format (l), in time order (t), reverse time sort order (r) and recursively (R). The more command will control the flow of the output.

Here's an example of what you will see.
#ls -ltrR | more
dir1
contents

dir2
contents

dir3
contents

dir4
contents

and soforth

Sunday, January 07, 2007

How to Add an Entry to the Aliases File

A colleague of mine wanted to email the results of a virus scan to various IT personnel. Upon the completion of the scan's cronjob, the mail system was configured to mail the results to the IT group (via mail alias).

Here's what was added to the /etc/mail/aliases file:

#vi /etc/mail/aliases
scanResults: user1, user2,user3,otheruser@esofthub.com,...
:wq! (save and quit vi)

--Add a tab between the alias and users--

To make the change take into effect:
#/usr/bin/newaliases

Friday, January 05, 2007

How to Configure a Network Interface Card

I'm going to give an example of configuring a GigaSwift network interface card in a Sun Blade workstation. For this example, you will have to reboot your box, but you can configure the card online, too.

# vi /etc/hosts
127.0.0.1 localhost
168.123.xxx.xxx esofthub (my workstation's hostname)
:wq! (save and quit)

# vi /etc/hostname.ce0
esofthub (should be the hostname of your workstation)
:wq! (save and quit)

# vi /etc/netmasks
168.123.xxx.xxx 255.255.255.xxx
:wq! (save and quit)

# init 6 (reboots your workstation)

How to Check for Network Interface Information

Often I'm asked for IP information. If I don't know it from the top of my head, I will use the ifconfig command to ascertain it. This command gives you interface type, Internet Protocol address (IP), netmask, and broadcast address.

#ifconfig -a (the -a gives a verbose output of this command)

Obtain only the IPs
#ifconfig -a | grep inet | awk '{print $2}'

How to Reboot a Workstation using init, shutdown

Here are a few ways to gracefully reboot a Sun workstation.

#init 0 -- This will bring the system down to the PROM level. You will have to manually type in "boot" to get the system to return to init 3 (usually normal operating state).
#init 6 -- This will take your workstation to init 0 and then automatically reboot to init 3 (usually normal operating state).

If you want to gracefully shutdown the system, you can use this command.

#init 5 -- This will bring the system down to the PROM level and then power the workstation down.

If you want to warn your users prior to reboot, use the shutdown command. This example will reboot in 60 seconds and will boot using init 6 state.

#cd /
#shutdown -y -g60 -i6