General Introduction to the EEL Computer System, Part 1.

This information, along with some other useful stuff, is also available on the web at http://aiki.bme.duke.edu/eel

logging in

Each workstation runs a program that keeps the screen from displaying the same pattern for too long a time; in order to log in, you must press any key to stop that program. Depending on the machine, the screen may or may not clear; in either case, when you see

fel1 login:

on the screen, you may type your user id followed by

< ret >

(note that the name of the machine appearing before login depends on which workstation you are logging into). You must then wait for the workstation to respond by printing Password:, after which you should enter your password and

< ret >

Your password is something that should never be divulged to anyone else, and should never be written down. This is very important here in the CIEMAS Building, since we have people who are not part of our lab sharing it with us. If you want to change your password, read the man page for passwd.

csh

When you are logged in, each window will be running a command interpreter called csh (pronounced sea shell). This program is the intermediary between you and the system, accepting all user input and taking appropriate action. Each command that you type to the shell should be followed by a

< ret >

; from now on, that will not be mentioned. We will discuss several commands that you will find particularly useful. Most of these commands have man page entries where you can get more information.

ls

ls lists the files and directories in the specified location, or in the current directory if you don't specify a location. so

ls /rawdata

will show the contents of the /rawdata directory. The most useful option to ls is -l (almost all options to UNIX commands start with a -); it causes ls to give a long listing, which is more verbose. Instead of typing

ls -l

I can type

ll

ll is an alias for

ls -l.

cd

cd is used to change directories. When you first log in, you will be in your home directory; this is the place that all of your personal files will reside. Most home directories are found under /rhine/us1. So my home directory is /rhine/us1/ndd. Note that you don't need to know where a user's home directory is: ndd is a shorthand that refers to my home directory no matter which machine it is on. On occasion, you will want to change directories before doing a command; cd allows you to do this. For example, I could list the contents of /rawdata by doing either

ll /rawdata

or

cd /rawdata

ll

Note that there are some commands whose result depends on where you are when you execute them, so make sure you know where you are at all times!

file

It is often useful to know, given a file name, what type of file it is, since there are many commands that only work with one kind of file. The command file will tell you the type of the specified file. Since I'm currently in /rawdata, I can pick one of the files that I listed above, and do

file 2ps.3b

and file's response is

2ps.3b: data

This tells me that 2ps.3b is a data file, and therefore cannot be looked at with cat, more, or vi, all of which require ASCII files. file will identify ASCII files as such, or as text files.

cat

in order to print an ASCII file to the window, I can use the program cat. However, since I'm currently in /rawdata, and /rawdata has only data files in it, I have to move somewhere else first. I can return to my home directory by doing

cd

and then I can use ls to find some file names. One of the files listed is called calendar: when I do

file calendar

I get

calendar: ascii text

which means that it's okay to look at. So I can do

cat calendar

and cat will print the file to the window. cat is really most useful for small files, since it just prints them to the window with no control: if the file has more lines than the window, it will scroll off the screen.

more

more is a command that works much like cat, with the exception that it knows how big the window is, and only displays as many lines as will fit. To see the next line, you can type

< ret >

and to see the next window-full, you can type < space > . more is also useful with programs that produce lots of output to the window. For example, if I do

ll /rawdata

I will get several windows worth of output fairly quickly, with the result being that I will only be able to look at the last few lines. However, I can do

ll /rawdata

| more

and more will take the output of ls and let me control it.

|

This introduces the pipe symbol, which is obtained by typing a shifted backslash (\). | takes the output from one command and routes it to another. It is important to note that | is to be used between two commands only; you cannot use it to get output into a file. Another useful example of | is to get a printout of a listing:

ll /rawdata

| lpr

will send the output of ls to lpr which will print it on one of the laser printers. Note that which laser printer depends on which machine; the default printer for most of the machines is in the computer room, but some of the machines in the front office area print to the printer up there.

>

Above I mentioned that | cannot be used to get output into a file. What can be used for that purpose is the csh redirection symbol > . > causes the output of the command that it follows to be placed in the specified file. This assumes that you have permission to do this, which is something we will discuss later. So in my home directory, I could do

ll /rawdata > foo

and the listing produced by ls would be placed in foo. It is important to note that, if you have permission to write foo, > will go ahead and do it; it will not ask you if you really meant to replace the current foo (if there is one) with the output of your command. Be careful that you don't destroy an important file!

<

There are several commands that expect you to type input to them; you can get around this by using < to redirect the input of the command. One example of a program that expects user input is graph, which produces output suitable for the plot program. So instead of typing your input to graph, you could put it in a file and do

graph < foo | plot

command line editing

One of the most common ways to lose a file is through a typing error: you mean to type

ll > foo

but you type

ll > goo

and lose a day's work. In order to allow you to correct typing mistakes, the csh has three types of deletion: character delete, word delete, and line delete. The default character for character delete is ctrl-h (or the backspace key); for word delete is ctrl-w, and for line delete is ctrl-u. (This introduces a new notation: ctrl-h is a shorthand for holding down the Control key and pressing the `h' key; it is pronounced `control h'.) As long as you haven't typed

< ret >

you can use these characters to correct typing mistakes on the current line. Note that the keyboard will automatically start repeating a key if you hold it down long enough; this works for control keys, too.

mv

Suppose that we make a file called foo, but we meant to call it goo; we can rename that file using the command mv to move it from one name to another.

mv foo goo

mv can also be used to move several files from one directory to another; if I have the files foo1, foo2, and foo3 in my home directory, and I also have a directory called keep, I could do

mv foo1 foo2 foo3 keep

and foo1 through 3 would end up in keep, with the same names.

rm

If I decided that I didn't want to mv the foo files, but just get rid of them, I would use the command rm

rm foo1 foo2 foo3

Note that once a file has been removed, it is gone from the disk and cannot be easily resurrected. An empty directory can be removed with rmdir or you can remove a non-empty directory with

rm -r foo

cp

If you want to make a duplicate of a file, you can use cp. For instance, if I wanted another copy of foo, I would do

cp foo goo

and goo would be an exact duplicate of foo. This is mainly useful if you want a slightly different version of foo for some purpose. You should not make copies of files for backup purposes, as there are better ways.

mkdir

I've already mentioned the possibility of moving files into a directory, so we need to know how to make a directory. This is done with the command mkdir. To make a directory named foo, I would do

mkdir foo

I could then cd to foo and work in there. Directories are very useful for keeping common files together in an obvious place.

shortcuts

Here are some short cuts that will make things go a little faster.

history

,

;

The csh keeps a list of the last 50 commands that you have attempted to execute. If you decide that you want to repeat one of those commands, there are several ways to go about it. The character `,' is called the history character, and is used to access the history list. The command h (which is an alias for history) will give you a listing of the last 50 commands. Here is part of my history list:

39 mv foo1 foo2 foo3 foo4
40 mkdir tmp
41 mv foo1 foo2 foo3 tmp
42 rm -r tmp
43 h
44 latex foo.tex
45 d
46 pd
47 ls
48 latex goo.tex
49 h

If you want to repeat, say, command number 40, you would do

,40

and the csh will redo that command. Note that the command will be repeated exactly as it appears in the list; the csh does not care if you have changed directories or removed a file since the original invocation. This means that repeating command 42 probably should only be done after some thought. Another method for specifying previous commands is by the first few characters in the command. So I could repeat command 48 by doing

,la

Note that the csh will pick up the first match, so if I really wanted to redo 44, I couldn't use this method. If I want to repeat the very last command, I can do

,,

Now suppose I want to repeat the last command, but I want to change it slightly. The character `;' can be used in this fashion:

;oldpattern;newpattern

If I had just done

latex foo.tex

when I really meant `intro.tex', I could do

;foo;intro

and the command

latex intro.tex

would be executed. Note that it will match the first sequence of characters it can. The character `;' can be used to edit any word of the last executed command; the only thing it can't do is edit multiple words. So if I type

latex latex.tex

the only way that I could change the second latex would be to do something like

;ex la;ex las

but since `;' can't cross spaces, that won't work.

The use of `;' is a specific instance of a more general editing facility that is available with `,'. To edit any command in the history list, you first specify the command (either by number or by the first few characters) and then the edit string:

,23:s/oldpattern/newpattern/

Here, as with `;', you can not include any spaces in `oldpattern'; however, with both `,' and `;', you can include spaces in newpattern. There are two other very useful things that can be done with `,'; one is to specify the last word of the previous command, and the other is to specify all the arguments of the previous command. The first is done using `,$'. For example, I can do

file /rawdata/2ps.3b

ll ,$

rm ,$

which will result in information about the type of 2ps.3b, a long listing, and then removal. The second is done using `,*'. For example, I can do

file /rawdata/2ps.3b ndd/2ps.3b

ll ,*

rm ,*

The first line gives me file information about the file 2ps.3b in the directory /rawdata and in my home directory, then shows the directory entries for those files and removes them.

These tricks can be handy, especially when dealing with long file names, or long command lines.

Esc

ctrl-d

Another handy shortcut is the use of the Esc (escape) key. The csh provides a filename completion service that allows you to type the first few characters of a file name, and then press the Esc key; the csh will complete the file name if possible. If it can not unambiguously complete the file name, it will beep at you. You can get a list of possible matches by typing ctrl-d.

*

An additional useful shortcut is the character `*', which matches any number of any character(s). For instance, if I wanted to see all the files in /rawdata that begin with `p', I can do

ll /rawdata/p*

This character can be used with most UNIX commands, but it should always be used with care, especially with commands that change files, such as rm, cp, and mv.

ctrl-C

ctrl-C is used to interrupt a command that you decided not to run. For instance, if you started to print a manuscript using latex:

latex manu.tex

and then decided that you wanted to work on it some more first, you could stop latex by pressing ctrl-C.

ctrl-Z

ctrl-Z is used to suspend a command while you do something else in that shell. For instance, if you were in your home directory editing a file, and wanted to write a modified version to a different file name, you might want to check first to see if that file already exists. type ctrl-Z and you'll get a shell prompt; you can then do any shell command. Note that the job you suspended has not been killed; it's sitting there waiting to be restarted. There are two main options: you can type fg to return the job to the foreground (which makes it the only thing running in that shell) or bg to put the job in the background. Putting a job in the background means that it's running in the window, but you still have a shell prompt so you can do other work. Note that it doesn't make sense to put an edit job in the background, as such jobs are cut off from input.

If you try to log out of a window while a job is suspended, you'll get a message like `There are stopped jobs.'. It's advisable to bring such jobs into the foreground and exit them gracefully rather than have the shell kill them when you leave.


File translated from TEX by TTH, version 1.52.