oreilly.comSafari Books Online.Conferences.


Small Office Linux
Pages: 1, 2

Cool prompts

By now you probably have noticed that the system prompts for root and morbius differ significantly. The prompt for root displays the username, root, the hostname, altairIV, and the current working directory. Recall that Dr. Morbius set up his default shell for /bin/tcsh, the enhanced C-shell. We can add functionality to a user account by creating a resource file, .tcshrc, for our enhanced C-shell. Using his favorite editor, Dr. Morbius created the following .tcshrc (note the leading period for this file name) resource file in his account home directory (/home/morbius):

# .tcshrc
# executables PATH
setenv PATH "/usr/sbin:/sbin:$PATH"
# user specific aliases and tools
alias win 'xterm -sb -sl 1000 -T \!* -e telnet \!* &'
set prompt='[%n@%m %c]# '

Upon closing the saving the file and exiting his editor, Dr. Morbius uses the source command to invoke the functionality in his resource file.

source .tcshrc
[morbius@altairIV ~]

The changes take place in your shell environment immediately. You'll also notice that the prompt isn't the only thing Dr. Morbius tossed into his resource file. He included an environment variable, PATH, for executables and also an alias, win, to condense the long xterm command.

Shell resource files can get pretty complex, and knowledgeable users may customize their own files. An exhaustive listing of the capabilities of the .tcshrc file can be found on your system using the command man tcsh.


UNIX in a Nutshell: System V Edition, 3rd Edition

UNIX in a Nutshell: System V Edition, 3rd Edition
By Arnold Robbins

Substitute user -- su

Now that Dr. Morbius has created an account for himself, he is now the company guru and will be given the responsibility of maintaining the system. From time to time Dr. Morbius may need to quickly change from user morbius to root to examine a problematic account or to turn on a daemon. The substitute user, su, command provides the flexibility user morbius will need so he doesn't have log out and then log in as root.

Before user morbius can use the su command to become root, some modifications must be made to the /etc/group file. On Unix systems there exist group IDs (gids), which are similar to the previously mentioned uids. The uid identifies the owner of a file or process and the gid identifies a specific group of users.

To allow user morbius to use the su command to change to user root, morbius needs to be a member of the wheel group. The master group file is located in /etc/group. Edit the file, using emacs or vi, and modify the wheel group entry to include the user:

wheel::10:root, morbius

Making this little modification will allow user morbius to quickly change himself to root in the following manner:

[morbius@altair /home/morbius] su
[root@altair /home/morbius]

Software package installation

At this point we have set up a network interface to get out to the Internet. We have also set up a user account. Now let's watch as our Linux guru, Dr. Morbius, installs a Java development package on his system. Dr. Morbius is running LinuxPPC 2000 on his G4, so he must download LinuxPPC JDK from This URL will take you to the image download page. (Remember to hit the shift key when downloading.) There are other Linux devices in the domain that aren't LinuxPPC, and these JDKs can be found at Regardless, the same installation instructions will apply. For this example, Dr. Morbius is going to download the JDK 1.3.0 FCS (First Customer Ship) image from

JDK 1.3.0 FCS installation

For simplicity, Dr. Morbius downloads his compressed JDK image to his home directory, /home/morbius. Knowing that the compressed image is going to take some time to download over his DSL connection, Dr. Morbius first downloads the README.ppclinux text file. This gives him something to read while he waits for the large file to transfer to his home directory.

[morbius@altairIV ~] ls j2sdk*

The file has successfully downloaded; now Dr. Morbius changes to user root, using the handy su command he set up earlier. This file, according to the README.ppclinux document, most be moved to the /usr/local directory, owned by root.

[morbius@altairIV ~] su
[root@altairIV morbius] mv j2sdk-1.3.0-FCS-linux-ppc.tar.bz2 /usr/local
[root@altairIV morbius] cd /usr/local
[root@altairIV local]

To this point, Morbius, now root user, has moved the compressed JDK file, j2sdk-1.3.0-FCS-linux-ppc.tar.bz2, from his /home/morbius directory over to /usr/local. Now he will proceed to install the JDK 1.3.0 package using the tar compression utility to uncompress the file.

[root@altairIV local] tar -Ixf j2sdk-1.3.0-FCS-linux-ppc.tar.bz2

When the file decompresses, it will set up a directory structure under /usr/local/j2sdk1.3. Since the file is installed by root, its privileges are set to those of root. For the time being, Dr. Morbius will set up the directory privileges for user morbius. This is what he does:

[root@altairIV local] chown -R morbius:morbius j2sdk1.3

Now user morbius has privileges set for accessing this SDK. As more users want access to this JDK, Dr. Morbius will have to establish a group, dev_tools, for instance, and add individual users to this group, thus assigning the dev_tools group as the privilege level for the JDK.

Environment variables

Now that a JDK package is installed, it's time for Dr. Morbius to set up environment variables to access these tools. And where does he do this? Why, in his C-shell resource file of course. The following lines are added to user morbius' .tcshrc file:

set path = ( $path /usr/local/j2sdk1.3/bin )

After this path variable is set, Dr. Morbius then closes his resource file and uses the source command to update the changes. Now, for a test run, Dr. Morbius creates a simple Java file,

public class test {
public static void main( String[] args ) {

To compile this, he enters the following commands from his prompt:

[morbius@altairIV ~] javac
[morbius@altairIV ~] java test

That's it! The JDK package is now installed. The README file for some packages may be a little intimidating. But once you have a good mentor, like Dr. Morbius, to show you the ropes, these tasks can seem a lot simpler.

Other exciting packages to install

Now that Dr. Morbius has whetted your appetite and built your confidence, there are two packages I strongly recommend you download.

One is the 3D rendering program, Blender. This is a full featured 3D rendering suite and a game tools library. This suite alone makes owning a Linux system worth the while. The other nice download is the RealPlayer 8 Basic free software. This multimedia player software is supported by the Linux community and is available for the LinuxPPC. Select the Unix OS and a new page will launch listing various Unix operating systems, LinuxPPC 2000 included. If you really want to see what cool things are available, I recommend heading over to the site. If it's written for Linux users, you'll probably find the software you're looking for there.

Where do you go from here?

As I mentioned earlier, Linux books usually are published by weight. A thicker book isn't necessarily better. I purchased a book in the early nineties that is still the most often used book on my bookshelf. This is O'Reilly's UNIX in a Nutshell, by Daniel Gilly. It's a relatively inexpensive book, and it's the book I always turn to when I need to seek help for Linux commands.

This book isn't a tutorial; rather, it's a quick reference manual on how to use various Unix commands. I'll admit that I am one who rarely gets much use out of reading man pages, but this book helps out a great deal.

The other great resource is the Internet. Use it to seek advice through mailing lists. Once you're there, don't be afraid to ask questions. For any LinuxPPC questions, consult the linuxppc-user list, which has a huge knowledgebase online.

Use these resources as your online mentors. Many of these people are willing to dive in and give newbies a hand.

Michael J. Norton is a software engineer at Cisco Systems.

Related Resources:

Living Linux - How does a new Linux user go about getting day-to-day tasks accomplished using open source software? This series of articles offers some solutions to newbies and advanced users alike.

FreeBSD Basics - Dru Lavigne's series on FreeBSD includes useful tips and tutorials that can often be helpful to Linux users as well.

Discuss this article in the O'Reilly Network Linux Forum.

Return to the Linux DevCenter.


Linux Online Certification

Linux/Unix System Administration Certificate Series
Linux/Unix System Administration Certificate Series — This course series targets both beginning and intermediate Linux/Unix users who want to acquire advanced system administration skills, and to back those skills up with a Certificate from the University of Illinois Office of Continuing Education.

Enroll today!

Linux Resources
  • Linux Online
  • The Linux FAQ
  • Linux Kernel Archives
  • Kernel Traffic

  • Sponsored by: