Practicum - week 10


1. Try out pico as a text editor, and try out pine by sending e-mails to each other.


2. Start XEmacs by typing 'xemacs &'.

Remark: the & symbol means that you want to run the program "in the background": you wish to get back the prompt immediately, before the launched program has quitted. If you don't add this symbol, you can't use that terminal (console) simultaneously with XEmacs. (Of course you can run another console...) Try out the difference.

Go through the XEmacs manual: when entering XEmacs, type ^H T (CTRL-H, then T). Do it very carefully, practicing a lot.

There is no assignment about this now, but there will be some questions about using Emacs or XEmacs in the final test: questions like what is the key combination for easy commands, that you use very often. So you should acquire a basic skill of using Emacs or XEmacs, by working in these editors as much as you can, instead of pico.
 

3. Assignments:

Create a directory 'assignment_1'  within your home directory.  Create the following ones within it: a directory called 'continents', as well as files called 'asia', 'europe', 'america', 'africa' and 'australia'.

Then give the appropriate command lines using wildcards to execute exactly the following tasks (in this order), without changing your working directory:

  1. - list 'asia', 'america', 'africa' and 'australia'
  2. - get a long list about 'europe' and 'africa' (note that both contain exactly 6 letters)
  3. - get a reverse alphabetical list (according to the latin alphabet) of 'america' and 'australia' (check the manual for the appropriate options)
  4. - move 'asia' and 'europe' into 'continents'
  5. - rename 'continents' to 'world'
  6. - copy 'america' to your home directory
  7. - rename the file 'america' that is in your home directory to 'new continent' (note the space in the file name!)
  8. - copy the files in 'world' to your working directory
  9. - delete the content of 'world' (but not the directory itself)
  10. - remove 'africa', but let the computer ask you beforehand if you really want to do it.

Tip: as long as you are not sure that the expression containing a wildcard matches exactly the files you wanted, don't use the commands for copying, moving (and especially not removing!). Experiment first with the command for listing.


 

(10 points)
 

Send the solutions for these assignments to Tamás (birot@let.rug.nl) by using either pine or Emacs / XEmacs or some other mailing program under Unix. I don't accept mails sent from your regular university account or from some yahoo, etc. account.


4. 10 minutes of vi

Start vi by typing: ' vi <filename> '. Then don't panic!

There are tree modes in vi:
- command mode: typing a character means a command, and does not appear on the screen.
- input mode: now you can type in whatever text you wish into your text, to the place where the cursor is.
- status-line mode (last-line mode): issuing long commands that will appear on the bottom line of your screen.

Changing between these modes:
- when you enter vi, you are in the command mode;
- pressing the 'Esc' button ('escape') brings you back always to the command mode;
- from command mode 'a' or 'i' brings you to input mode;
- from command mode ':' brings you to the last-line mode.

In the input mode you can just type in your text, but you will sometimes be surprised that you are not able to delete it. Maybe you are even not able to use the keys for moving your cursor! Then go back to the command mode (by using Esc) and bring the cursor onto the character you wish to delete. Just press 'x' to delete. Then 'a' or 'i' will bring you back to input mode.

Are you lost and even not able to move your oursor? Use the h (left), j (down), k (up) and l (right) keys in the command line.

In fact 'x' deletes the given character by putting it into a buffer ("cut") and 'p' will paste it to the actual position of the cursor. If you wish to put more than one character into the buffer (e.g. copying or moving an entire word), then just type the number of characters before 'x'. For instance '5x' will delete five characters, and put them into the buffer. Finally, 'dd' will delete you a line, and put it into the buffer. If you get lost, just don't panic...

By pressing ':', you get to the last-line mode. Pressing 'vi' will start a new file ("new document"), 'vi <file_name>' opens the mentioned file. Typing 'w' will
save (write) our file, while typing 'w <file_name>' saves as (under) the given name.

Leaving this sadistic editor is possible by typing 'q' (quit), 'q!' (quit, even if not saved) or by 'wq' (save and quit).
 

Assignment: show the teacher that you manage to handle vi, at least for 45 seconds...!


 

5.

Now you can go back to pico and XEmacs! Relax and enjoy having left vi...