Next Previous Contents

3. Accessing the UNIX Shell

3.1 Types of UNIX Shell

There are a variety of UNIX command shells. Most Linux systems run the Bourne Again SHell (/bin/bash). Sun Microsystems used to use C SHells (/bin/csh). When I took my Solaris Administration course, we were taught how to use the Korn shell (/bin/ksh). The original UNIX shell is the Bourne Shell (/bin/sh). The Bourne Shell usually doesn't exist on Linux systems. The command is actually a symbolic link to bash. Clones of C and Korn shells are available on a lot of Linux machines as /bin/tcsh and /bin/pdksh respectively.

If you are curious about these shells, you can read the man page. Most of the time, it doesn't matter what shell you are running.

The standard UNIX shell prompt is a dollar sign ($), except for C Shells which prompt with the hostame and a percent sign (%). These can be reprogrammed. On Linux, they usually are. The prompt can identify the machine, the user, the current directory, the date. They usually end with a dollar sign, though.

3.2 Console and Terminal Shells

If you logged into UNIX through a VT type terminal, through telnet, ssh, or through a modem, you are probably in a command shell. Sometimes you find yourself in a menu, which offers the option of launching a command shell. The author's ISP offered a list of shells, one (/bin/tcsh) of which, was ``recommended''. It is best to take administrators at their word on things like these. They probably spent some time and effort setting up the configuration on that shell, and they didn't bother with the others. All the system commands and utilities will work with the recommended shell. Perhaps they won't work with the others.

3.3 X11

The GUI for most UNIX systems is X11, or the X Window System. While X11 offers GUI tools that perform the functions of a command shell, you still need to know how to get at the keyboard. All sorts of tools are used to launch command shells. There are xterms, nxterms, dterms (Common Desktop Environment), and cmdtools (Sun Open Windows), just to name a few. Linux users will probably use xterms, so these will be discussed in some detail.

Gnome and KDE both launch terminals. The Gnome terminal has been cleverly named gnome-terminal. As of Dec2011, the KDE one is called konsole. You can pull down the menus and configure these.

3.4 Launching an Xterm

You can launch an xterm from the UNIX command line by typing xterm, and hitting Enter/Return. This is probably a waste of time though, since, you probably have a terminal already running. What you really want to do is add the xterm to a menu, or to the script that launches your initial routines when you start X11.

Warning! The following .xinitrc file will not work unless you delete the end-of-line comments, starting with #.

# A sample .xinitrc file that uses fvwm as a window manager, and launches 
# a nice, big xterm.
xterm \
      -fn 10x20 \      # A nice, large font 
      -bg black \      # Background colour
      -fg white \      # Foreground (text) colour
      -sb \            # Scroll bar
      -sl 1500 \       # Size of scroll buffer (lines)
      -ls \            # Login shell
      &                
# Window Manager
fvwm
          
You can copy and paste the text above into a text editor. Read the next section to find out how, and don't forget to delete the end-of-line comments.

3.5 Keyboard Copy and Paste

In X11R6, this is incredibly simple, although rarely documented. On any text window on your X Window System screen, highlight some text. Move the mouse to where you want to copy the text. Click on the middle mouse key. Simple eh?

Don't you wish someone had told you that earlier?

This also works on a Linux console if you are running gpm. It does not work if you have a two-button mouse, or if you have a cheap three-button mouse, that does not follow the standard properly. You can configure XFree86 to let you simulate the middle button by pressing both keys simultaneously, but this doesn't work very well. You can also read the 3 Button Mouse mini-HOWTO. Roller mice work, but not very well. If you don't have a good three-button mouse, now is the time to get one. I swear by Logitech mice.


Next Previous Contents