CS50 - Section 1

Section Information

Getting Started in CS50

Most of the following items are all part of the assignment, but you should do them sooner rather than later.

Working With UNIX

The best way to learn the fundamentals of UNIX is to try things- get a copy of Learning the UNIX Operating System, log on to one of the HP UNIX machines (such as course1), and work through some of the examples and exercises.


Most of the first assignment is concerned with setting up your account to make it easier to do the rest of the assignments. Most of this may well seem like mumbo-jumbo at first, unless you are extremely experienced with UNIX. Don't worry; by the end of the semester, this will all seem obvious, but for the first week or two you should expect to be at least mildly confused. It will pass.

What Machines to Use

Use one of the following machines: course1, course2, or course3 for logging in remotely, or any of the HP scws workstations in the basement of the Science Center.

Although you need to do your coursework on one of these machines, you can do so from practically any machine you want. If you've got a Macintosh or PC in your dorm room, you can use these to connect via the network to the HPs.

Basic UNIX Commands

In order to do the first homework assignment, you will need to use several UNIX commands, including some or all of the following:

Most of these programs are standard UNIX utilities, and are described in the the Learning the UNIX Operating System text. If you are new to UNIX, I strongly recommend that you buy this text and work your way through it. The elm and pine mail programs, on the other hand, are not standard UNIX utilities, but are very common. These programs are documented in the online manual pages, and other texts.

A few of the programs that you'll use, such as cs50-submit, checkin, and checkout, were written specifically for this course. To learn about these programs, consult the online manual pages and the course handouts.

The good news is that once you are familiar with these commands, you will have learned most of the UNIX commands that you really need to know for this course. We're not going to make you learn a dozen new UNIX commands every week (instead, we'll soon move on to the real goal of this course- learning Computer Science). However, it is necessary to learn the basic skills of using these computers in order to progress on to bigger and better things.

Files and Directories

Several special names for particular directories provide a convenient shorthand when specifying directory names in UNIX:

~ (pronounced "twiddle" or "tilde")

twiddle is the name of your home directory.

For example, the command

	more ~/.cshrc

will display the contents of the file named .cshrc in your home directory (no matter what directory you happen to be in at the moment).

In general, a twiddle followed by a username represents the home directory of that user. For example, ~lib50 is another name for the home directory of the lib50 account (a place where you will be getting a lot of files from during the course of the semester).

. (pronounced "dot")

dot is the name of whatever directory you happen to be in at any given moment.

For example, the command

	cp ~lib50/assigns/asst1/* .

copies all the files in directory ~lib50/assigns/asst1 into the current director.

.. (pronounced "dot-dot")

dot-dot is the name of the parent directory of dot.

For example, the command

	cd ..

changes the current directory to be the parent of the current directory.

/ (pronounced "root")

root is the name of the top-level directory. All of the other files or directories in the system are descendants of root.

Your home directory (and everyone else's) is a distant descendant of root. You own the files and directories in your directory, but you don't own the parent directory of your home directory, or any other of its descendants.


For the first assignment, each of the algorithms you write should be no more than one page in length. Half of a page is probably sufficient.

Make sure that your algorithms are both clear and concise. You do not need to go into minute detail, but you do need to clearly state your assumptions and the steps that your algorithm takes in order to reach its goal.

Remember that in general, an algorithm must be:

  1. Precise.

    An algorithm must be stated clearly and unambiguously. With computer languages, this is not usually much of a problem (although it can be). In English, this can be quite hard, as we saw in the first lecture.

  2. Correct.

    The algorithm must always correctly compute whatever it is supposed to compute without error or failure. Programs that make your PC or mac crash are often examples of precise but incorrect algorithms.

  3. Finite.

    The computation must complete within a finite amount of time and only consume a finite amount of other resources (RAM, disk space, etc).

There are other important and interesting characteristics that algorithms have, such as efficiency (how much time or disk space they require, etc) and generality (how can one algorithm be used as part of another, or to solve a different problem). We'll talk about these later (much of CS is devoted to this discussion) but we will not talk about them yet!
Please bring any errors or inconsistencies in this document to the attention of the author.

Dan Ellard <ellard@deas.harvard.edu>