UNIX and Linux

In this class we will interact with UNIX and Linux primarily through the command line. The command line, or shell, is very simple: it prompts you to type a command, then prints the output of the command (if any), then goes back to the prompt (like the shampoo).

At first, navigating the file system through the command line will be confusing. The two most important commands if you feel lost are ls and pwd. In UNIX there are no C: or A:, there is only one filesystem. The very top-level directory is /. Physical disks are mounted at certain locations in the filesystem tree. For our needs, we won't worry about this. We will work out of our home directories, aka ~ or $HOME. You will create subdirectories for your projects, e.g. ~/lab0/, then edit and compile your programs there.

Linux Quick Reference

Here are the most important UNIX commands. You should be able to do everything using these commands, but feel free to explore other commands. Most commands will print out a brief help screen with the -h or --help options. All commands have more in-depth man pages which you can read by typing man followed by the command name.

File/Directory Basics

File Viewing

Editors

File Properties

Archives

Compiler

Project

Now work through project 0.

C Tutorial

This is an excerpt of the major points of chapter 1 of "The C Programming Language" (K&R). The chapter and these notes are an overview, we won't go into all the details of these things here.

C programs consist of functions and variables.

Hello world:

#include <stdio.h>

main()
{
    printf("hello, world\n");
}

As in algebra, variables are placeholders for values. In C variables have a type, e.g. int or float. (In-class excercise, write the fahrenheit-celsius table program.)

Introduce if and while

Introduce stdin and stdout, getchar() and putchar()

Write the line counting program in class. Discuss printf("%d\n",nl)

Overview arrays and functions