Lab 1

Overview

In this lab we look at three different things:

Overview of the basic structure of a Linux system

One way to view the basic Linux system architecture is a set of concentric circles where the software embedded in each circle uses services from the inner circle and provides services to the outer circle.

At the center of the OS is the kernel which provides an abstraction of the actual computing hardware and manages basic OS resources such as processes and files systems. From a user's perspective it is perhaps interesting that the kernel appears to be a big runtime library and if you have enough system privileges you can make calls to that library and make changes to the runtime behavior of the OS.

Under Linux it is the shell (such as bash and csh) that you most often interact with. The shell provides a commandline interpreter allowing you to interact with the OS and do things such as navigating file systems, creating files, and starting applications.

To get started you should log into your UbuntuBox as the appropriate user and follow this tutorial:

Unix Introduction

PLEASE NOTE: the tutorial uses a Unix system called Solaris, we are using a Linux system called Ubuntu. At the kernel level the systems are virtually identical but Solaris uses a shell called tcsh where Ubuntu uses bash. Also, Solaris uses a proprietary GUI where Ubuntu uses a public domain GUI called GNOME/LDX by default. From the tutorial perspective this means that the only difference is how you start a terminal application -- in Ubuntu you click on the terminal icon on the desktop.

A brief tutorial of the most important shell commands

As we said above, the shell provides a command line interpreter allowing the user to interact with the OS. Here we look at the most important commands. Launch a terminal application and follow along these two tutorials including the exercises:

Tutorial 1

Tutorial 2

The last thing we need to talk about is editing files in order to be ready to do some programming under Linux. In order to edit a file simply launch the text editor application by clicking on the appropriate icon on your desktop and then start typing and save the file where you want it or use the file->open menu point to locate the file you want to edit.

The leafpad editor works just you would expect it to work.

Programming under Linux

Let's write our first program. Since C is the language that Linux is implemented in it might be fun to actually write a simple C program to start with. Start the text editor and type in the following text:
#include <stdio.h>

void main()
{
    printf("Hello World\n");
}
	
Go ahead and save the program, say, as the file 'hello.c'. At this point we are ready to compile and link the file:
$ gcc hello.c
	
This creates an executable with the default name 'a.out' (don't ask!). You can now run the executable with:
$ ./a.out
	
The prefix './' is necessary to tell the shell to start the executable from the current location. Of course it is possible to create an executable with a more sensical name:
$ gcc -o hello hello.c
	
Here the '-o' switch specifies the executable name 'hello'. We can now start this executable:
$ ./hello
	

Deliverables for this lab

As a deliverable for this lab upload a screen shot of your favorite Linux activity.