CSC 173, Fall 2002

Getting Used to Your Linux Account

Most of you probably already have some experience with some variant of Unix, e.g. from turning in assignments for 172 last spring. For 173 we will be using the Linux machines in the 3rd floor Hylan lab. Note that three high-end cycle servers are available for remote access from anywhere on the Internet.

If you are used to a PC or Macintosh environment, you will find Linux a little less "friendly". There are lots of window-based tools, and a nice desktop environment, but much of your work will happen via a command-line interface to a program called the "shell". A good place to start is the on-line help system: man (for "manual"). Type

      man man
  
and read what shows up. Then read the man pages for the following:
      cd
      pwd
      mkdir
      rm
      rmdir
      chmod
  
Note that the name .. (dot dot) can be used to refer to the parent of the current directory in the file system hierarchy.

Once you are comfortable moving around in directories and listing files, skim the man page for the default shell, csh. It has a lot of functionality -- more than you want to know about yet -- but you'll find it helpful over time to have a sense of what's available. At some point, for example, you'll want to learn about "job control", which allows you to have more than one program running simultaneously, under the control of a single shell.


Editing

Finally, you need to become proficient with one of the text editors. I strongly recommend emacs: it's the most powerful and popular of the Unix editors. It has a very steep learning curve, so expect to invest a lot of time getting used to it. Once you've made the investment, however, you won't want to go back to anything else.

If you are already a die-hard user of vi, then don't let me dissuade you from using it. I personally switched from vi to emacs and won't go back.

Emacs has good built in help and a good tutorial. The easiest way to reach the tutorial is to use the mouse, go to the "help" menu, and select Tutorial. It may take some time to go through this, but it will be time well spent.

Once you've run the tutorial, you should check out texinfo mode, a more extensive help system built into emacs. Type

      M-x info <rtn>
  
to get into texinfo mode. (note: "M" is the meta key. Sometimes you can press and hold the alt key. Sometimes you can press and release the esc key and have the same effect.) Then type
      m info <rtn>
  
to learn how to use texinfo itself. (That's "m" [for "menu item"], not meta.) Until you've learned the various texinfo browsing commands, know that <sp> will keep moving you forward through the material. From the same initial texinfo menu page, type
 m emacs <rtn> 
to get documentation for emacs itself.

My most used commands:

  1. C-x C-s (control-x followed by control-s) to save the current buffer (just leave your finger on the control character and type x followed by s)
  2. C-x C-f you will be prompted to enter a file name (look in the buffer at the bottom of your emacs buffer). This command opens a new file.
  3. C-g (control-g) to abort the current emacs command, whatever it is.
  4. C-s string to search forward for a string. You can repeat this command as many times as you like by continuing to press C-s
  5. C-x C-c to quit the editor.
  6. C-v move forward one page
  7. Meta-v move backward one page
  8. Meta-< move to beginning of the file
  9. Meta-> move to end of the file
  10. C-l center the line the cursor is on in the middle of the screen.
  11. Getting quite fancy (please skip this until you are more familiar with emacs): you can open more than one buffer simultaneously. Type C-x 2 and see what happens. Follow this with C-x C-f to open a second file in the 2nd buffer. Then try C-x 1. This will take you back to single buffer mode. Now try C-x b. This will change your buffer.