Next Previous Contents

3. Stage 2. Terminal to remote UNIX system

Arrange for what is called a "shell account" on some Unix system. Most Internet Service Providers (ISPs) can provide this service. Use the terminal emulator program and a modem to dial in. Learn the basic Unix commands. If the system has Emacs installed, or you can persuade the system administrator to install it, this is your second chance to learn it. It is probably best to learn it at this point, because administering a Unix system (the next stage) will call for you to edit files. Therefore, I include here my suggestions for learning both Unix and Emacs.

3.1 Learning Unix

When you arrange for a shell account, or set up a new account on your own machine, you will have to decide on a username and a password. Your username will also be used in your email address, so try to find something short and memorable. Your password is important, and should be hard to guess. That usually means at least six characters, including at least one non-alphanumeric character.

When a Unix system is ready for you to log in, it normally displays a prompt ending with "login:". At this point you should type in your username. It will then prompt you for your password, and will turn off command echoing while you type it in.

The command to finish a terminal session is logout.

There are many kinds of documentation available on a Linux system. Traditionally, each command has a manual page which can be displayed by the man command. For example, learn more about the cp command by typing man cp. Of course, this helps only if you know or can guess the command name. However, each man page has a line near the beginning with the command name and a short description of what the command does. You can search a database of these lines using the command apropos. Thus, typing apropos working will list lines that include the word "working". Here's what that command prints here:

cd (n)               - Change working directory
pwd (n)              - Return the current working directory
Cwd (3pm)            - get pathname of current working directory
chdir (2)            - change working directory
fchdir (2)           - change working directory
get_current_dir_name (3) - Get current working directory
getcwd (3)           - Get current working directory
getwd (3)            - Get current working directory
pwd (1)              - print name of current/working directory
rcsclean (1)         - clean up working files
The numbers in parentheses are sections of the manual. User commands are in section 1. Functions called from within programs are in sections 2 and 3. Commands used mostly by the system administrator are in section 8. You can find out more about the on-line manual with the command man man.

The program that interprets your command is a "shell". Under DOS, COMMAND.COM is the shell. Most Unix shells are descendents of either the Bourne shell sh or the C shell csh. The shell most commonly used with Linux is the "Bourne again shell", or bash. Many Unix commands that were once separate programs are built into bash. Help for these is also built in. For example, typing help cd will display a short description of the cd command. Typing help by itself will display a list of all the builtin commands. Unfortunately, it is shown in two columns. If you find this confusing, you can pipe the list through colrm to eliminate one column. Type help|colrm 37 to show just the first column, and help|colrm 1 36 to show just the second column.

Many Linux programs from the Free Software Foundation are best documented in info pages. For example, the C compiler documentation can be displayed by typing info gcc.

Under Unix, commands normally accept options starting with a minus sign rather than the forward slash used under DOS. In a path, directory names are separated by forward slashes rather than backward slashes. Both operating systems have a "standard input", by default the keyboard, and a "standard output", by default the display screen. You can redirect the standard input using "<", and redirect the output using ">". You can use the output from one command as the input of another by separating the two commands with "|". This is called the "pipe" symbol.

If a program gets "stuck", here is a sequence of keystrokes to try:

Guido Gonzato Guido@ibogfs.cineca.it has written an excellent guide to Linux for (former) DOS users, the DOS2Linux mini-HOWTO. You can probably find it where you found this document, or else at ftp://metalab.unc.edu/pub/Linux/docs/HOWTO/mini/.

You can find general Unix information, including manual pages for several systems at http://www.cis.ohio-state.edu/hypertext/man_pages.html

There is a tutorial entitled "Beginning Unix and the C Shell" at http://www.eng.hawaii.edu:80/Courses/C.unix/page-03.html.

You can get general help from http://www.nova.edu/Inter-Links/UNIXhelp/TOP_.html or http://www.eecs.nwu.edu/unix.html

You can find a list of books on UNIX at http://www.eskimo.com/~cher/eskimospace/booklist.html.

3.2 Learning Emacs

When you start Emacs, you will normally list on the command line one or more files which you will be editing. To edit a file named "foobar" with Emacs, you would enter the command emacs foobar. If you enter the command emacs with no arguments, GNU Emacs will print out an introduction which includes the first five commands you need to learn, approximately as follows:

   Type C-h for help;   (`C-' means use CTRL key.)
   Type C-x u to undo changes.
   Type C-h t for a tutorial on using Emacs.
   Type C-h i to enter Info, which you can use to read GNU documentation.
   To kill the Emacs job, type C-x C-c.

Note the way Emacs documentation refers to key combinations. C-h means hold the control key down while typing "h". You will also run into key combinations like M-v, which is pronounced "meta v". The tutorial suggests holding down the key labeled "edit" or "meta" then typing "v". I have never run across a keyboard with those keys, so I always use the escape key instead: typing "Esc" then "v" (two separate keystrokes). After using Emacs for a long time, I discovered that under Linux, the left "Alt" key works like a "meta" key. You may want to use this. On the other hand, some of these key combinations may conflict with your screen reader or communications program under DOS. Using the escape key is more reliable.

Three of the above commands start with C-h, which may be treated as a backspace by your communications program. In that case, you may access the help command using the long form M-x help. Conversely, you may find that pressing the backspace key starts the help command. This issue is treated in the Emacs FAQ, which is available within Emacs using C-h F or M-x help F. Look for the question "Why does the `Backspace' key invoke help?". In the mean time, you can end the help session with the command C-g. (This is the keyboard-quit command, which cancels any prefix keys you have typed.)

You may also find that C-s and C-q are unavailable because they are used for flow control (XON and XOFF). You should look at the question "How do I handle C-s and C-q being used for flow control?" in the FAQ. For the particular command C-x C-s (save buffer), you may substitute the command C-x s (save-some-buffers). The former command saves the current buffer, while the latter asks the user about each of the modified buffers.

Note in particular the command "C-h t" to start the Emacs tutorial. That is one the first things you will want to try. I will only make a couple of comments on the tutorial. To move the cursor, it gives the four commands C-f, C-b, C-p, and C-n (for forward, back, previous line, and next line). These commands always work. However, with a properly installed Emacs, the regular arrow keys should also work. Try them out and use them if you are more comfortable with them. Similarly, you may be able to use home, end, page down, and page up keys in place of the standard commands C-a, C-e, C-v, and M-v. Finally, all Emacspeak commands begin with C-e. Once you start using Emacspeak, you will have to type it twice to get the end of line function. (The "End" key should be unaffected by Emacspeak.)


Next Previous Contents