Things change on our developer machines. If you notice anything wrong with
these instructions, please let the TA know. Similarly, if you feel some topic
is missing, let us know as well. You can download the X-Windows software from the ISD software download site
(note that the Windows 2000 version of X-Windows will work for Windows
XP). Follow the installation
instructions from the ISD site (they are checked). Also, download a FTP client of your choice. To make sure you can connect to aludra.usc.edu using X-Windows, we will go
over using the basic X-Windows commands below in Lab1, please pay attention to
them because you will need to use them repeatedly throughout the class: 1.
Open X-Windows by going to the Start menu,
clicking on Programs, and then selecting the X-Win32 icon. 2.
Open your Telnet window by going to the Start
menu, clicking on Run, and then typing in telnet aludra.usc.edu. 3.
When the telnet window appears, type in your
login information. 4.
Now that you are logged into Aludra
UNIX server, in your Telnet window, you have to tell the UNIX server where to
send your X-windows. a.
You must find the IP address of your own
computer by going to run, type command, and then ipconfig
/all in the prompt window. b.
In the Aludra Telnet
window, type in setenv DISPLAY ip_address:0, where ip_address = the ip address you
just found from ipconfig /all c.
Then type in xterm. d.
In a few seconds, a X-windows should pop up. We will go through a short tutorial in class to make sure you can execute
the basic commands in Unix (For our purposes, we will be using Emacs). However, if
you're not familiar with Unix/Linux and proficient in at least one Unix-based
editor, PLEASE make sure you read up and familiarize yourself with Emacs by going to the below links since you'll be using it
extensively in CSCI201. YOU HAVE TO GET
YOUR CODE RUNNING ON YOUR UNIX ACCOUNTS FOR PROPER GRADING. a. cp
-i -r existingDirectory newDirectory b. For
example, after you unzip v1, you'll have an agentsV1 directory (or something
like that). Then, before modifying anything you need to copy it to a directory
whose name might be agentsV3: c. YOU
SHOULD ALWAYS HAVE A RUNNING VERSION OF YOUR WORK. Every time you are going to
modify something running, you should copy it as a backup. 1.
Start up Emacs by
typing in emacs in the Telnet window a.
The display in Emacs
is divided into three regions. The top region is called the text window,
which displays the document you plan on editing. b.
At the bottom of the text window, there is a
single mode line. The mode line gives information about the document and
the Emacs session. c.
The bottom line of the Emacs
display is called the minibuffer, this holds
the space for the commands that you give to Emacs by,
and displays status information, the commands are discussed below. 2.
Modern emacs has a
Windows-like interface with menus that you can control with the mouse. 3.
Experienced emacs
users most often use keyboard commands. a.
Many commands in emacs
are started by typing the Control key followed by a letter, e.g. c-s is incremental search. b.
Emacs also uses
[Control-X] to initial a command, e.g. c-x c-f will initiate the find-file
command. c.
You can also access commands by name using [Escape-X] or [Alt-x]. These appear in the
command line as M-x and then you type the command (using spc
for name completion), e.g., Alt-x shell will open a shell in emacs. 4.
Most commands can be cancelled with Control-G. 5.
To exit Emacs and
return to the UNIX shell, type [Control-X-Control-C].
a.
If you have made changes to the buffer since the
last time you saved it to disk, Emacs will ask you if
you want to save. b.
Type y
for yes, or n for no. 6.
Online Help: Emacs has
an on-line help system that can be invoked by typing [Control-H]. a.
If you type the question mark (?), Emacs
will present a list of help topics you can choose. Working with Buffers in Emacs Buffers are work spaces. You can have many buffers in an emacs
session. When you open a file, it is put in a buffer. When you save a file buffer the file is
rewritten. Save often. ·
You can move from buffer to buffer by using the
Buffers menu. ·
c-x b
Moves you to another buffer. If you don't type a name, it defaults to
the last buffer. ·
c-x 2
Divides the window into 2 buffers. Very Useful. ·
c-x 1
Puts the buffer into a single window. Working with Directories in Emacs (Using the
Dired Command) Entering Dired Moving around in the Dired
Buffer Visiting Entries in Dired Deleting Files with Dired Operating on Files (notice the capitalized command
letters) Shell Commands in Dired o If
you use `*' in the shell command, then it runs just once, with the list of file
names substituted for the `*'. The order of file names is the order of
appearance in the Dired buffer. o If
the command string doesn't contain `*', then it runs once for each file, with
the file name added at the end. o %
u Rename each of the selected files to
an upper case name (dired-upcase). o %
l Rename each of the selected files to
a lower case name (dired-downcase). o %
R from RET to RET, % C from RET to RET, % H from RET to RET, % S from RET to
RET These four commands rename, copy,
make hard links and make soft links, in each case computing the new name by
regular expression substitution from the name of the old file. File Comparison with Dired
using diff Subdirectories in Dired Moving Over Subdirectories Updating the Dired Buffer Dired and find ·
You can select a set of files for display in a Dired buffer more flexibly by using the find utility to
choose the files. Working with a File in Emacs 1.
To read a disk file into an Emacs
buffer, type the command [Control-X-Control-F],
then type the name of the file, and then [Return], and Emacs will load the file
into a buffer, and display it in the text window. 2.
To save the contents of the buffer to a disk
file, type [Control-X-Control-S].
3.
To write the contents of the buffer to a
different file with the command [Control-X-Control-W],
then type the name of the file, and then [Return]. 4.
To create a new file, use [Control-X-Control-F], then type the
name of the file, then [Return], and an
empty document will appear in the text window. 5.
To use file name completion, type part of the
name of the file you want, and press the [Spacebar] or [Tab]
key to complete a file name. If Emacs displays a few
or more potential matches, continue typing in more of the file's name, and keep
pressing file completion key until you get the file you want. Working with the text window in Emacs 1.
To insert text into a buffer, or the text
window, move the cursor to where you want the text to appear and type. 2.
To Delete text just press delete or use one of
the following: a.
[Control-D]
deletes forward one letter. b.
[Control-K]
deletes from the point to the end of the line. c.
[Escape-D]
deletes forward one word. d.
[Escape-Delete]
deletes backward one word. 3.
To select, move the cursor to where you want to
begin the selection and type [Control-Spacebar],
which sets the mark, and move the cursor to the other end of what you are
trying to select. This will select the
whole section. 4.
To cut, type [Control-W]. 5.
To paste, type [Control-Y], but only pastes the most recently-cut text. 6.
To paste in earlier cuts, type [Escape-Y], which cycles every time you type
it, but you must first type [Control-Y] first for [Escape-Y] to work. 7.
To copy, type [Escape-W]. 8.
To undo, type [Control-_] (Underscore). Running
a unix shell from within emacs Help Commands File Cursor/Screen Movement Commands Copy and Delete Commands Search and Replace Commands Window and Buffer Commands Exiting Emacs, Fixing Mistakes and Other
Important StuffAludra
Unix Basics
Disclaimer
X-windows and FTP client
Getting around in UNIX
Some
common UNIX commands
This does a recursive copy of all files and subdirectories.
cp -i -r agentsV1 agentsV3
Emacs Basics
Starting up Emacs
This creates a buffer, named *shell*, that allows you to run ant or
any other unix command without leaving emacs.