If the problem is with a program on the system or some other software problem you can
send an e-mail to software@cpsc.ucalgary.ca.
If the problem is related to hardware like a smashed mouse (from a 455 student) you
should direct your email to hardware@cpsc.ucalgary.ca.
Sometimes a problem will keep you from using email. In this
situation you can turn to
the cool but busy people who keep things running smoothly in the
tech department. You
can find them through the door in the south west corner of the first
floor computer
lab. The room number is MS145. Find the corner with the pop machine
then walk down the long way
toward the next corner. You can also try room MS130 - The Computer
Science Undergraduate Society. ( Go give these people five dollars
for a membership. Then you can get free coffee untill the end of the
winter term! ) If the door is open then someone should be there.
Just walk in and ask really nicely. These people don't get paid
or anything like that but we do up these usefull notes for
people anyway and will usually try to help.
Back to the top.
Pine is pretty helpful and you can usually use the arrow keys to move around. At the bottom of the screen pine will show you what keys to press to do things. These keys show up in coloured blocks next to the keyword. Sometimes you need to use 'control characters'. Control characters are simply keys that you have to press together. They are often shown as ^X and we say this as 'control X'. To enter a control character we just press the character while holding down the control key. The control key is often labeled 'ctrl'. When pine starts and is done all of it's setup stuff we see the main menu. At the very top of the main menu we see that pressing the '?' key will bring us to the help page. This is the first thing you should look at when you run pine for the first time. This help page explains how to use pine.
If you just want to send an email follow
these instructions. First run the pine
command. Press enter to confirm your user id. Type your
password and press enter. Then at the main menu press C for compose.
At the top on the line labeled 'To :' type the email address you
are sending this message to. Use the arrow keys to move to the
'Subject :' line. Type a description of your message so whoever you
are sending the message to knows what the message is about.
When you press enter the cursor
moves to the bottom part of the screen under the heading
'----- Message Text -----' . Now you can type your message. When
you are all done just press ^X to send it. So you just hold down
the control key while pressing the X key. Usually with control
characters even though they may be written in capital letters you
can use lowercase as well. So ^D is the same as ^d. This is in
general true but not necessarily a computer law.
Back to the top.
Windows 95 or 98: 1) Click on the 'Start Menu' button. 2) Click on 'Run'. 3) In the box type 'telnet' and press enter. 4) Click on the 'Connect' menu. 5) Click on the 'Remote System' option. 6) In the 'Host Name' box type the host's name. (eg csc.cspc.ucalgary.ca) 8) Click on 'Connect'. Windows 2000: 1) Click on the 'Start Menu' button. 2) Click on 'Run'. 3) In the box type 'command' and press enter. 4) Type 'telnet HOSTNAME' just like you would from unix.Then you should be able to log in just like normal.
NAME | PLATFORM | OPERATING SYSTEM (OS) |
---|---|---|
csb.cpsc.ucalgary.ca | Sun Ultra-Enterprise2 | Solaris 2.7 (SysVR4) [SunOS 5.7] |
csc.cpsc.ucalgary.ca | Sun Ultra-Enterprise2 | Solaris 2.7 (SysVR4) [SunOS 5.7] |
csd.cpsc.ucalgary.ca | Sun Ultra-Enterprise2 | Solaris 2.7 (SysVR4) [SunOS 5.7] |
cse.cpsc.ucalgary.ca | Sun Ultra-Enterprise2 | Solaris 2.7 (SysVR4) [SunOS 5.7] |
csf.cpsc.ucalgary.ca | TEMPORARILY UNAVAILABLE (being upgraded) | csg.cpsc.ucalgary.ca (Prof & Grad Use Only) | Sun Ultra-Enterprise2 | Solaris 2.7 (SysVR4) [SunOS 5.7] |
csh.cpsc.ucalgary.ca (New!) | Sun Ultra-Enterprise250 | Solaris 2.7 (SysVR4) [SunOS 5.7] |
csl.cpsc.ucalgary.ca (New!) | Dell PowerEdge 2300 | Redhat Linux 6.0 |
fsd.cpsc.ucalgary.ca (Restricted Access) | Sun SPARC 5 | SunOS 4.1.4 BSD UNIX |
ls List - lists the files in the current directory. cd Change Directory - changes the current directory. pwd Print Working Directory - tells you what the current directory is. rm Remove - erases a file. NOTE unix has NO RECYCLE BIN. touch Touch - creates a file. can also update the timestamp of a file. cp Copy - makes a copy of a file in another directory or with another name. mv Move - moves a file from one directory to another. Also this is how to rename a file in unix. mkdir Make Directory - creates a new directroy. rmdir Remove Directory - deletes an existing directory. cat Concatonate - dumps a file out to the screen. more More - shows a file on the screen one page at a time. To see the next page press the space bar. less Less - just like More but you can use the arrow keys to scroll up and down one line at a time. So less is more than more. lpr Line Printer - send a file to be printed (in the basement by default).
If you like you can use alias x=ls to make x have the efect of ls. If however you want to make y have the effect of ls -l then you need to use alias y="ls -l".
NOTE: this is only the case for the BASH shell! If you are using
the CSH or TCSH then these commands would look like:
Each of the three blocks of characters is for a different group of
people. The first block represents the permissions for the 'user' that owns the
file. In this example the user 'frink' can do all three (read, write, and
execute to) the file. The second block is for the 'group' of people on the system
who are a part of the 'users' group. Every user is assigned a group that they
belong to (A user can belong to many groups. To see your list of groups type the
groups command.) The last block is for anyone
else on the system. To change the permisions on a file we use the chmod command. We use it like this: chmod o-r. Which will go to the other ( 'o' ) block and
take away ( '-' ) the read permision ( 'r' ). We use the same characters for the
permision that we want to take away or give as we see in the ls -l listing. We use '-' to take away a permision and '+'
to add a permision. You might have guessed that to refer to the user we use 'u',
for the group block we use 'g' and for other it is just an 'o'.
The more command shows the contents of a file one
screen at a time. In more the space
bar is used to move to the next screen. The enter key moves ahead one
line and somtimes the b key moves back one screen (depends on the
version of more being used). To use more just type more my-files-name.
The next advancement in file viewing
is the less command. less is like more but in less the arrow keys
will scroll up and down one line at a time. So we can clearly see
that less is more than more. What else can be expected from a system
that 'executes' commands to start them and 'kills' them to stop them?
To use less we just have to type less my-files-name
The solution is
the Mesage Of The Day. Known as the MOTD for short (Just say the
letters). When you first log in to the system some words should be
printed on the screen. READ THESE WORDS EVERYDAY. They will tell
you valuable things you need to know. When exam rooms get moved
this is how they tell you! We don't all get a letter in the mail to
inform us about these things. All students and users are expected to
read this message. DON'T go to the hardware guys and say 'Why can't I
use program X' untill you have checked the MOTD! So we know how
important the MOTD is but what if we miss it? Simple we just use the
command more /etc/motd. That's it.
If you are loging in to the Sparc machines in the lab you get a window
with the MOTD in it. To scroll this window you have to click the bar
on the side of the window with the MIDDLE mouse button. Then while
holding the button down move the mouse up and down. This will let
you see the rest of the message if it is too long.
Note that it takes time get your printouts
so don't worry if it is not there right away. You can also talk to
the people in dispatch if you are having troubles. You can also use
lpr -Px2up typscript. This will print
twice as much on each sheet of paper. So all of your fellow tree
huggers will be happy.
Eventually you may need to add another directory to the PATH. We do this
with the command PATH=$PATH:/home/frink/bin.
Where /home/frink/bin is the directory that we
are adding to the path variable. NOTE that this is for the BASH shell. If you
are using TCSH then you should use the command set path=($path
/home/frink/bin) with whatever directory name you are adding. In BASH
you should use uppercase PATH. In TCSH you can use lowercase path but it is good
to use PATH to be a consistant as possible.
alias acs1 ssh acs1.acs.ucalgary.ca -l
ccclark
alias x ls
alias y ls -l
Notice that with the CSH there is no equals sign and no double
quotes are needed. In the csh the asumption is that anything after
the second space is part of the command being aliased.
Back to the top.
Because UNIX can have many people using it we need some way to protect our files
from other people. The UNIX answer to this is file permisisons. Type the command
ls -l. The output will look kind of like this.
drwxr-xr-x 3 frink users 4096 May 14 14:48 public_html
-rw-r--r-- 1 frink users 1454 May 20 22:19 typescript
The permisions are availiable in the string on the left end. The string for the
first line gets broken up like this.
d rwx r-x r-x
(file type) (user) (group) (other)
The file type in this case is a 'd' which tells us that 'public_html' is a
directory so we know it holds other files. The next three are all the same sort
of blocks. Each block has three character positions. If a 'r' is found in the
block then the appropriate users have access to read the file. If a 'w' is found
then they can write to the file. If a 'x' is found then those users can execute
that file. When we run a program we say that we are executing that program. If
the users of a group don't have permision to do something with a file then we fill
in the blank space with a '-' character. This is so that the block still takes up
three characters. Also we always list the characters in the order 'r' then 'w'
then 'x'.
Back to the top.
The easy way to see the contents of a file is the
cat commmand. cat just
dumps the file to the screen. This is fine for small files but long
files just scroll right off the top of the screen. To see a files
contents just use the command cat my-files-name
.
Back to the top.
It seems that computer scientists never get tired of reading. But
this one is very important. Suppose they need to take down
the server that you keep you assignments during the weekend. And
suppose you need to finish your work for Monday morning. How can
you find out that the system will be down and that you need to get
your assignment off first? You don't want to keep bugging the admins
everyday so they need some way to tell everyone.
Back to the top.
When you hand in your assignments your TA's need to see that your
program really does work. To show them on paper you have to use a
command called script. Just type the
command script. After that type
whatever commands your TA asked for. When you are all done type the
command exit. Now in the current
directory you should find a file called 'typescript'. This file is
a copy of everything that was printed to your screen from when you
typed script to when you typed
exit. So now all you have to do is print
the typescript file and hand it in.
Back to the top.
Printing is a thing of it's own on UNIX systems. To print a file such
as a typescript file we use the command lpr
typescript. A message will print on the screen giving a
box number. Remember this number.
Then we wait about half an hour before we can
go get our printout. The file prints in the basement of Math Sciences.
Find the three elevators next to the lab doors and go down one
flight of stairs. The hallway in the basement has two ends. On one
end is the Microstore. Go the other way into the dispatch area. One
wall is full of little cubes. Find the cube that has the number
lpr printed to your screen. This is where
your printout should be.
Back to the top.
When you type a command in UNIX needs to know how to find the
right program to run. The right program is a file that has the command as it's
name. The UNIX file system can be really big so UNIX needs to know roughly where
to look for the command's program file. To keep track of where it should look we
have something called a 'PATH variable'. The path variable is just a list of the
directories that could contain the command. To see what your path is just type
the command: echo $PATH. You should see something
like this:
/usr/local/bin:/usr/bin:/usr/sbin:/bin:/usr/X11R6/bin:/usr/openwin/bin:/usr/games:.:/opt/kde/bin
This means to look in /usr/local/bin first. If the command is not found
then look in /usr/bin and so on through all of the directories which are
separated by a colon. If the command is not found in any of them UNIX gives up
but at least it tells you with the message command not found.
Back to the top.
To lock your workstation so that nobody steals your computer while you
go to the bathroom, use xlock.
Back to the top.
A process is any running program. A shell is a process, so is a webserver.
Almost every process has a Parent. All processes have a unique ID number.
This number is called the PID (process ID). The parrent process is refered
to by the PPID - the parent process ID. You can start a process by running
a program. You can end (kill) a process by terminating the process.
WHEN (not if) you have a process that will not end, you can use the
kill command to forcefully end a process.
Unless you NEED to, NEVER run kill -9.
Anyway, kill requires a PID as a parameter.
For example, if you know that a.out is process 34 you can kill it with:
kill 34. Use
ps -elf to get a listing of processes
and their PIDs.
Back to the top.
You only have so much space for code and programs. This includes your
Netscape cache. To see how much space you have left, run this command:
quota -v. It will tell you both how
much you have and how much you have used. To see which directories
are taking how much space, use this command:
du -k.
Back to the top.
grep is used for parsing regular
expressions. I've heard of grep
being used in conjunction with a word file to solve crossword files.
Allow me to illustrate an example. Let's say that we have a file with
one word on each line. This file contains MANY words from the
english language. If you needed a five letter word:
"(something)(something)ste" you could quickly search the wordfile
with the grep command
grep "^..ste$" wordfile
The carat indicates the start of the line must be matched.
The two dots can be any two characters. The dollar-sign indicates the end
of the line. Any line that matches this form will be returned.
To return all lines that contain "rle" you can simply run:
grep "rle" wordfile.
To return all lines that begin with "r" and end with "e" you can use this:
grep "^r.*e$" wordfile
Again, the carat matches the begining of the line, the "r" must follow.
The ".*" indicates zero to infinie other characters. The "e" must precede
the end of the line; "$".
Regular expressions show up in many places in programming. Odds are they
will be covered in CPSC313.
Back to the top.
One command: uname -a
Back to the top.
When in doubt, if things don't look right on the screen, change your
terminal type. This can be done in bash
with this command: set TERM=vt100.
Depending on the operating system (Linux or Solaris), you may also need
to run the command: export TERM to
apply the changes. It's a good idea to run
set on it's own to make sure that the
existing environment variable is called
TERM... it may also be called
term or
Term. Replace the appropriate name
in the instructions above.
vt100 is a good terminal mode and is very
well supported. Other terminal types include:
ansi,
vip7400 and my personal favorite
Linux.
Back to the top.
If you want a program to spew it's output to a file rather than to the
screen, there is a simple command:
program > outputfile
If you want your program to suck data from a file instead of typing it
in yourself, you need only remember this:
program < commandfile
A pipe (|) can be used to dump the output
of one program into another. For example, if we have alot of output
produced by our program, and are only concerned with lines that contain
the word dog, we could use this command:
program | grep dog.
Back to the top.
If you have a program running and you want to stop it,
<ctrl>-C will stop (break) it.
In most shells (especially BASH ), you can
use <ctrl>-A
Back to the top.
If you run the commandps -elf on a Sun (Solaris)
machine, it will give you a listing of every program or
job that's running. It will also tell you who ran it,
how long it's been running, and it's current state. You may also notice that some jobs
(or processes) are running even though the person who owns them is not logged onto the
computer. These jobs are being run in the background, and are likely outputting to
a file and not to the user's screen.
Let's say you want to do the same. You have a program that will churn away at the
machine for hours or days, and you don't want to have to wait around for it. Let's
also assume that you would normally run this program by typing in
./a.out. Do so. The program is now running in the
foreground. If you type in <ctrl>-c you will
stop and kill the process (termination). If you type in
<ctrl>-z the process will be suspended. It's
still there, it's just not doing anything. To resume the job (in the forground) you
can type in the commandfg %1. Now you're back to
where you started. Suspend the job again. This time, run the command
bg %1. This will run the job in the background.
Of course, the output will still be displayed on your screen, which can be annoying.
You learned in a previous section how to redirect that to a file. If you want to run
a job in the background, from the beginning, and redirect all output to a file, the
command you will use is this:
./a.out > outputfile &.
Back to the top.
There are two flavours of emacs:
emacs and xemacs.
Supprisingly enough, both are run from any unix prompt by typing in their name.
You do, of course, need to have them installed on the system, but that's for the
administrator to worry about, not you. To learn
emacs you need only run it, and read the
information that is displayed on the screen.
vi is one of the first editors. It has several
benefits over emacs that I won't get into here.
I have never used a unix system that did not have
vi installed by default. There are also some
occasions where emacs will not work properly.
In conclusion vi is always there and it always
works. Learning vi can take a couple hours.
If you're interested in doing so, get a copy of the
vilearn tutorial and work through the first file
at the very least. It is provided here:
1 - basics
2 - moving
3 - cutpaste
3 - temp
4 - inserting
5 - tricks
To use vilearn you change to the directory that
contains the vilearn files and run the command:
vi 1basics. Follow the instructions you see,
and soon you'll know vi.
I would also like to point out that this file was made using
vi.
Back to the top.
Ugh. Here's the basics; use a program called
ftp. There is a version of
ftp available for windows. It goes by the name
ftp and is available from by going through
Start -> Run... -> ftp.
Anyway, unix and windows ftp works the same way. Unix ftp came first, just
incase you were wondering. Anyway, in unix, you can start
ftp by typing in
ftp at the prompt.
There are only a few commands in
Let's do a little session. Note how similar this is to unix directory navigation.
open cse.cpsc.ucalgary.ca
(It should ask for a username and password.)
bin
(It should say something about changing to binary
mode.)
cd ~
(It should move you to your home directory.)
ls
(This should give you a list of files in your home directory.)
get somefilethatwaslisted
(This will transfer some file from the machine cse.cpsc.ucalgary.ca to your
local machine.)
put somefilethatisonyourmachine
(This will dump a file from your local machine to cse.cpsc.)
mput and mget
can be used the same as the non m version.
The m versions allow you to specify wildcards
as part of the filename (like *.c for all files ending in .c).
cd can be used to change directories on the
remote machine. lcd can be used to change
directories on the local machine.
Putting a bang (!) in front of a command will
run it on the local machine. This is useful for remembering the names of files
and finding out exactly where you are running
ftp from.
Back to the top.