Web www.freebsdmadeeasy.com
Main Menu

Misc Tips & Tricks

Shells

Shells can be installed from /usr/ports/shells Once you have installed a new shell you can set it as your default using

# chsh

If you are using tcsh you can change the default under ~/.cshrc a good prompt is

set prompt = '%n@%m:%/%# '

Another thing to note about tcsh is that whenever you install a new program and it goes into a directory listed in your path you must type rehash to update the list of programs in your path, otherwise you will get an error saying the program was not found.

# rehash

Changing your PATH in tcsh or csh

The PATH variable contains a list of the default directories that are searched for any command you type in that is without a path. To change it in tcsh or any csh based shell edit your .cshrc file in your home directory and add the directory where you see set path

# ee ~/.cshrc

Your default path will look something like this

set path = (/sbin /bin /usr/sbin /usr/bin)

Add in the new directory seperating it by a space

set path = (/sbin /bin /usr/sbin /usr/home/plato/mybin)

Once you are finished editting the file log out and log back in for the changes to take effect. If you are adding a new file to a directory in your path use rehash to update the shell.

For other shells try the .profile or .bashrc file to update your PATH.

Installing Java on FreeBSD

Installing Java on FreeBSD using /usr/ports/java/jdk14 is possibly the most annoying port ever to install. Its going to require you to manually go on online, register for an account on sun.com, and download several files from sun.com and other places. It will also of course ask for these through out the install instead of all at the beginning. So if you have room it is a good idea to just save these files somewhere for the next time you need them. And once you have it installed you will need to add the following directories to your path or your programs will be unable to find it.

/usr/local/jdk1.4.2/bin
/usr/local/jdk1.4.2/lib

Unless the program is purely text based and doesn't do anything fancy the native version of java for FreeBSD is probably going to mess it up and display it totally different than it should really look. For this reason you might want to instead point your path to the linux version of sun which the FreeBSD version requires and installs when you use the port.

/usr/local/linux-sun-jdk1.4.2/bin
/usr/local/linux-sun-jdk1.4.2/lib

There are also several other versions of Java available in the ports such as linux-blackdown-jdk14 which do not require you to download anything manually, and sometimes works better.

Reading the daily output

FreeBSD periodically runs scripts which generates reports telling you about any spammers that tried to relay mail using your machine, any failed logins, and any password changes or new accounts created. The cron for these is found at /etc/crontab The result of these scripts is emailed to your root account.

To check the mail on your root account you can install a mail client such as mutt or pine. Or if you wish to forward this mail to another email account you can create a .forward file in your root directory and put only the email address to forward to in it.