Getting Started


CS61C, Summer 2008

This guide is meant to help you use the computers in the lab.


The terminal and changing your password



To login, type your login (cs61c-xx) and password. Your password will be invisible even though you are typing it in.


When you first login, you'll be asked to enter some information. You should see the following:


Registration for course cs61c (if that's the wrong course,

please use Control-C and correct your settings first.)


Please enter an email address :


Fill in all the information they request. Make sure to give an email that you'll read. If you make a mistake entering any of this information, you can use re-register to try again.


Once that's finished, you should see a spot that looks like this:


nova [1] ~ >



That box is called the terminal, and what you see is the terminal prompt. You can type commands at the terminal prompt, and it will do what you say. The first thing you want to do is change your password. So, at the prompt, type ssh update and hit enter. You'll see something like this:


nova [1] ~ > ssh update

The authenticity of host 'update (128.32.42.154)' can't be established.

RSA key fingerprint is 32:f6:c1:00:72:5c:ea:47:6b:a8:c8:4c:f5:45:0d:1a.

Are you sure you want to continue connecting (yes/no)?


Just say yes and continue on.



Getting started with emacs


For doing your work, you might want to use emacs. Emacs is a text editor (somewhat like Notepad, only much more powerful). You can start emacs by typing it in at the prompt:


nova [2] ~ > emacs &


The & sign makes emacs run in the "background" so you can still use your terminal. Once you open up emacs, you can open up the tutorial.


Creating files


Creating files in emacs is easy. You can click on File -> Open file. This will bring up a small prompt near the bottom of the window. You can either open an existing file, or create a new one. For now, let's create a new one. Type in the name of the file you want to create (probably something like "hello.c"). Now emacs has created the file, and you're editing it. Don't forget to save your changes! Click on File -> Save (current buffer) whenever you want to save.


Navigating the filesystem


Your filesystem is organized into directories (folders) and files. The commands you'll be using most frequently are ls, mkdir, cd, cp, mv, rm, and rmdir. These commands are used from the terminal, NOT emacs. Let's take a quick look at each one. (Note that these are examples to give you an idea of how these commands work, and not necessarily what you should see when you type them!)


ls

Lists the contents of the current directory:


c50 [4] ~ > ls

hello.c


mkdir

Makes a new directory:


nova [5] ~ > mkdir lab01

nova [6] ~ > ls

lab01/ hello.c


cd

Moves from one directory to another; you can use cd .. to go up one level (".." always stands for 'one level up'):


nova [7] ~ > cd lab01

nova [8] ~/lab01 > ls

nova [9] ~/lab01 > cd ..

nova [10] ~ >


cp

Copies a file from one place to another:


nova [10] ~ > cp hello.c lab01/

nova [11] ~ > cp hello.c test.c

nova [12] ~ > ls

lab01/ hello.c test.c

nova [13] ~ > cd lab01

nova [14] ~/lab01 > ls

hello.c

nova [15] ~/lab01 > cd ..


mv

Moves (or renames) a file:


nova [16] ~ > mv hello.c lab01/

nova [17] ~ > cd lab01/

nova [18] ~/lab01 > ls

hello.c

nova [19] ~/lab01 > mv hello.c bye.c

nova [20] ~/lab01 > ls

bye.c

nova [21] ~/lab01 > cd ..


rm

Removes/deletes a file from the filesystem; be careful when using this command. Unlike Windows, there is no Recycle Bin, so once you delete something it's gone forever!


nova [22] ~ > ls

lab01/ hello.c test.c

nova [23] ~ > rm hello.c

rm: remove hello.c (yes/no)? yes

nova [24] ~ > ls

lab01/ test.c

nova [25] ~ > rm test.c

rm: remove test.c (yes/no)? yes

nova [26] ~ > ls

lab01/


Note that you can also use wildcards (so, we could have instead said rm pigl*), but be careful when using them!


rmdir

Removes an empty directory:


nova [27] ~ > mkdir test

nova [28] ~ > ls

lab01/ test/

nova [29] ~ > rmdir test

nova [30] ~ > ls

lab01/