The shell is the program you use to run and manage other programs. When you open a new "Terminal" (xterm/dtterm/etc) the prompt you see is generated by your shell. When you type in a command, the shell interprets it and runs any programs that you told it to.
The shells are very powerful programs that let you do a lot more than just running programs. Here are a few items that you should know about:
There a number of shells available: csh, tcsh, bash, and ksh are a few. Each shell has different syntax and features. The default shell (at the university) is typically csh. tcsh adds some nice features to csh. So the subsequent points describe only csh/tcsh.
To change your login shell on the cadXX machines, telnet to gpu and type:
chshFollow the instructions to change your shell. Unfortunately, it says that the change may not take effect until overnight.
To change your login shell on the hpXX machines, telnet to nyquist and type:
chsh <username> <path-to-shell>For example:
chsh jdoe /bin/tcsh
It will take about 10 minutes for the change to come into effect. Of course, you can always start up a shell just by typing in the name. For example, if your shell is csh, you can type 'tcsh' and now you will have a tcsh. When you exit from tcsh, you will return to the csh.
WARNING: When changing your shell, ensure that you correctly type in the path to the shell, or you will not be able to log in!
A very useful feature is filename completion (it also works on directory names). You just need to type the first few characters of a filename. To complete the filename, press ESC in csh or TAB in tcsh. If there is a unique matching filename, it will be inserted on the command just as if you had typed it in. This is very helpful for long filenames, and when you don't exactly remember the path to, or the name of, a file.
The shell remembers a certain number of previous commands that you entered. One important advantage of tcsh over csh is that you can use the up and down arrows to scroll through your history; you can go back to a previous command that is close to what you want, and then edit it, and press enter.
You can also access the history in a different way, which is available on both csh and tcsh. To get a list of your previous commands, type:
historyTo execute one of the commands again, just type an exclamation mark followed by (no space) the number of the command (given in the first column). For example:
!67
To execute the last command, type two exclamation marks:
!!To execute the nth last command, type an exclamation mark followed by a minus sign, and then how many commands back you want to go. For example, this executes the second last command you entered.
!-2You can also execute the last command that begins with certain text by typing an exclamation mark followed by the text to match. For example, this will execute that last command that started with emacs:
!emacsFor any of these shortcuts, you can also add text after. For example:
ls !! -laAnother useful shortcut is !$. This represents the last word on the previous command. For example:
mkdir project cd !$This will create the directory project, and then change to that directory.
Your shell maintains a list of environment variables. These store information about your username, paths, terminal type, program defaults, and other things. You can view this list by typing:
setenv
These variables are accessed using a $ in front of the name (note that the names are case sensitive). For example, to display a certain variable, type:
echo $PATHTo change a variable, type:
setenv MYVAR blahNote that you don't use a dollar sign when setting the variable.
An important variable for doing remote X Windows is DISPLAY, which is described below.
Each running program is refered to as a process. The shell allows you to manage these processes. When you run a program, it runs in the foreground in the shell, and you can't execute any other commands from the shell until it is finished. This is particularly annoying when you are logged into a remote machine. To start a program in the background, you just put a & after the command line, for example:
maxplus2 &However, you might get a message indicating that a program is suspended because it is waiting to write to the shell window (tty). You can type:
fgto cause that program to run in the foreground. For any running program (for example, you forgot to put the & after the command), you can suspend it by typing Control-Z in the shell. Then you type:
bgto cause the program to run in the background.
You can get a listing of all the background processes by typing:
jobsThe number displayed in square brackets can be used in the fg, bg, and kill commands (preceded by a percent sign) to reference that specific job. These commands default to the last job started. For example:
jobs [1] + Suspended (signal) pine [2] - Running netscape fg %1This will bring job 1 (pine) to the foreground.
Under UNIX, collections of files are normally distributed as gzipped tar files, with the extension .tar.gz or .tgz Unlike DOS/Windows where ZIP files contain multiple files, and are compressed, UNIX has two programs, one for each part. To extract the files from a .tar.gz (say libbf.tar.gz) you would try:
tar -xzvf libbf.tar.gzWhich runs gzip for you, and extracts the files. If tar complains about the z option, then you have to do it in two steps:
gzip -dv libbf.tar.gz tar -xvf libbf.tarThe v option to tar causes it to list all the files as it extracts them. A useful option is t, which lists the files in the tar file, but does not extract them. This is important because some tar files do not contain directory information, and all the files will be extracted to the current directory. However, most tar files will extract to their own directory. The t option will show you if the files have path information. For example:
tar -tf libbf.tarAs usual, use the man command to find out more (i.e. 'man tar').
Every computer is refered to a host. Each host belongs to a domain. Each host has a name, such as nyquist, hp20, or cad01. This uniquely identifies the computer in it's own domain. Each computer also has a fully qualified name, which is the host name followed by the domain, such as hp20.ee.ualberta.ca When specifying a host between domains, you typically must use the full name (You do not always have to type the full name, since some machines search a set of domains when you don't specify one; if the domain you want is in the search list, then you don't need to type it.)
Here is a list of some useful domains to know:
Network | Hosts | Domain |
Nyquist computers (CEB 540) | nyquist, poisson, hp01 to hp30 | ee.ualberta.ca |
Sun Workstations (CEB 531) | cad01 to cad34 | labs.ualberta.ca |
Hinton (CAB 311) | hinton-2 to hinton-5, hinton-a to hinton-l | cs.ualberta.ca |
X Windows is a standard between UNIX computers for graphical displays. Each computer has an X server, which is what manages the different windows and the UI interaction. Normally, you run programs locally; for example, if you type netscape, then the netscape program runs on your computer, and the window is displayed on your computer. The X server also has the ability to display the windows of programs that are running on remote machines. There are a number of ways to do this.
We can explicitly tell the X server to accept windows from the remote computer, and tell the remote computer which display to actually use. This process will be explained using an example. Say that you are sitting at hp23, and you want to run maxplus2 off of the Sun workstations in CEB 531 (since you have your files on those systems). You open a terminal on your computer; you should see a prompt like 'hp23%'. You pick a CEB 531 computer, say cad28. You type:
xhost + cad28.labs.ualberta.caThis allows windows from that cad28 to be displayed on your computer. Then you telnet/rlogin/rsh/etc to cad28. For example:
telnet cad28.labs.ualberta.caYou log in, and from that computer you type (make sure you remember the :0.0 at the end):
setenv DISPLAY hp23.ee.ualberta.ca:0.0This will set the default display to be the computer you are sitting at. Then you can run any programs that you want to, for example:
maxplus2And maxplus2 will show up on your screen.
ssh (secure shell) simplifies the above process. In addition to providing secure communication, it also allows to run an X program from the computer that you logged into using ssh, and it will automatically be displayed on your screen, without having to use xhost and setting the DISPLAY variable. However, not all computers have ssh installed; in particular, the CEB 531 computers don't, but this may change in the near future.
For a trivial example, from hp23, you type:
ssh hp01and log in. Then you just run any X programs, and they will be displayed:
xlogo
The techniques described above run individual programs on your display. You can also run an entire X session from a remote computer. If you want to do this, you must do a command line login to the local machine. For the hpXX and cadXX computers, you do this by choosing the 'Options' menu from the log in screen, and selecting 'Command Line Logon'. Then you type (using cad28 as an example):
X -query cad28.labs.ualberta.ca -onceAnd you log in as though you were at cad28.
Go to a terminal open on your machine (eg. cad01). You should have a cad01% prompt, or something similar. Type:
setenv DISPLAY cad01.labs.ualberta.ca:0.0 winThis should start NTRIGUE. Make sure that you use your Nyquist username and password.
This is a very nice lab of HP's with large screens. There are two different types of machines here: the workstations and servers. If you use one of the workstations, you have to choose hinton-2 to hinton-5 from a list before getting the log in screen. You log in using your gpu username and password. Open a terminal, and type:
echo $DISPLAYIf you are on one of the servers, this will just say ':0.0'. Then you display is just hinton-2.cs.ualberta.ca:0.0 (or whichever server you're on). If you are on a workstation, it will say 'hinton-x.cs.ualberta.ca:0.0' where x is a letter. You need to use this display name when you telnet to another computer and do a setenv DISPLAY.