Linux Programming/Introduction

From E&E Students
Jump to: navigation, search


| ...LAB NOTES... | ...GUIDES... | ...VIM DOCUMENTATION... | ...LINUX 101... |

Timetable and Venue

Where: The lecture will take place in the EOLAB (E451/2) on the 4th floor of the E&E building.

When: It is provisionally planned for Tuesday the 15th and Wednesday the 16th of February from 19h00 for approx 50 students per lecture.

What to bring with

  1. A clean unformatted stiffy.
  2. Your flashdisk with USB extension cable.
  3. Notepaper.

Lecture One

Starting Linux

Reboot the PC if it is running Windows 98. When the boot loader is presented, select "SUSE 9.2" with the arrow keys and press enter. The boot loader is called the Grand Unified Bootloader or GRUB for short. The PC will display the boot up splash screens, and then display the login screen.

Logging in

You need a username and password to log into any Linux machine. For the EELAB's a guest Linux user account has been created.

Log in with




Home folders

Each account on a Linux machine has a home folder. Normally "/home/username". Once you have logged in you will have full access to the home folder. To access the "command line" use a console/xterm. You will be shown how.

Basic file/folder management

Open a console/xterm and complete the following examples;

To create a folder type,

mkdir temp

and press enter.

To change to the "temp" folder type,

cd temp

and press enter.

To make a file type,

touch myfile.txt

and press enter.

To copy the "myfile.txt" file to another name type,

cp myfile.txt nextfile.txt

and press enter.

To see a listing of the files you have made type,

ls -l

and press enter.

To move "myfile.txt" to the root of your home folder type,

mv myfile.txt ~

and press enter.

To delete the file "nextfile.txt" type,

rm nextfile.txt

and press enter.

To return to your home folder type,


and press enter.

To quickly insert some content into “myfile.txt” type,

help >> myfile.txt

and press enter.

To see what's in “myfile.txt” type,

cat myfile.txt

and press enter.

Now save the file "myfile.txt" to your stiffy using the Linux file manager.

Summary of commands:

mkdir = make folder name
cd = change to directory/folder
cp = copy
ls = make a listing of files
mv = move files
rm = remove files
>> = appends text
cat = show contents of file


Linux is normally installed with the "man" pages.

These are text files that detail the workings of the common Linux commands.

For example, type:

man mkdir

and press enter.

Press "Q" or "q" to quit the man page. You can use the "Pg Up" and "Pg Dn" keys to navigate the man page.

To find a "man" page you use "apropos".

For example, type:

apropos gcc

and press enter.

A listing of all "man" pages related to the gcc compiler appear.

Links for more help.

  1. More help documentation can be found at:
  2. Visit the webpage:
  3. Join the Stellenbosch University Linux Users Group at:

Vi tutorial

In a console/xterm type,


and press enter.

Complete the Vi tutorial.

Compile examples

Go to:

In a console/xterm type,


and press enter.

Complete the examples.

Updated: 02/16/05

Desired Objectives

  1. Introduction to Linux. (The history, basic principle of an operating system and kernel, when Windows and when Linux)
  2. How to log on.
  3. How to work in your home directory and create new directories.
  4. How to copy, move and delete files (including to and from floppy and FlashStick).
  5. How to find help.
  6. How to edit a file with "vim".
  7. How to compile and run a simple program e.g. "Hello world".

Lecture Two

  1. Introduce the concept of cross platform programming.