LinuxCommand
Learning the
shell
Writing
shell scripts
Script
library
SuperMan
pages
Who, What,
Where, Why
|
What is "the shell"?
Simply put, the shell is a program that takes
your commands from the keyboard and gives them to
the operating system to perform. In the old days,
it was the only user interface available on a Unix
computer. Nowadays we have graphical user
interfaces (GUIs) in addition to command
line interfaces (CLIs) such as the shell.
On most Linux systems a program called bash (which stands
for Bourne Again SHell, an enhanced version of the
original Bourne shell program, sh written by Steve Bourne) acts as the
shell program. There are several additional shell
programs available on a typical Linux system. These
include: ksh, tcsh
and zsh.
These are called "terminal emulators". They are
programs that put a window up and let you interact
with the shell. There are a bunch of different
terminal emulators you can use. Most Linux
distributions supply several such as: xterm, rxvt, konsole, kvt, gnome-terminal, nxterm, and eterm.
Your window manager probably has a way to launch
programs from a menu. Look through the list of
programs to see if anything looks like a terminal
emulator program. In KDE, you can find "konsole"
and "terminal" on the Utilities menu. In Gnome, you
can find "color xterm", "regular xterm", and
"gnome-terminal" on the Utilities menu. You can
start up as many of these as you want and play with
them. While there are a number of different
terminal emulators, they all do the same thing.
They give you access to a shell session. You will
probably develop a preference for one, based on the
different bells and whistles each one provides.
Ok, let's try some typing. Bring up a terminal
window. You should see a shell prompt that contains
your user name and the name of the machine followed
by a dollar sign. Something like this:
|
|
Wonderful! Now press the up-arrow key. Watch how
our previous command "kdkjflajfks" returns. Yes, we
have command history. Press the down-arrow
and we get the blank line again.
Recall the "kdkjflajfks" command using the
up-arrow key if needed. Now, try the left and
right-arrow keys. You can position the text cursor
anywhere in the command line. This allows you to
easily correct mistakes.
|
|
Even though the shell is a command line
interface, you can still use the mouse for several
things. That is, if you have a 3-button mouse, and
you should have a 3-button mouse if you want to use
Linux.
First, you can use the mouse to scroll backwards
and forwards through the output of the terminal
window. To demonstrate, hold down the enter key
until it scrolls off the window. Now, with your
mouse, you can use the scroll bar at the side of
the terminal window to move the window contents up
and down. If you are using xterm you may find this difficult,
since the middle button is required for this
operation. If you have a 2-button mouse, it may
have been configured to emulate a 3-button mouse.
This means the middle button can be simulated by
pressing down both the left and right buttons at
the same time.
Next, you can copy text with the mouse. Drag
your mouse over some text (for example
"kdkjflajfks" right here on the browser window)
while holding down the left button. The text should
highlight. Now move your mouse pointer to the
terminal window and press the middle mouse button.
The text you highlighted in the browser window
should be copied into the command line. Did I
mention that you will need a 3-button mouse?
|