You are on page 1of 133

Linux Operating System

ULNXC-14

Linux Operating System


ULNXC-14
Compiled by: Daniel M Le Roux
Updated by: James Forsyth and Brendon Gouws
Quality assured by: JP Pretorius
Edited by: Ali Parry
Version 1.0
November 2013 CTI Education Group

TABLE OF CONTENTS
INTRODUCTION TO LINUX
Module overview
Module structure
Additional supplementary reading
Learning outcomes and assessment criteria
Icons used in this study guide
The history of Linux
Ubuntu Linux
What is Linux?
Using the Linux operating system
The three main parts of the Linux system
The Linux Graphical User Interface

1
1
2
2
3
3
4
6
6
7
8
9

UNIT 1 INSTALLING AND CONFIGURING UBUNTU


1.1 Installing Ubuntu
1.2 Configuring Ubuntu

12
15
21

UNIT 2 THE LINUX FILE SYSTEM


2.1 The three main parts of the Linux file system
2.2 File types
2.3 File names
2.4 Directory files
2.5 The directory structure
2.6 Searching for files

23
23
23
24
24
26
27

UNIT 3 THE LINUX TERMINAL


3.1 Terminal basics
3.2 The Linux prompt
3.3 System identification
3.4 Linux command syntax
3.5 Getting help

30
30
33
34
36
41

UNIT 4 WORKING WITH DIRECTORIES


4.1 Directory commands

44
44

UNIT 5 WORKING WITH FILES


5.1 Basic Linux file commands
5.2 Creating a simple text file
5.3 Viewing files
5.4 File security

49
49
50
52
60

UNIT 6 INPUT AND OUTPUT


6.1 Input and output files
6.2 Redirecting the standard
6.3 Redirecting the standard
6.4 Redirecting the standard
6.5 Redirecting the standard
6.6 Pipelines
6.7 Filters

70
70
71
72
73
73
73
75

output file
input file
input and standard output
error file

6.8 Sampling data in a pipeline

76

UNIT 7 LINUX PROCESSES


7.1 Process status
7.2 Running processes in the background
7.3 Terminating processes

79
79
80
81

UNIT 8 MOZILLA FIREFOX


8.1 The features of Mozilla Firefox
8.2 Configuring Mozilla Firefox

84
84
86

UNIT 9 MOZILLA THUNDERBIRD


9.1 Introduction to Mozilla Thunderbird email
9.2 The features of Thunderbird
9.3 Setting up an email account
9.4 Personalising Thunderbird and configuring account settings

99
99
99
100
105

UNIT 10 MORE APPLICATIONS


10.1 LibreOffice
10.2 GNU Image Manipulation Program (GIMP)
10.3 The Workspace switcher

107
107
113
114

ANSWERS

116

UNIT 11 THEORY AND PRACTICAL EXAMINATIONS


11.1 Theory examination
11.2 Practical examination

118
118
118

EXERCISE CHECKLIST

119

GLOSSARY

120

LINUX OPERATING SYSTEM EVALUATION FORM

128

Introduction to Linux
Welcome to CTIs module on using the Ubuntu Linux operating system.
The module will introduce you to open source software and the increasingly
important role it plays within the IT world. You should already be well
acquainted with the Windows operating system, which means that many of the
concepts and techniques presented in the module will seem familiar. Please
read all the material in this study guide very carefully. On the surface Linux
may seem to be very much like Windows, but as you work through the study
guide you will discover that they differ in many ways.

Module overview
This module is aimed at teaching the basic principles of using the Linux
operating system to run applications and manage files. It is therefore
recommended that you spend as much time as possible working on the Linux
system to gain a thorough understanding of the operating system.
Unlike other operating systems, Linux offers a wide variety of systems
designed for specific uses by incorporating highly specialised applications.
There is no single, definitive Linux operating system. In fact, there are over
200 kinds of Linux, known as Linux distributions, each offering different
varieties of desktop environments and applets. Some of the more well-known
Linux desktop distributions include Mint, Ubuntu, Fedora, Mageia and Debian.
It is interesting to note that Android, the mobile OS, is technically the most
widespread Linux distribution as it uses, and was built from, the Linux kernel.
NOTE

This module and all examination questions are based on the Ubuntu
distribution of Linux, version 12.04.

The module begins with a brief history of Linux and the background of the
Ubuntu distribution to help you understand the nature and spirit of the
operating system, and then introduces you to using Linux through a Graphical
User Interface. Although the interface resembles the Windows desktop in many
ways, a look behind the scenes at the underlying Linux file system will uncover
some of the main differences between them as an introduction to the Linux
command line interface. This is where the true nature and power of Linux is
revealed.

Linux Operating System | V1.0 Nov 2013

Page 1 of 133

If you are interested in reading more about current developments in Linux, you
are encouraged to visit the following websites:

www.linux.com
www.ubuntu.com
www.linuxnewbie.com
www.go-opensource.org

Module structure
Table 0.1 Suggested work schedule
Introduction, Units 1 and 2
Units 3 6
Units 7 10
Theory examination
Practical examination

1
1
1
1
1

day
day
day
day
day

Additional supplementary reading


The following two textbooks are for additional reading purposes only. They
may be borrowed from the campus library to further your understanding of
topics in this module:

Helmke, M. and Graner, A. 2012. The Official Ubuntu Book,


7th edition. Prentice Hall Pearson Education. ISBN13:
9780133017601
Helmke, M. 2012. Ubuntu Unleashed, 2012 edition. Pearson
Education, Inc. ISBN13: 9780672335785

Linux Operating System | V1.0 Nov 2013

Page 2 of 133

Learning outcomes and assessment criteria


Assessment for pass:
A pass is awarded for the unit on the achievement of all the pass assessment
criteria.
Learning outcomes

Assessment criteria for pass

To achieve each outcome a student


must demonstrate the ability to:
LO1
P1.1 Use an application in GNOME
Use the Linux operating systems P1.2 Use the GNOME help browser
desktop
P1.3 Modify preferences in GNOME
P1.4 Use the GNOME desktop
LO2
P2.1 Use the Nautilus File Manager
Work with files and folders, and P2.2 Illustrate the use of different file
use the Linux operating systems
types
terminal and commands
P2.3 Use a Linux terminal
P2.4 Use Linux commands
P3.1 Manipulate a document using the vi
LO3
text editor
Use
a
Linux
text
editor,
P3.2 Use
different
applications
and
applications, applets and utilities
utilities within Linux
P3.3 Use an applet within Linux

Icons used in this study guide


Some conventions have been used to make this guide easier to follow. When
keys on the keyboard are referred to, they are in angle brackets and bolded,
e.g. <Del> refers to the Delete key on the keyboard.
When two or three keys are pressed simultaneously, they are placed next to
each other and bolded, e.g. <Ctrl><Alt>; this means press the Ctrl and Alt
keys at the same time.
Where a menu item is referenced, the item has been printed in bold.
In the section on the command line interpreter, a different font is used for
commands and any text that you must type.

Linux Operating System | V1.0 Nov 2013

Page 3 of 133

Indicates start of each main unit in the study guide.

This symbol is found at the beginning of each unit. It states the


outcomes for each unit.

This symbol is found wherever there are labs to be completed


by the students on the computer.

This symbol is found at the end of certain units, and provides


you with a few practice questions to test your knowledge of the
preceding units.

The history of Linux


The Linux story began with Unix, an operating system written by Ken
Thompson, Brian Kernighan and Denis Richie at Bell Laboratories in the late
1960s.
Unix was written to replace the Multics operating system on
minicomputers and mainframe computers. Unix was originally written in
Assembly language, which meant that although it was fast and could interact
directly with computer hardware, it could not be used on computers with
different hardware without changing the Assembly code. Consequently, Unix
was rewritten in C in the early 1970s.
Rewriting Unix in C made it more portable from one computer system to
another. However, Unix was still not very user-friendly because it was written
by engineers and programmers for engineers and programmers, and was not
suitable for use on the new generation of desktop computers.
After Thompson introduced Unix to the University of California at Berkeley in
the mid-1970s, staff and students continued to develop Unix enhancements,
many of which were included in later versions of the system. Unix continues to
evolve through the contributions made by the universities, research
organisations and commercial groups that still use the operating system.

Linux Operating System | V1.0 Nov 2013

Page 4 of 133

The first step towards Linux from Unix was taken in the 1980s when Andrew
Tanenbaum, a computer science professor in the Netherlands, wrote an
educational version of Unix called Minix. The purpose of Minix was for students
to learn Unix on home-based Intel PCs.
In August 1991, Linus Torvalds, then a student at the University of Helsinki in
Finland, posted the following message to the Minix newsgroup:
Hello everybody out there using minix
Im doing a (free) operating system
(just a hobby, wont be big and professional
like gnu) for 386 (486) AT clones.
The result of this hobby was Linux, a Unix-like operating system for personal
computers! By creating Linux, Torvalds was able to provide the core of a Unixlike operating system, without all the restrictions associated with Unix itself.
Linux is more user-friendly, runs on PCs, and is relatively inexpensive. The
first real version of Linux became available in 1994 using less than 2 MB of
RAM at amazing speeds.
Linux explored the task switching capabilities of the Intel 80386 chip, and
although it is still mostly used on Intel-based PCs, it now runs on a wide
variety of hardware, including the full x86 family of processors, such as AMDbased PCs.
While Torvalds is responsible for the core of the Linux operating system,
known as the kernel, many other programmers have added utilities and
applications to the basic kernel and created what are known as Linux
distributions. As mentioned earlier, there are over 200 Linux distributions, but
the distributions you are most likely to encounter (on desktop and server
computers, at least) are Mint, Fedora, Mageia, Ubuntu, Debian, Slackware and
openSUSE. Much of the work that has gone into Linux distributions comes
from the GNU project of the Free Software Foundation.
GNU is a self-referential acronym that stands for GNUs Not Unix. To find out
more about the GNU project and the General Public Licence, visit www.gnu.org.
One of the most important decisions made in the early days of Linux was to
make the source code freely available and distributable, and to make it subject
to the GNU General Public Licence. This licence guarantees your freedom to
share and change the software, which means that anyone:

May distribute copies of the software and charge a fee for distributing it,
should have access to the source code, and may change the software or use
pieces of it in new free programs.
Should know they may do these things.

Linux Operating System | V1.0 Nov 2013

Page 5 of 133

Ubuntu Linux
The Ubuntu story began in 2004 when Mark Shuttleworth got a group of open
source developers together to create a new Linux-based desktop operating
system. The result of this was Ubuntu, an operating system based on a strong
Debian foundation and the GNOME desktop environment. The Ubuntu project
is sponsored by Canonical Ltd, a company owned by Mark Shuttleworth.
October 2004 saw the first release of Ubuntu version 4.10, also known as
Warty Warthog.
All Ubuntu releases thereafter used the same naming
notation, and all carry a similar alliterative name, e.g. Breezy Badger, Edgy Eft
and Feisty Fawn. Ubuntu 12.04 is known as Precise Pangolin.
The name Ubuntu comes from an ancient African phrase Umuntu ngumuntu
ngabantu, which roughly translates into a person is a person through
people.
A traveller through our country would stop at a village, and he didnt have to
ask for food or for water. Once he stops, the people give him food and
entertain him. That is one aspect of Ubuntu but Ubuntu has various aspects.
Ubuntu does not mean that people should not enrich themselves.
The
question therefore is:
Are you going to do so in order to enable the
community around you to improve? Nelson Mandela.
The Ubuntu Linux distribution is aimed at bringing the philosophy of Ubuntu to
the software world. There are also other variations of Ubuntu available, e.g.
gobuntu, edubuntu, xubuntu and kubuntu. There is also the Freedom Toaster
project, which is aimed at making it easier to access open source software by
giving the public the opportunity to freely burn open source software onto
discs. For more information, visit the website at www.freedomtoaster.org.

What is Linux?
Linux is a multi-user, multitasking operating system.
Linux is firstly an operating system. An operating system is the software
that controls the computers use of its hardware resources, and acts as a
liaison between the computer hardware and the application software. Its
responsibilities include:

Managing the resources


Controlling input and output
Managing storage space
Detecting equipment failure
Maintaining system security

Linux Operating System | V1.0 Nov 2013

Page 6 of 133

Linux is a multitasking operating system. This means that Linux manages its
resources in such a way that it can handle several different programs at the
same time. Being able to perform several tasks at the same time leads to the
more productive use of a single machines resources. Linux uses pre-emptive
multitasking in that the operating system (rather than the application) controls
tasks and the allotment of clock cycles to applications.
Linux is also a multi-user operating system. More than one user can access
the system at the same time, and the operating system ensures that all the
users logged onto the system share the resources of the computer. This also
means that these users can share expensive equipment such as printers.
Other features of Linux include:

Linux is an interactive operating system, meaning commands instructing


the system to do certain tasks can be entered and the system responds
with appropriate output.
Linux has a demand-paged virtual memory system that means it can run
programs requiring more memory than the systems installed RAM has
available.
Security is built into the operating system.
It uses full 32- or 64-bit memory access.
Linux can coexist peacefully with other operating systems (such as
Windows) in different partitions on the same hard disk.
Linux has one of the most wide-ranging hardware compatibility lists for any
operating system. When someone needs a driver for a new piece of
hardware (for which there are no drivers available), they can just write a
driver and make it freely available.
Linux is a Unix clone written completely from scratch retaining much of
Unixs functionality, with some added extras.

Using the Linux operating system


Linux can be used in a variety of environments, from the small home user to
large companies:

Personal workstation Linux can be set up to run as a standalone


workstation in the home, or be part of a network where it can act as a client
workstation. Linux can also share files with other operating systems, such
as Microsoft Windows 7 and Microsoft Windows Server 2008.
Server Linux can act as a file and print server because of its powerful
multitasking abilities, virtual memory and file system. It also provides the
security tools necessary to control access to a server. It is often used by
Internet Service Providers to provide Internet access services to their
clients.

Linux Operating System | V1.0 Nov 2013

Page 7 of 133

The three main parts of the Linux system


The Linux operating system is made up of three main parts or levels: kernel,
shell and utilities (see Figure 0.1).

Tools
Utilities
Shell
Kernel

Figure 0.1 The three main levels of the Linux operating system

Kernel the kernel is the heart of the operating system and communicates
directly with the system hardware. The kernel:
o Controls hardware resources such as memory, terminals and printers.
o Schedules and executes programs.
o Manages the file system.
o Controls input and output.
o Tracks who is logged on to the system.

Shell the shell provides an easy connection, or interface, between the


user and the kernel. There are two kinds of shells: graphical user interface
shells and command line shells.
o Graphical user interface shells enable users to select icons from a
virtual desktop (using a mouse or other pointing device) to carry out
required tasks. The X Windows System provides this capability in Linux
systems.

Linux Operating System | V1.0 Nov 2013

Page 8 of 133

Command line shells (also called command line interfaces) are used
to issue commands to the shell, and are used by more experienced
users as they provide full access to the system. In this module, you will
access the command line from the desktop.
There are several
command line shells available (the command to run the shell is given in
brackets):
Bourne shell (sh): Named after its creator, Stephen Bourne, it is
one of the earlier shells that provide little help to the user (such as
editing commands typed at the command line).
C shell (csh): Written at Berkeley, it is so called because it derived
its command set from the syntax of the C programming language.
Again, there is little of the user-friendliness of the newer shells.
Enhanced C shell (tcsh): This is the C shell with some additional
user-friendliness.
Bourne-again shell (bash): This is the most popular Linux shell
because of its features and user-friendliness. It is a widely available
Linux shell developed from the Unix Bourne and C shells, with some
added features, by the GNU project.

Utilities and applications form the third layer. They are executable programs
written to do particular jobs well. The advantage of this approach is its
flexibility in that you can add whatever programs you require to customise
your environment.

The Linux Graphical User Interface


X Windows provides a Graphical User Interface (GUI) for Linux that is
completely configurable, with a broad range of flexible options. Linux is
distinct from a GUI like Microsoft Windows in that the Linux GUI separates the
interface from the windows, and thus it requires two components: the X Server
and a window manager. The X Server controls the display and is responsible
for all input and output. In Linux systems, X Windows is just one piece of the
operating system the windowing environment.
The X Server sets up the graphics display (i.e. resolution, refresh rate, colour
depth, and so on).
It also displays the windows, and tracks mouse
movements, keystrokes and multiple windows. It does not, however, provide
menus, window borders, or the capability to minimise or maximise windows.
These are provided by the window manager. Typically, the Linux kernel
communicates between X Server and the computers hardware. The most
common X Server that is used is XFree86 because it is free and its full source
code is available. There are also commercial X Servers on the market of which
the main ones are Metro-X and Accelerated-X.
A window manager provides all the extra features that make an X Windows
environment a true Graphical User Interface, including colour backgrounds,
and sophisticated window borders and menus. This is the component that
controls the appearance of the windows.
Linux Operating System | V1.0 Nov 2013

Page 9 of 133

These managers are themselves highly customisable, allowing you to choose


the look and feel of the X Windows system. It is here that the flexibility of X
Windows is best seen. Since the windowing layer is separated from the user
interface layer, it allows the creation of many different window managers that
are complete redesigns of the user interface (rather than just the subtle
differences in appearance that Microsoft Windows provides). The main window
managers around today include FVWM (the meaning of the F has been lost, but
VWM stands for Virtual Window Manager), Afterstep, IceWM and
Enlightenment.
Although there are many different X Servers and window managers, they
communicate with one another in a predefined manner. This ensures that a
wide range of applications can talk to one another, and allows you to use the
interface that suits you. A further strength of the X Windows system is that it
is based on a client-server framework. This means that applications that are
running can be thought of as clients to the X Server. Thus, an application can
run on one machine on a network, while displaying its output on another
machine making X Windows very well suited to a networked environment.
Desktop environments take window managers a step further.
Simple
window managers cannot ensure a consistent look and feel across applications,
nor can they handle cross-application data embedding. Desktop managers
provide a complete, integrated X Windows system. Two main desktops that
are freely available and widely used are the GNOME (GNU Network Object
Model Environment) and the KDE (K Desktop Environment). As mentioned
earlier, Ubuntu Linux uses the GNOME desktop. GNOME is also the default
desktop environment for the Debian and Fedora Linux distributions.

Linux Operating System | V1.0 Nov 2013

Page 10 of 133

1. True or False: Linux is a Unix-based operating system


suitable for personal computers.
2. True or False: Linux is a multi-user operating system.
3. True or False: The Linux kernel communicates directly
with the system hardware.
4. In Linux, ____________ ensure a consistent look and
feel across applications and handle cross-application data
embedding.
A. desktop managers
B. window managers
C. X Servers
D. graphical shells
5. Ubuntu is one of the many Linux _____________.
A. X Servers
B. window managers
C. distributions
D. X Cores
6. Linux is made up of the _____________, shell and
utilities.
A. core
B. kernel
C. X Windows
D. File Manager
7. Typically, the _____________ communicates between
Linux and the computers hardware.
A. X Server
B. Afterstep
C. X Window
D. FVWM

Linux Operating System | V1.0 Nov 2013

Page 11 of 133

Unit 1 Installing and Configuring Ubuntu


At the end of this unit you will be able to:

Install Ubuntu Linux from the Live CD.


Set the screen resolution.
Adjust the date and time.
Change the appearance of the operating system.

At the beginning of the module, you should have received an Ubuntu disc.
This is a bootable Live CD. What this means is that you can boot from this CD
without having to format your hard drive. There are two different boot options
available when booting from an Ubuntu 12.04 Live CD:
Boot Option 1
When booting from the CD, the first screen to be displayed is a blank screen
with an icon towards the bottom middle of the screen (Figure 1.1). On this
screen, you can press any key to be presented with a language selection.
Select English, and from the next menu you have the option of trying Ubuntu
without installing, installing Ubuntu, checking the CD for defects, testing the
computers memory, and booting from the computers first hard disk. Select
Try Ubuntu without installing, which will present you with the Live CD
desktop as shown in Figure 1.3.

Figure 1.1 Press any key


Linux Operating System | V1.0 Nov 2013

Page 12 of 133

Boot Option 2
When booting from the CD, do not press any key when presented with the
screen in Figure 1.1. Instead wait a few seconds for the boot process to
continue. Once it does, you will be presented with the Welcome screen shown
in Figure 1.2. From here, click on Try Ubuntu to proceed to the Live CD
desktop as shown in Figure 1.3.

Figure 1.2 Welcome

Linux Operating System | V1.0 Nov 2013

Page 13 of 133

Once you have booted into the Live CD desktop, you can browse the Ubuntu
desktop and familiarise yourself with the environment. Afterwards, if you
choose to, you can install the operating system by double-clicking on the
Install icon on the desktop. After answering a few simple questions, and
following a few easy instructions, the Ubuntu Operating System will be
installed on your PC. If you choose not to, you can just remove the CD from
the drive and restart your PC, after which you will boot into your normal
installation.

Figure 1.3 Ubuntu Linux 12.04 Live CD desktop

Linux Operating System | V1.0 Nov 2013

Page 14 of 133

1.1 Installing Ubuntu


The first thing you need to do is to configure your CD/DVD
drive as your first boot device. This can be set up in the
systems BIOS. If you are unsure how to do this, ask your
lecturer for assistance.

During startup, the computer will indicate that it is booting from the optical
drive, and you can make use of the methods covered in either Boot Option
1 or Boot Option 2 above to initiate the installation of Ubuntu.

Having followed either of the above boot options and proceeded to Ubuntus
Live CD desktop, and if you have finished exploring Ubuntus interface and
menus, double-click on the Install Ubuntu 12.04.2 LTS icon on the Live
CD desktop to initiate the Ubuntu 12.04 installation (Figure 1.4).
Alternatively, the following options for initiating Ubuntu 12.04s installation
without first booting into the Live CD desktop are also available:
o If you follow Boot Option 1, after pressing any key and making a
language selection you can select the option to Install Ubuntu to
proceed directly to Ubuntus installation process.
o If you follow Boot Option 2, after waiting for the boot process to
proceed and being presented with Ubuntus initial Welcome screen
(Figure 1.2 above), select the option to Install Ubuntu.

Figure 1.4 Welcome screen


Linux Operating System | V1.0 Nov 2013

Page 15 of 133

The Installer will start up, and you will be presented with the Welcome
screen, as shown in Figure 1.4 above. Here you need to select the
language that will be used for the installation process. Select English and
click Continue.

This guide assumes that the computer you are installing Ubuntu on is not
connected to the Internet. Therefore, on the Preparing to install Ubuntu
screen (Figure 1.5), you can ignore the Internet connection
recommendation and do not check the Download updates or Install
this third-party software and simply click Continue.

Figure 1.5 Preparing to install Ubuntu

Linux Operating System | V1.0 Nov 2013

Page 16 of 133

It is also assumed that you are installing Ubuntu on a computer that does
not have any other operating systems installed, so on the Installation
type screen (Figure 1.6) select Erase disk and install Ubuntu and click
Continue.
Should you be installing Ubuntu on a computer that already has another
operating system installed on it, select the option to erase and replace the
existing operating system with Ubuntu.

Figure 1.6 Installation type

On the Erase disk and install Ubuntu screen, select the drive the Ubuntu
should be installed to (if there is only one hard drive in your computer, it
will be selected by default) and click Install Now.

Linux Operating System | V1.0 Nov 2013

Page 17 of 133

While Ubuntu copies its files and installs to your hard drive, the Where are
you? screen (Figure 1.7) will be displayed, asking you to select your city.
Enter Johannesburg (or your city name) or click on the region on the map
around where your closest major city is. This will automatically select the
correct time zone for that region, but you may have to manually set the
correct date and time when you log in for the first time. Once you have
selected your region, and the installer has finished copying files, click
Continue.

Figure 1.7 Where are you?

Linux Operating System | V1.0 Nov 2013

Page 18 of 133

On the Keyboard layout screen (Figure 1.8), you are asked to select the
correct keyboard layout. After you have selected the correct layout, you
can type in the provided box to test whether or not you have selected the
correct layout. U.S. English is the standard layout. After you have selected
the correct keyboard layout, click Continue.

Figure 1.8 Keyboard layout screen

The Who are you? screen (Figure 1.9) will now appear, where you are
asked to fill in your name, a computer name, a username (your logon
name) and a password. Fill in your own details. Be sure that you choose a
password that is easy to remember because you will be prompted to enter
this password in order to perform administrative tasks. Enter your details
and click Continue.

Linux Operating System | V1.0 Nov 2013

Page 19 of 133

Figure 1.9 Who are you?

Ubuntu will now proceed with its installation, displaying hints, tips and
assorted information while it is busy. You can also continue browsing and
exploring the Linux desktop and menus during the installation process.
Once the installation has completed, you will be prompted to restart the
computer. If you have finished exploring the system, click Restart Now.

After selecting to restart the computer, you will be prompted to remove the
installation media and press <Enter> to continue, after which the computer
will finish restarting and boot into the Linux operating system.

Once the computer has finished booting into the Linux operating system,
you will be prompted to enter the password for the user that you specified
during installation.

On your first login, an Update notification message may appear


prompting you to update the language files of the computer. For the
purposes of this guide, these updates are unnecessary and you can simply
click Close.

Linux Operating System | V1.0 Nov 2013

Page 20 of 133

1.2 Configuring Ubuntu


1.2.1

Setting the screen resolution

To set the correct screen resolution, open the System menu by clicking on the
cog icon on the far right of the top menu bar
(note the options to log out
and shut the computer down), and select Displays (Figure 1.10). Click on the
Resolution drop-down box, and select the appropriate resolution for your
display.

Figure 1.10 Screen resolution preferences


NOTE

1.2.2

The recommended resolutions for most 18.5 and 19 LCD/LED


monitors are 1366 x 768 & 1440 x 900 respectively.

Adjusting the date and time

Click on the time displayed on the top menu bar and select Time & Date
Settings to open the Time & Date screen. The Location box should display
Johannesburg, and beside the Set the time section you can select the
Manually radio button in order to set the correct time and date yourself.
Linux Operating System | V1.0 Nov 2013

Page 21 of 133

Further options regarding the display of the time and date on the menu bar
can be configured on the Clock tab. Changes are saved automatically, so once
you have set the time and options, simply close the Time & Date screen by
clicking on the orange X icon at the top left of the screen.

1.2.3

Changing the appearance of the operating system

In the Appearance page (Figure 1.11), you can change the Linux theme,
desktop background, interface and visual effects. You can access this page in
one of the following ways:

By right-clicking on the Linux desktop and selecting Change Desktop


Background.
By opening the System menu, clicking on System Settings, and selecting
Appearance.

Figure 1.11 Appearance

Linux Operating System | V1.0 Nov 2013

Page 22 of 133

Unit 2 The Linux File System


At the end of this unit you will be able to:

Describe the three main parts of the Linux file system.


Describe the common Linux file types.
Understand the directory tree structure.
Search for a file.

2.1 The three main parts of the Linux file system


The Linux file system consists of three main parts:

Superblock
Inode area
Data blocks

Superblock is used to control the whole file system. It contains static


(unchanging) information on file system size, inode area size and logical data
block sizes. It also contains a partial list of free inode numbers and the first
free data block of a chain of free blocks.
Inode area is a set of blocks next to each other that contains a table listing all
the inode numbers for the file system. These numbers are used to track file
information within the file system. The main information kept for each file
includes its file type, file permissions, number of links, owner and group, time
stamps (date and time of last file change and access), file size and file location
on disk. The inode (short for index node) is the only control structure that
knows where to find a files data on the disk.
Data blocks are where the actual file data is stored. Each block will contain
data of only one file, although a file may reside in many blocks across the file
system. Thus, the smallest disk space that can be allocated to a file is one
block.

2.2 File types


Table 2.1 lists the most common Linux file types.

Linux Operating System | V1.0 Nov 2013

Page 23 of 133

Table 2.1 Linux file types


Text files
Directory files

Normally contain configuration information.


Files that serve as storage space to organise other
files.
Special device files
Important files for systems administrators as they
represent various system devices, e.g. hard drives
and serial ports.
Binary data files
Program files are normally associated with several
binary data files, which store information such as
functions and graphics.
Linked files
Files that are associated with one another, i.e. they
point to another file (shortcut file), or they can
represent the same data.
Executable program These exist on the hard drive until they are executed
files
in memory to become processes.
Named pipes
Identify the channel that passes information from one
process in memory to another.
Socket files
A type of named pipe file that allows a process on
another computer to write to a file on the local
computer while another process reads from that file.

2.3 File names


Files are recognised by their filenames, which can include up to 255
characters.
Linux filenames usually consist of alphanumeric characters,
underscores ( _ ), dashes or hyphens ( - ), and full stop characters ( . ).
Besides a forward slash ( / ) and the null character, Linux technically has no
restrictions on what characters may be used in a filename. However, it is
advisable to not use any shell metacharacters that are used in the command
line prompt in a Linux terminal ( $, # ) or to start a filename with a hyphen.
Spaces in filenames are also typically discouraged.
Files that begin with a dot ( . ) are called hidden files, which require a special
command to be seen (this command will be shown in Unit 4). The Linux
terminal will be discussed in the next unit.

2.4 Directory files


The Linux file system has a completely different structure from that of the
Windows file system. This unit will explain these differences to you, and
explain the structure of the Linux file system.
Linux Operating System | V1.0 Nov 2013

Page 24 of 133

The main difference is that everything in the Linux file system is considered a
file, i.e. devices, drives and removable media.
The base of the file system is known as the root folder or / (the equivalent
of C:\ in Windows). The /home folder stores each users files, i.e. settings,
pictures, music, etc. (the equivalent of Documents and Settings\User in
Windows).
A directory is a special file that contains a list of the files, paired with those
files inode numbers, stored in that directory. Every file in the Linux system
must be in one or other directory. Directories have names like files, and these
names follow the same conventions and rules used for file names. Every
directory name must also be in a directory this sets up the tree structure of
the directory hierarchy. A directory that is found in another directory is called
a subdirectory.
Table 2.2 shows the various Linux files.
Table 2.2 Linux files
/
/
/
/
/
/

bin
boot
dev
etc
home
lib

/ lost + found
/ media
/
/
/
/
/
/
/
/
/

mnt
opt
proc
root
sbin
sys
tmp
usr
var

Binary applications (the majority of executable files)


Files required to boot, e.g. the kernel
Devices, e.g. drives and displays
Almost every configuration file for the system
User files and folders that are stored locally
System libraries (equivalent of Program Files in Windows).
In a 64-bit installation of Linux, a /lib64 directory will also
be present.
The lost and found for lost files
Mounted devices, e.g. CD-ROMs, digital cameras and flash
disks
Mounted file system
The location for optionally installed programs
A dynamic directory that holds the information for processes
The root users home folder
System-only binaries
Holds system information
Temporary files
Applications for regular users
Holds logs, databases, etc.

Linux Operating System | V1.0 Nov 2013

Page 25 of 133

2.5 The directory structure

/ ROOT

BIN

BOOT ETC

USR

SYSCONFIG

VAR

TMP

SBIN

TMP

DEV

HOME LIB

USERS

MNT

OPT ROOT

CD ROM

Figure 2.1 Tree structure


Figure 2.1 depicts the Linux directory structure. The root directory (also
called the root) contains a list of ordinary and directory files. The root is the
main directory under which all other directories are found. Figure 2.1 shows
some of Linuxs standard subdirectories.
Each of these standard subdirectories is created for a specific purpose. For
example, the bin subdirectory contains the executable files of most
applications, the tmp subdirectory is used to store temporary files, and the
home subdirectory file is a list of user directories. Figure 2.1 also shows the
usr subdirectory, which is a directory that contains all users program and
application files, as well as the accompanying documentation for those
programs. In this way, Linux and its users keep control of their files in a
hierarchical tree structure.
You will also notice in Figure 2.1 that one of Linuxs standard subdirectories is
called root. This root subdirectory is actually the home directory of a special
user called root. When an administrator logs in to make system changes that
only an administrator is allowed to make, the administrator will log in with the
user name root. The root user, also known as the superuser, is given all
system privileges and that is why the root user account is used by the
administrator to maintain the system.
Whenever you encounter the term root in Linux, make sure you understand
whether it refers to the root directory, the root subdirectory or the root user.
When considering Linux files, you should keep three factors in mind:

The file is stored physically on disk in data blocks.


Each file is described by an inode number that contains all the information
about a file except its name. Every file has only one inode number
associated with it. The root directory has the inode number 1, and all
others are incremental from that point.

Linux Operating System | V1.0 Nov 2013

Page 26 of 133

Each file name is contained in a directory that contains the file name and
inode number.

Every files pathname identifies the files location within the directory
hierarchy. A pathname is really a list of one or more file names (directories)
that point to the file.

Every file has one absolute pathname that identifies that file uniquely. This
absolute pathname begins with the root directory, and follows the unique
path through the subdirectories that point to a particular file. For example,
a file located in the SQL_demo directory called my file would have the
absolute pathname:
/home/user_1/SQL_demo/my_file

A shorter relative pathname (or partial pathname) can be used that begins
with the current directory, and describes the path to the required file from
there. If you were in the user_1 directory, the relative pathname for my
file would be:
SQL_demo/my_file

The easiest way to distinguish between absolute and relative pathnames is


that absolute pathnames always begin with the root directory.
Notice that directories are separated in the pathname by forward slashes
</>, not backward slashes <\> as in Windows.
The current directory is represented by a single dot.
The parent directory (the directory immediately above the current directory
in the hierarchy) is represented by two dots.

NOTE

Your home directory will be /home/your username. When you


log on to the system, this is the directory that you will be in.

2.6 Searching for files


The GNOME desktop provides the Search for Files tool for finding files and
folders in the Linux file system. The Search for Files tool enables the user to
search for files at or below a certain level in the file hierarchy. The starting
point for the search is specified in the Look in folder: field (Figure 2.2). Only
files in or below the specified folder will be searched. To search all files and
folders on the Linux system, the root directory must be specified as the
starting point for the search. If the file being sought is known to be in a
particular folder, then that folder may be specified as the starting point for the
search to limit the number of search results.

Linux Operating System | V1.0 Nov 2013

Page 27 of 133

Figure 2.2 Search for files

Open the File Manager by clicking on the Home icon on the


sidebar.
Click on the Search button on the top right of the File
Manager window to reveal the search bar.
Search for a file called resolv.conf and note the folder that
contains this file (you may need to modify the location that
is being searched).

Linux Operating System | V1.0 Nov 2013

Page 28 of 133

1. True or False: Linux directory names follow the same


conventions and rules used for file names.
2. True or False: A pathname is really a list of one or more
file names (directories) that point to the file.
3. True or False: Directory files contain only the inode
numbers of the files within them.
4. Which one of the following is not contained in the
superblock of the Linux file system?
A. Listing of inode numbers.
B. Inode area size.
C. File system size.
D. First free data block.
5. In the Linux file system, data is stored and organised
by being placed in _____________ that are kept on a
storage device such as a hard disk.
A. program files
B. executable files
C. directory files
D. ordinary files
6. Which one of the following is not a valid file name in
Linux?
A.
B.
C.
D.

.val_1-99
file_12.mem
today file 12/06/03
a.valid.name

7. If the current directory is the home directory, and a


user wants to refer to the password file in the etc
directory, which one of the following would be the correct
absolute pathname to use?
A.
B.
C.
D.

etc/passwd
././etc/passwd
/etc/passwd
../../etc/passwd

Linux Operating System | V1.0 Nov 2013

Page 29 of 133

Unit 3 The Linux Terminal


At the end of this unit you will be able to:
Open a Linux terminal window.
Configure keyboard shortcuts.
Configure user preferences.

The Graphical User Interface (GUI) is only one way of interacting with the
Linux operating system. A more direct and powerful way of communicating
with the Linux system is by using a command line interpreter. You can access
a Linux command line interpreter from the Linux desktop by opening a Linux
terminal window.

3.1 Terminal basics

3.1.1

Opening a Linux terminal window.


Configuring keyboard shortcuts.
Configuring user preferences.

Opening a Linux terminal window

On the sidebar, click on Dash home to open the Dash overlay. Select the
Terminal application or, if the Terminal application is not visible on the front
Dash screen, enter terminal in the Dash search bar and select the Terminal
application from the search results.

3.1.2

Configuring keyboard shortcuts

A quicker way to open a terminal is to add a keyboard shortcut. On the


Keyboard Shortcuts page (Figure 3.1) you can configure shortcuts for almost
every application, e.g. starting the calculator, resizing windows, launching your
email and Internet applications, and even adjusting your sound preferences.
To add a keyboard shortcut to run a terminal: Open the System Settings,
either via the System menu on the top menu bar or via the System Settings
icon on the sidebar, and click on Keyboard. Select the Shortcuts tab, then
select Launchers from the list on the left hand side.

Linux Operating System | V1.0 Nov 2013

Page 30 of 133

Now select Launch Terminal from the list on the right hand side and type in
your preferred key combination (note that New accelerator is displayed on
the far right to indicate that the system is waiting for you to supply a key
combination), e.g. <Ctrl><T>. Exit the page, and press the shortcut that you
specified. This will then open a Linux terminal (Figure 3.2).

Figure 3.1 Configuring keyboard shortcuts

Linux Operating System | V1.0 Nov 2013

Page 31 of 133

Figure 3.2 Example of a Linux terminal

3.1.3 Configuring user preferences


With the terminal window open, hover the mouse pointer over the left hand
side of the top menu bar to reveal the menu options for the terminal window.
Select the Edit menu, and select Profiles. You can either use the default
profile, or create an additional one (Figure 3.3). Select the default profile and
click Edit.

Set profile name, and options for font, cursor and terminal bell on the
General tab.
Set window title and exit options on the Title and Command tab.
Set theme or background and foreground colours on the Colors tab.
Set background options on the Background tab.
Set scroll bar options on the Scrolling tab.
Set keyboard compatibility on the Compatibility tab.
Click the Close button to apply the new settings and exit the dialog box.

Linux Operating System | V1.0 Nov 2013

Page 32 of 133

Figure 3.3 Terminal preferences

3.2 The Linux prompt


The command prompt shows that Linux is ready for you to enter a command.
When you open the command console, you should see a command line prompt
that looks something like this:
[user_name@computer_name]:~$

user_name is the name you will use to log into Linux. If you are using a
standalone Linux installation, you will specify your user_name during
installation or by adding yourself as a user. If you are accessing Linux on a
network, your user_name will be allocated to you by the network
administrator.
computer_name is the name of the Linux box (machine) to which you are
logged on.
The ~ symbol identifies the directory that the terminal is currently in, with
the tilde (~) symbol indicating that the terminal is currently operating in the
logged-on users home directory. This symbol will change to reflect the
directory being operated in when the directory is changed.
The $ symbol is the default prompt of the bash shell, but will vary according
to the shell you are using.

Linux Operating System | V1.0 Nov 2013

Page 33 of 133

3.3 System identification


Where Linux is being accessed via a network, the network administrator
assigns each user a unique identification number associated with the users
login name. Users are also allocated to a group (or groups). These groups
usually represent a set of users with similar needs, such as members of a
department or a team working on a particular project.
The User ID (UID) and Group ID (GID) are used to enforce file ownership,
permissions and other security measures within the Linux system.
As discussed in section 2.4, Linux has a special privileged account with the
name of root that is used by the administrator to maintain the Linux system
because root is given all system privileges. The root account has a UID of
zero.
The user that you created during the installation process (yourself) has
automatic administrative rights on the machine. You are, however, required to
add the sudo prefix to commands to be able to perform most administrative
tasks. Sudo is a Linux program that allows users to run programs with the
same privileges as the root user (essentially allowing a user to run a command
as root). Users can be given these privileges by editing the /etc/sudoers
file. When users attempt to perform administrative tasks using sudo, they will
be prompted to enter their password (this was also mentioned during the
installation process).
In the next exercise, you will create an additional user, Mordin, and manipulate
his and your own passwords on the Linux system. He will not be part of the
sudoers group, and will not have permission to perform any administrative
tasks.

Change user passwords.


Add a normal user (Figure 3.4).

The passwd command is used to change users passwords. To change your


own password, enter the following command and follow the prompts:
passwd

At the Linux prompt, type:


sudo adduser mordin

Linux Operating System | V1.0 Nov 2013

Page 34 of 133

When prompted, enter your password. The user will be created, and you
are required to enter a password and other information for the new user
(Figure 3.4).

Confirm that the user information is correct.

Figure 3.4 Adding a user

To change the passwords of other users, such as mordin, enter the


following command and follow the prompts:
sudo passwd mordin

To configure a password for the root user, use the passwd command with
root privileges:
sudo passwd

Close the terminal. Click on the Quit button on the top left hand corner
(hover the mouse point over the left hand side of the top bar to reveal the
button) or, alternatively, enter the exit command to quit the terminal, and
log out of Linux.

At the log in screen, log in as mordin using the information that you entered
in the previous steps.

Once logged in, open a new terminal and type the following command:
sudo adduser genophage

Linux Operating System | V1.0 Nov 2013

Page 35 of 133

The prompt will respond to the command with the following warning (Figure
3.5):
mordin is not in the sudoers file. This incident will be reported

Figure 3.5 This incident will be reported

Log out of Linux, and log back in with your own account.

3.4 Linux command syntax


When working in the Linux terminal or using command interpreter shells, a
user communicates with the operating system by using various commands, in
much the same way as using other command line interpreters, such as MSDOS.
The command console or shell interprets Linux commands and directs the
kernel to carry out the users request. Each command line is made up of one
or more distinct elements, known as the command syntax. The general format
of a Linux command is:
$ command [options] [arguments]
The first part is the command itself.
There may be options that modify the behaviour of the command.
The arguments are character strings that are passed to the command,
providing extra information such as file names.
The square brackets indicate that the options and arguments are optional.
The ellipses indicate that one or more options or arguments may be
provided.
Whitespace characters separate the various elements of a command.
Generally, only one space is inserted using the <spacebar>.

Linux Operating System | V1.0 Nov 2013

Page 36 of 133

3.4.1

Entering commands

Linux is a case-sensitive operating system. It recognises the difference


between uppercase and lowercase characters. Consequently, Pictures is
not the same file as pictures, and MUSIC is not the same file as music.
Commands are generally entered in lowercase, but some commands and
options use uppercase characters.
If a command is typed incorrectly or not found, Linux will respond with the
message:
command: command not found
Pressing the <Enter> key sends commands to be processed. Commands
must be in their correct form before pressing <Enter>.
The <Backspace> key can be used to delete any incorrect characters.
Pressing <Ctrl><U> will discard whatever has been typed on the current
input line, leaving a new blank line to restart the command.
Press <\><Enter> to continue a command on a new line if the command is
too long to fit on one line. The backslash character <\> (called an escape
character) tells Linux that the following character is to be interpreted literally
and not in the usual way. Pressing <\><Enter> provides a new line on
which to continue typing a command. Linux ignores the usual use of
<Enter> and the command is not sent for processing.
Use the semicolon <;> to separate commands so that more than one
command can be entered on a single line.
Press <Ctrl><L> to clear the screen.
Press the up and down cursor keys to move up and down the list of
previously entered commands.
Commands are remembered in the terminal even when you log out of Linux.
The history command can be used to view a history of the commands
entered into the terminal, which history c can be used to clear the
command history.
Linux offers tab line completion. Begin typing a command and then press
the <Tab> key to complete the command automatically.
Use <Shift><Page Up> and <Shift><Page Down> to move up and
down previously displayed screens.

Linux Operating System | V1.0 Nov 2013

Page 37 of 133

3.4.2

Basic Linux commands


Now that you know the basic syntax of a Linux command, how
to enter commands, and how to move around the command
console, it is time to try some Linux commands for yourself.
For this section, it is strongly advised that you try each of the
commands in a Linux terminal window.

To see how you are identified on the system:

Type whoami at the prompt and press <Enter>.

To see the UID and GID, and membership of other groups:

Type id at the prompt and press <Enter>.

To view all system information:

Type uname a at the prompt and press <Enter>.


Using the uname -a command will produce output similar to the following:
Linux host 2.2.14-5.0 #1 Tue Mar 7 21:07:39 EST 2000 i686 unknown
Linux
The operating system being used
host
The Linux boxs name
2.2.14-5.0
The kernel release
#1 Tue Mar 7 21:07:39 EST The operating system version and
2000
the date and time that the kernel
release was compiled
i686
The type of machine (i686 is a
Pentium II)
unknown
The processor, which may be
unknown

To display a list of users currently logged on to the system:

Type who at the prompt and press <Enter>.

This command will tell you who is logged on (user names), which terminals
they are using, and the dates and times when they logged on.

Linux Operating System | V1.0 Nov 2013

Page 38 of 133

To find out more information about the users that are logged on:

Type w at the prompt and press <Enter>.


The w command will display:
o
o
o
o
o

The current time.


How long the system has been up and running (the systems uptime).
How many users are currently logged on.
The system load averages for the past one, five and fifteen minutes.
For each user: user name, terminal name, remote host, login time, idle
time, JCPU (time used by all processes attached to the terminal), PCPU
(time used by the current process [named in the what field]), and the
current process.

Figure 3.6 Basic Linux commands


To display the current date and time:

Type date at the prompt and press <Enter>.


(SAST in the output stands for South African Standard Time.)

To clear the screen:

Type clear at the prompt and press <Enter>.

Linux Operating System | V1.0 Nov 2013

Page 39 of 133

To display text to the screen:

Type echo Bringing the spirit of Ubuntu to the software world at


the prompt and press <Enter>.
This command can be used to sound the system bell using the escape
character \a. To echo any part of the text on a new line, precede that text
with the escape character \n. To use escape characters, surround the text
with inverted commas and add the -e option. For example:
echo -e \aThis will sound the system bell
echo e This text will be displayed on \ntwo different lines

Figure 3.7 The echo command

Clear the screen using both the command and the shortcut
key combination.
Display the message Hello there on the screen so that the
system bell sounds and each word is displayed on a
separate line.

To display a calendar for the current month:

Type cal at the prompt and press <Enter>.

To display a calendar for the current year:

Type cal -y at the prompt and press <Enter>.

To display a calendar for the year 2014:

Type cal 2014 at the prompt and press <Enter>.

Linux Operating System | V1.0 Nov 2013

Page 40 of 133

When specifying the year, use the full year. For example, type 1995, not 95.
Values can range from 1 - 9999.
To display a calendar for the month of December in the year 2013:

Type cal 12 2013 at the prompt and press <Enter>.

When specifying the month and the year, type the number for the month first
(1 - 12). By default, Sunday is displayed as the first day of the week. To
display Monday as the first day of the week, use the -m option. For example,
cal 2 1995 m will display February 1995, with Monday as the first day of the
week.
Use the cal command to find out on what day of the week
you were born.
Use a semicolon to combine the date and who commands to
type them on a single command line.

To shut down Linux immediately:

Type sudo shutdown h now at the prompt and press <Enter>.

The shutdown command:


Has the following syntax: shutdown options time message.
Uses the r option to reboot the machine and the h option to halt the
system.
Can be used to shut down the system in a specified number of minutes.
Uses the word now instead of minutes for immediate shutdown.

Use the shutdown command to halt the machine in three


minutes time, informing all users that the system will be
restored in ten minutes time.

3.5 Getting help


You can use the man (manual) command to get help about any Linux
command. The man command will provide details on the use of the command,
including:

Correct syntax.
Description (uses of the command).
Examples (how the command can be used).
See also (cross references to related commands).

Linux Operating System | V1.0 Nov 2013

Page 41 of 133

To view more information on the sudo command:

Type man sudo at the prompt and press <Enter>.

To exit the help pages and return to the command prompt:

Press the <q> button on the keyboard.

Make a note of the various options that can be used with the
shutdown command. Use the man command to display this
information.
Make a note of the various options that can be used with the
who command.
Use the man command to display this
information.
Use the options -H, -I, and -q with the who command and
observe the effect of each option. Experiment with using the
commands in combination. For example, try the following:
who H and who -u.

Linux Operating System | V1.0 Nov 2013

Page 42 of 133

1. True or False: The User ID and Group ID are used to


enforce file ownership, permissions and other security
measures within the Linux system.
2. The command that can be used by a user to change his or
her own password or by root to specify a password for a
user on the Linux system is ________.
A. pwd
B. userpwd
C. passwd
D. password
3. True or False: In Linux commands, arguments are
optional.
4. The general
____________.

format

of

Linux

command

is:

A. $ command [options] [arguments]


B. $ command [options]
C. $ command [arguments]
D. $ command [arguments] [options]
5. ____________ refers to the proper structure of a
command.
6. A ____________ tells the system what action to perform.
7. A command ___________ modifies the behaviour of a
command.
8. A command ___________ provides further information
for a command.
9. Which Linux command will display information such as
how long the system has been running and how many users
are currently logged on?
A. who -a
B. w
C. sys
D. usrs

Linux Operating System | V1.0 Nov 2013

Page 43 of 133

Unit 4 Working with Directories


At the end of this unit you will be able to:

Display the pathname of the present working directory.


List the files in the current directory.
Create a new directory.
Change the current directory.
Delete directories and their contents.

4.1 Directory commands


In a Linux terminal, there are several useful commands that you can enter at
the command prompt to work with Linux directories. For example:
To display the pathname of the present working directory:

Type pwd at the prompt and press <Enter>.

To display a list of files in the current directory:

Type ls at the prompt and press <Enter>.


Table 4.1 Directory listing options
-l

a long listing displays permissions, number of links, owner, group, file size,
modification date and time, and file name (sorted by file name).

-h

when used with -l, displays the file size in a format that can be read by
humans.

-a

list of all files, including hidden files (beginning with . dot. ).

-i

list of file names with inode numbers in the first column.

-C

multicolumn format, file names in columns down the screen (same as the
default command without options).

-c

multicolumn format, file names in columns down the screen with directories
listed first.

-x

multicolumn format, file names in rows across the screen.

-R

recursive listing of all files, subdirectories included (i.e. full directory listing).

-F

shows file types (forward slashes </> identifying directories and asterisks
<*> identifying executable files).

-1

(the number 1) displays files in a single column down the screen.

Linux Operating System | V1.0 Nov 2013

Page 44 of 133

Identify your present working (current) directory.


Experiment with the various options of the ls
command.

To create a new directory:

Type mkdir directory_name at the prompt and press <Enter>.

Create a new directory called Projects.

To change to a specified directory:

Type cd specified_directory at the prompt and press <Enter>.

Change to the newly created Projects directory.


Note that the prompt changes to indicate that Projects is
the current directory.
Confirm that you have changed to the Projects directory by
using the correct command to check the present working
directory.
Get a directory listing to show all files.
Note that the new directory is empty except for the dot .
(current) and dot, dot .. (parent) directories.

To return to your home directory:

Type cd at the prompt and press <Enter>.

To change to the parent directory of the current directory:

Type cd .. at the prompt and press <Enter>.

In some of the exercises that follow, you will have to create certain files using
the touch command. The touch command will be covered in more detail in
Unit 5. For now, all you have to know is how to create an empty file with the
specified file name.

Linux Operating System | V1.0 Nov 2013

Page 45 of 133

To create and name an empty file using the touch command:

Type touch file_name and press <Enter>.

To delete everything in the current directory:

Ensure that you are in the directory that you want to empty and type rm *
and press <Enter>.

Ensure that you are in your home directory.


Create a new directory called practice2.
Change to the practice2 directory.
Create file1 and file2 using the touch command.
Get a listing to confirm that they exist.
Delete all files in the practice2 directory using rm *.
Get a listing to confirm that all the files have been deleted.

To delete everything in the current directory and everything below it in


the subdirectory hierarchy:

Ensure that you are in the directory that you want to empty and at the top
of the tree you want to erase, and type rm r * and press <Enter>.

Ensure that you are in the practice2 directory.


Create a file called file1 using the touch command.
Create a subdirectory called sub.
Change to the sub directory.
Create a file called file2 using the touch command.
Change to the practice2 directory using parent directory
notation.
Delete file2, the sub directory, and file1 using a single
command.
Do a listing to confirm that the sub directory and both files
have been deleted.

To delete a directory:

Ensure that the directory you want to delete is empty, and that you are not
in the directory you want to delete. Type rmdir directory_name and press
<Enter>.

Linux Operating System | V1.0 Nov 2013

Page 46 of 133

Ensure that the practice2 directory is empty.


Change to your home directory.
Delete the practice2 directory using the rmdir command.

To delete a directory and all of its contents:

Ensure that you are not in the directory that you want to delete, and type
rm r directory_name and press <Enter>.

Create a directory called practice3.


Change to the practice3 directory.
Create file1 using the touch command.
Change to your home directory.
Delete the practice3 directory and its contents using the rm
r command.

Linux Operating System | V1.0 Nov 2013

Page 47 of 133

1. Which Linux command will display the current working


directory?
A. pwd
B. ls
C. ls -a
D. dir
2. Give the Linux command that will display a list of files in the
current directory along with their inode numbers.
3. Give the Linux command to display a list of all files in the
current directory, including hidden files.
4. Give the Linux command to create a subdirectory called
mysub in the current directory.
5. Which Linux command can be used to delete a directory and
all its contents?
A. rm -r
B. rd -a
C. rmdir -r
D. rdd -a

Linux Operating System | V1.0 Nov 2013

Page 48 of 133

Unit 5 Working with Files


At the end of this unit you will be able to:
Change the time stamp of a file.
List files with their file types showing.
View the contents of files.
Search files for specific text patterns.
Display the differences between two files.
Copy, move and delete files.
Change file ownership and file permissions.

5.1 Basic Linux file commands


In Unit 4, you used the touch command to create empty files with specified
names. The same command can be used to change the time stamp of a file.
To change the time stamp of a file without changing its contents:

Type touch file_name and press <Enter>.

The touch command:

Will create a new, empty file if the file name specified does not already exist.
Updates the last accessed time for the file.
Does not open the file in a text editor (as the vi command would).
Is particularly useful for updating the time stamp of a file that relies on daterelated activities such as archiving and backing up.

Create a new, empty file called Reports.file.


Get a listing to check that the file exists, and note the file
size.

To display the type of a file:

Type file file_name and press <Enter>.

To display the file types of all files in the current directory:

Type file * and press <Enter>.

Linux Operating System | V1.0 Nov 2013

Page 49 of 133

The file command:


Is useful for getting a quick idea of the nature of a files contents.
Performs a series of tests on the file(s) specified in an attempt to report a
classification; sometimes the file type reported will be unfamiliar.

Display the file types for all files in the current directory

5.2 Creating a simple text file


5.2.1

Text editors

A text editor is a program that can be used to create and modify the contents
of a file. In this module, you will work with one of Ubuntus built-in text
editors, vi (pronounced vee-eye).
Technically, vi in Ubuntu 12.04 is actually vim-tiny. Vim (Vi IMproved) is an
update of the older vi, while vim-tiny is a smaller version of vim. Despite
this, the vi command is still used to launch the editor. Another of Ubuntus
built-in text editors is nano.
A text editor is a very simple version of a word processor. Text editors do not
have document formatting features, such as various fonts and ways of aligning
text. Text editors produce simple text files.
The visual editor, vi, runs in two modes:
Command mode This is the mode you enter automatically when you start
vi. Whatever you type in this mode will be interpreted as an editing
command, such as copy, paste and delete text. You can also save and exit
the file from within this mode.
Text entry mode This mode is used to enter text. Keys pressed in this
mode are interpreted as characters, and are inserted into the text file.
Pressing <a>, <i>, <c> or <o> will take you from command mode into text
entry mode. The command you choose to enter the text entry mode depends
on what you intend to do. For example, choose <i> to insert text at the
current cursor position. The other options will be discussed in the text entry
mode section.

Linux Operating System | V1.0 Nov 2013

Page 50 of 133

5.2.2 Text entry mode


To add text to a file in vi, you need to be in text entry mode. As discussed in
section 5.2.1, there are several commands for entering the vi text entry mode.
Choose the command to enter the text entry mode according to what you
intend doing. The main commands and their uses are as follows:
Table 5.1 Text entry mode commands
a

Appends (adds) text immediately after the cursor.

Appends text at the end of the current line.

Inserts text at the current cursor position.

Inserts text at the start of the current line.

Inserts new text from the cursor to the end of the current line.

Opens a line below the current line and places the cursor at the start of
the new line.

Opens a line above the current line and places the cursor at the start of
the new line.

Overwrites the character or selected text at the current cursor position,


and inserts subsequent text.

Create a new text file called Ubuntu using vi (i.e. vi


Ubuntu).
Type the verses below into the buffer, using the <Enter>
key at the end of each line, and the <Backspace> key to
delete mistakes. Once you have entered the text below,
leave the file open and continue with the next section.

Umuntu ngumuntu ngabantu


Humanity to others
I am what I am because of who we all are
The Ubuntu Linux distribution aims
To bring the spirit of Ubuntu to the software world

5.2.3 Command mode


To issue a command in vi, you must be in command mode. When you open
vi, you will be in command mode by default.
To return to vi command mode from text-entry mode:

Press the <Esc> key.

Linux Operating System | V1.0 Nov 2013

Page 51 of 133

The first vi command we are going to look at is <Ctrl><g>, which provides a


status line at the bottom of the screen. It shows the file name, whether it is a
new file and whether it has been modified, the current line number and the
number of lines, and an indication of how far into the file you are (given as a
percentage).
Next, we will look at the vi commands for saving and exiting files. These are
as follows:
:w
:q!
:q
:wq
:x
ZZ

save your changes to disk; you remain in the vi editor.


abandon your changes and return to the command line prompt.
exit vi, and return to the command prompt (when no changes were
made).
save changes, and return to the command prompt.
Save all changes to the Ubuntu file and return to the
command prompt. Use the colon with the letter/symbol.

NOTE

You will have to press <Enter> after all save and exit commands,
except ZZ. Typing ZZ in command mode will immediately save
changes to the file and return to the command line prompt
(remember that Linux is case-sensitive). If you start vi without
entering a file name, you will need to specify a file name when you
save it. The format is as follows:
:w filename. This syntax will also work with :wq and :x.

5.3 Viewing files


To view the contents of a file:

Type cat file_name and press <Enter>.

The cat (concatenate) command:


Is a quick command to display the contents of a file on the screen.
Does not allow you to move backwards and forwards in the file and, if the
contents cannot fit onto one screen, the display will scroll to the end of the
file.

Linux Operating System | V1.0 Nov 2013

Page 52 of 133

Use the cat command to view the contents of the Ubuntu


file.

To view the contents of a file in controlled amounts:

Type more file_name and press <Enter>.

To view the contents of a file from a specific file number:

Type more +line_number file_name and press <Enter>.


(For example: more +2 Ubuntu to view the contents of the Ubuntu file
from line two.)

After entering the more command, the first part of the file scrolls up the
screen. At the bottom of the screen, a prompt displays the file name and the
percentage of the file displayed so far. Note that this percentage is in
characters, not lines. At this point, there are several commands that may be
used, depending on how you want to proceed:
Table 5.2 The more command options
<Spacebar>

Displays the next full screen.

n <Spacebar>

Displays n more lines.

<Enter>

Moves down one more line of text.

<b> or
<Ctrl><b>

Moves back one full screen.

<q> or <Q>

Quits (exits) from more and returns to the command


prompt.

<h> or <?>

Displays a list of all the more commands.

Use the more command to view the Ubuntu file.


Experiment with the various display options available within
the more command.

To view the contents of the file and be able to move around in the file:

Type less file_name and press <Enter>.

The less command is similar to the more command, but allows greater
flexibility in moving backwards and forwards in a file.

Linux Operating System | V1.0 Nov 2013

Page 53 of 133

Table 5.3 The less command options


<Home>

Move to the top of the file.

<End>

Move to the end of the file.

<> and <> Move up and down one line at a time.


<h> or <H>

Display help.

<q> or <Q>

Quits (exits) from less and returns to the command prompt.

Use the less command to view the Ubuntu file.


Experiment with the various display options available with
the less command.

To display the first ten lines of a specified file:

Type head file_name and press <Enter>.

To display the first n lines of a specified file:

Type head n file_name and press <Enter>.

To display the last ten lines of a specified file:

Type tail file_name and press <Enter>.

To display the last n lines of a specified file:

Type tail n file_name and press <Enter>.

To display the end of a file from the nth line:

Type tail +n file_name and press <Enter>.

Use the head and tail commands to view the Ubuntu file.
Try the following commands and compare the results:
o

head Ubuntu

head -2 Ubuntu

tail +2 Ubuntu

tail 5 Ubuntu

tail Ubuntu

Linux Operating System | V1.0 Nov 2013

Page 54 of 133

To count the number of lines, words and characters in a specified file:

Type wc [options] file_name and press <Enter>.


Table 5.4 The wc command options
-l Line count
-w Word count
-m Character count

Use the wc command to get information on the Ubuntu file.


Try the following commands and compare the results:
o

wc Ubuntu

wc l w c Ubuntu

wc l m Ubuntu

wc w m Ubuntu

wc lw Ubuntu

To sort the contents of a file into alphabetical or numerical order:

Type sort file_name and press <Enter>.

The sort command:


Outputs the sorted file to the screen, but does not modify the original file.
Uses each new line as a new record.
Will sort according to alphabetical or numerical order, depending on file
content.
Has several options not covered in this module.

Create a new file called people, using the vi editor and


type Kaidan, Garrus, James, Thane, Legion and Liara each
on a different line.
Save the file.
Sort the contents of the people file into alphabetical order,
using the sort command.
Use the man command to find out how to sort in ascending
and descending order.

Linux Operating System | V1.0 Nov 2013

Page 55 of 133

To search files for a specific pattern or text:

Type grep [options] expression file_name and press <Enter>.

The grep command:

Is a quick way to search a file for a string pattern.


Allows you to search all files for a specific text string.
Requires the search phrase to be placed in single quotes.
Displays the line of text containing the specified text string.
Will not find text patterns spread over more than one line.
Table 5.5 The grep command options

-c

displays only the number of matching lines in each file.

-l

lists only the name of the file that contains the specified pattern (stops
scanning after first match is made).

-n

displays the line number of the line containing the specified text.

-i

does not distinguish between uppercase and lowercase.

Use the grep command to find all files that contain the word
Legion.
Search the Ubuntu file for the word because. Display the
line numbers and turn off case sensitivity.

To display the difference between two text files on a line-by-line basis:

Type diff [options] file1 file2 and press <Enter>.

The diff command:


Displays output which shows how you would need to change the first file so
that it resembles the second file.
Works best when there are few differences between the two specified files.

Create a new file called strange_people and type Zaeed,


Legion, Jeff, Karin, Thane and Hackett each on a
different line, exactly as shown.
Save the file.
Compare the two people files, using the diff command.
Rerun the command, using the b option to ignore
whitespace characters.
Rerun the command with the names of the files the other
way round.

Linux Operating System | V1.0 Nov 2013

Page 56 of 133

To create a copy of a file:

Type cp source destination and press <Enter>.


Add the option -i to force the system to ask for confirmation before
overwriting an existing file.

The cp command:
is used to create duplicate copies of ordinary files.
can also be used to copy files for backup purposes by giving the file a new
name or extension, such as .bak to indicate the file is a backup file.
copies the file to a specific directory if the destination file name is a directory
file.
creates a file if the destination file does not already exist.
overwrites a file if the destination file already exists.
can copy more than one source file only if the destination file is a directory
file, for example, the command cp file1 file2 practice will copy both
file1 and file2 into the practice directory.
To put a copy of a file in the Public directory:

Type cp file_name Public and press <Enter>.

To put a copy of a file in the /tmp directory under a new name:

Type cp file_name /tmp/new_file_name and press <Enter>.

To learn more about the options that can be used with the cp
command:

Type man cp and press <Enter>.

Make sure that you are in your home directory.


Copy the file Ubuntu to the Projects directory.
Change to the Projects directory.
Get a listing to confirm that the Ubuntu file is in the
Projects directory.
Return to your home directory.
Copy the files people and strange_people to the Projects
directory using a single command.
Return to the Projects directory.
Get a listing to check that both files have been copied to
that directory.

Linux Operating System | V1.0 Nov 2013

Page 57 of 133

To delete a file from the current directory:

Type rm [options] file_name and press <Enter>.


Add the i option to force the system to ask for confirmation before
deleting a file.
Delete people and strange_people from the home
directory, asking for confirmation before executing the
command.
Do a listing to check that the files have been deleted.

See Unit 4 for more information on how to delete files using the terminal, and
to learn more about the options that can be used with the rm command:

Type man rm and press <Enter>.

Create a directory called normandy.


Change to the normandy directory.
Create three files called crew, ordnance and shepard using
the touch command.
Do a listing to check that the three files exist.
Delete the three files using a single command.
Do a listing to check that the files have been deleted.
Delete the development directory.

Instead of copying files from one directory to another, and then deleting them
from their original directory, you can move the files.
To move a file from one directory to another:

Type mv source destination

The mv command:
Moves the source file to a new directory if the destination is a directory file.
Overwrites the contents of a file if the destination is an existing ordinary file.
Creates a new file into which the source file is copied if the destination is an
ordinary file that does not already exist.
Can accept multiple source files, but the destination must be a directory file.
Can use an absolute address (e.g. /home/user/destination_directory) or a
relative address (e.g. ../destination_directory).

Linux Operating System | V1.0 Nov 2013

Page 58 of 133

Ensure that you are in your home directory.


Create a directory called normandy.
Create another directory called crucible.
Change to the normandy directory.
Create two files named sr1 and sr2 using the touch
command.
Use a single command to move the two files in the normandy
directory to the crucible directory using a relative path.
Get a listing to check that the files are no longer in the
normandy directory.
Change to the crucible directory.
Get a directory listing to check that the two files were moved
to the crucible directory.
Now move sr1 back to the normandy directory using an
absolute path.
Get a listing to check that only sr2 remains in the crucible
directory.
Change to the normandy directory.
Get a listing to check that sr1 has been move back into this
directory.

To find a file and perform some action on it:

Type find pathname-list condition-list action-list

The find command is used to locate one or more files that satisfy a condition
in the paths that you specify, and can perform actions on the file that has been
found (such as printing the pathname).
Options that can be used with the find command:

Pathname-list specifies the paths to search use dot (.) to begin at the
current directory or slash (/) for all directories, i.e. from root.
Condition list could be any of the following:
o -name the filename of the specific file to be found.
o -perm ###: where ### represents the octal file permissions.
o -type x where x is one of the following types: d (directory file), f
(ordinary file), c (character device file), b (block device file).
o -user user_name for files with a specific owner or UID.
o -group group_name for files belonging to a specific group or GID.
o -size n to find files of size n blocks.
o -links n to find files with n links.
o -atime n to find files that were accessed n days ago.
o -mtime n to find files that were modified n days ago.
o ctime n to find files that were created n days ago.

Linux Operating System | V1.0 Nov 2013

Page 59 of 133

Action list specifies the action that should be carried out on the files that
meet the criteria (as per the conditions list), and could be any of the
following:
o print to display files to the screen.
o -exec command: to execute a command.
o -ok command similar to exec, except that you are queried first.

List all directory files on the root directory using the find
command.

5.4 File security


Linux is a multi-user environment that uses permissions to control who may do
what, thus monitoring the security of the system. Remember that the inode
number tracks file permissions, so all file access takes place through the inode
first, thus maintaining security.

5.4.1

File ownership

The first level of implementing data security is file ownership. Each file in a
Linux system has an owner that corresponds to one of the authorised users:

When a user creates a file, it is marked as being owned by that user.


Only the creator of a file or a superuser (root privileges, i.e. sudoers) can
change the ownership of a file.
Once the creator of a file changes ownership of the file, that user no longer
owns it, and can regain ownership only if the new owner or superuser
returns ownership.

5.4.2

Changing file ownership

Changing ownership is used less frequently today, with more sophisticated


communication methods available, but may be used by the system
administrator to reassign ownership after copying important files to a users
directory.
To change ownership of a file:

Type chown new_owner file_name [file_name . . .]

To change group ownership of a file:

Type chgrp new_group file_name [file_name . . .]

Linux Operating System | V1.0 Nov 2013

Page 60 of 133

NOTE

new_owner and new_group may be names or identification numbers


(UID or GID).

5.4.3

File permissions

File permissions control access to an ordinary file or directory file. These


permissions specify who can use a file or directory, and how.
Users are divided into three classes:
u

user (owner) the person who created the file.

group to which the user belongs.

other system users.

Permissions are divided into three categories, and have different meanings
depending on whether ordinary files or directory files are involved:
Symbol
r

Category
Read

Write

Execute/
Search

Ordinary files
Can view the contents
of the file
Can change the files
contents
Can run a program file

Directory files
Can see a list of files in
the directory
Can add and remove
files from the directory
Can change to and
search the directory

In general, a user requires both Read and Execute permissions on a directory


to use it in any practical way.
The permissions for an ordinary file are constructed as follows:

type

r
w
x
owner (u)

group (g)

others (o)

The first position indicates the file type:

ordinary file

d directory file

b block device file

c character device file

When a user is granted a particular access type, the corresponding letter


appears in the relevant class. If a user is denied permission, a dash ()
appears in the column.

Linux Operating System | V1.0 Nov 2013

Page 61 of 133

In the case of an ordinary file, the owner has Read, Write and Execute
permissions, whereas the group and other users are limited to Read-only
permission.
NOTE

If you give one user in any group Write permission (i.e. the ability to
change a file), then you give that permission to everyone else in the
group too. This is a major drawback of this permission system.

Execute permission makes sense only if the file is actually a program


(command) or a shell script (a file that contains a list of one or more
commands that can be executed by the shell like a DOS batch file).
Therefore, the Execute permission is usually excluded from ordinary
files.

5.4.4

Changing file permissions

File permissions can be changed only by the owner of a file or the superuser
(root).
To change a files permissions:

Type chmod [who] op-code permission . . . file_name . . .


Table 5.6 The chmod command options
who

Determines the user class u, g, o, or a (all)

op-code

+ add the specific permission


- remove the specific permission
= assign the specific permission

Permission

The category of permission involved, r, w, or x

To change a file to Read-only (or write-protected) mode:

Type chmod a=r file_name and press <Enter>.


or
Type chmod ugo=r file_name and press <Enter>.
or
Type chmod a+r,a-wx file_name and press <Enter>.

A public directory that must be accessible to all system users would have the
following permissions: r w x r w x r w x

Linux Operating System | V1.0 Nov 2013

Page 62 of 133

To set full access for directory files:

Type chmod a=rwx directory_name


or
Type chmod ugo+rwx directory_name
or
Type chmod u=rwx,g+rwx,o+rwx directory_name

An executable file that is accessible only to its owner would have its
permissions set to:
rwx --- --To set permissions for an executable file that is accessible only to its
owner:

Type chmod u=rwx,gorwx file_name and press <Enter>.

Create a directory called security.


Change to the security directory and create a new file called
access_control.
Get a long directory listing and note the permissions for the
file, access_control.
Change the permissions of this file to r w .
Get a long directory listing to confirm that these changes
have been made.

The method of changing file permissions that we have seen so far is called
symbolic format. We will now look at the absolute format, which expresses
permissions in a very neat way and requires less typing, thereby reducing the
chance of errors.
To change file permissions using the absolute format:

Type chmod mode file_name

Absolute format is a little more difficult to construct than the symbolic method,
and is based on an octal number representing the permission mode.
r
4

w
2

x
1

By adding up the respective permission values, all permission combinations are


represented by an octal number between 0 and 7. These numbers are then
expressed in groups of three to indicate the access mode for each class of
user.

Linux Operating System | V1.0 Nov 2013

Page 63 of 133

To construct the absolute permission mode, use the process shown below:
user
r
w
x
4
2
1
7

group
r

x
4
0
1
5

other
r
w

4
2
0
6

To use the absolute format to change file permissions to


rwx rx rw:

Type chmod 756 file_name

To use the absolute format to change to a user/owner Read-only file:

Type chmod 400 file_name


user
r

4
0
0
4

group

0
0
0
0

other

0
0
0
0

To use the absolute format to change file permissions to


rw r r :
Type chmod 644 file_name
user
r
w

4
2
0
6

group
r

4
0
0
4

other
r

4
0
0
4

Change to the security directory.


Get a directory listing and note the file permissions for the
access_control file.
Write protect the access_control file using the absolute
format, i.e. change the permissions to r r r .
Get a new directory listing and note the file permissions for
the access_control file.
Try to remove the access_control file.
The shell responds with a question:
Remove writeprotected regular empty file access_control?
y would confirm the deletion; any other key would ignore
the command to remove the file.
Press <Enter> to cancel the remove command, and avoid
deleting the access_control file.

Linux Operating System | V1.0 Nov 2013

Page 64 of 133

5.4.5

Setting default permissions

The chmod command allows the owner of a file to change the permissions for
particular files and directories.
You can, however, change the default
permissions that apply for all new files and directories that you create. The
umask command is used for this purpose.
The umask value tells the system what permissions to exclude, and is
constructed in the following way:
1. Decide what permissions you want as default (in symbolic form).
2. Complement the pattern to show the permissions to exclude.
3. Work out the octal values as for absolute mode permissions.
Should you want rwx rx as your default permissions, you would
calculate the umask value as follows:
user
r
w
x

group
r

other

r
4

0
0

w
2
2

w
2
7

x
1

Default permissions in symbolic


form
Complement the pattern

Octal values

Umask value

The umask value would thus be 027.


New directory file permissions would be: r w x

rx

New ordinary file permissions would be:

rw

(Ordinary file permissions differ from the default pattern because


Execute permission is not usually enabled when ordinary files are
created.)
To find the current umask value:

Type umask and press <Enter>.

To change default file permissions:

Type umask new_value and press <Enter>.

To work out the default permissions for an ordinary file:

Type umask and press <Enter>.


Take the umask value and split it into three groups
(e.g. 027 splits into 000, 020, 421).
Express that in symbolic form (e.g. , w , r w x).
Find the complement (e.g. r w x, r x, ).

Linux Operating System | V1.0 Nov 2013

Page 65 of 133

Exclude Execute permissions for ordinary files (e.g. r w , r , ).

Change to the security directory.


Check the umask value for your files.
Create an empty file called before.file, using the touch
command.
Get a long listing to check the before.file permissions.
Change the umask value to 027.
Create another empty file called after.file, using the
touch command.
Create a new directory called extra.
Get a long listing and compare the permissions of
before.file, after.file, and extra.
Be sure that you understand the reasons for the
differences. Notice the - indicating that the before and
after files are ordinary files and the d indicating that extra
is a directory file.

NOTE File permissions and ownership can be changed in the GNOME


desktop environment by right-clicking the file, choosing Properties
from the pop-up menu, clicking the Permissions tab, changing the
settings and clicking the Close button.

Linux Operating System | V1.0 Nov 2013

Page 66 of 133

1. True or False: Text editors have document-formatting


features such as various fonts and ways of aligning text.
2. True or False: Typing ZZ in the command mode of Linuxs vi
text editor will immediately save changes to the file and return
to the command line prompt.
3. In Linuxs vi editor, you would press the _________ key to
move from command mode to text entry mode.
A. <i>
B. <a>
C. A, B, and D
D. <o>
4. To return to the vi command mode, the user must press the
__________ key.
A. <F2>
B. <Enter>
C. <c>
D. <Esc>
5. In Linuxs vi text editor, the user will have to press _______
after all save and exit commands, except ZZ.
A. <F10>
B. <Ctrl><d>
C. <Ctrl><g>
D. <Enter>
6. True or False: It is possible to start the vi editor and open an
existing file using a single command.
7. True or False: The touch command is used to change a files
permissions.
8. True or False: The head command moves the cursor position
to the first file in a directory listing.
9. True or False: Ownership of a file may be changed and given
to another user.
10. True or False: A file is owned by the user who creates it.
11. True or False: The owner of a file may change the files
ownership.
Linux Operating System | V1.0 Nov 2013

Page 67 of 133

12. What result would the following command produce?


wc -lw myfile
A. myfile would be saved with the new name lw.
B. The contents of myfile would be displayed with all the w
characters replaced with l and all the c characters
replaced with w.
C. A list of all the misspelled words in myfile.
D. The number of lines and words in myfile would be displayed.
13. To search text files in Linux for a particular text pattern, you
would use the __________ command.
A. grep
B. sort
C. wc
D. search
14. Choose the comment that most accurately applies to the
following command:
cp file file.bak
A. The first file name is invalid because it has no extension.
B. The Linux command for copy is cpy not cp.
C. There is nothing wrong with this syntax.
D. The second file name cannot be the same as the first one.
15. Select the command that would copy the files file.1 and
file.2 to mydir, a subdirectory of the home directory:
A. cp file.1, file.2, mydir
B. cp file.1 file.2 mydir
C. cpy file.1 file.2 ../mydir
D. cpy file.* mydir
16. Given a umask value of 133, what permissions would you
expect from a newly created ordinary file?
A. x wx wx
B. rw r r
C. w w
D. r r r

Linux Operating System | V1.0 Nov 2013

Page 68 of 133

17. Given a umask value of 011, what permissions would you


expect from a newly created directory file?
A. rwx rw rw
B. x x
C. rw rw rw
D. r r r
18. Given a umask value of 023, what permissions would you
expect from a newly created ordinary file?
A. w wx
B. rw r r
C. rw r w
D. rwx rx r
19. If the absolute permission for an ordinary file were 744,
which set of permissions would be displayed in a listing of file
names?
A. orw
B. crw
C. rw
D. rwx

r
r
r
r

r
r
r
r

20. If the absolute permission for a directory file were 766,


which set of permissions would be displayed in a listing of file
names?
A. rwx
B. drwx
C. crw
D. drw

rw
rw
rw
rw

Linux Operating System | V1.0 Nov 2013

rw
rw
rw
rw

Page 69 of 133

Unit 6 Input and Output


At the end of this unit you will be able to:

Understand how Linux deals with input and output.


Redirect the standard input and output files.
Use redirection to create, join, copy and append files.
Use pipelines to string commands together.
Create filters and sample data in a pipeline.

6.1 Input and output files


So far, most input into the Linux system has come from the keyboard, and
most output has been sent to the screen. These input and output channels
(streams) as well as a channel for error messages have been given special
names and numbers called file descriptor numbers:

standard input
standard output
standard error

stdin
stdout
stderr

keyboard
screen
screen

0
1
2

file
descriptor
numbers

Linux treats these channels as files, so some textbooks may refer to the
standard input file, the standard output file and the standard error file.
Normally, these channels are attached to your terminal (i.e. screen and
keyboard). It is possible, however, to detach the standard input and output
files of a process and redirect them by changing the identity of these files (the
standard error can also be redirected, although this is rarely done). For
example, instead of having data sent to the stdout, it can be redirected to a
file. Similarly, input can come from a file instead of the keyboard.
When a process is run, the stdin and stdout files for it are opened by the
shell. Linux then achieves redirection by changing the identity of these
standard files from keyboard and screen to some other device (such as a disk
or file).

Linux Operating System | V1.0 Nov 2013

Page 70 of 133

6.2 Redirecting the standard output file


The output redirection symbol is >
To redirect output from the screen to a file:

Type command >file_name and press <Enter> (where command is any


Linux command that produces output).
or
Type command 1>file_name and press <Enter> (where 1 is the file
descriptor number of the output channel).

If the output of a command is redirected to a file, the output will not be


displayed on the screen. If the file name does not exist, it will be created. If
the file name does exist, its contents will be overwritten with the new data.

Redirect the output of the date command to the file, data.


View the contents of the data file using the cat command.
Redirect the output of the who command to the data file.
View the contents of data, using the cat command.
Note that the date output has been overwritten.
Redirect the output of both commands: date; who >data.
Notice that the date information was displayed on the
screen.
Check the contents of the data file using the cat
command.
Notice that only the who command data was written to the
file.
Use brackets to get the output of both into the file:
(date; who) >data.
Check the data file again.

To use redirection with the cat command to create a new text file:

Type cat >file_name and press <Enter>.


Type text on the blank lines provided.
Press <Ctrl><d> to indicate the end of file.

To echo more than one file to the screen using the cat command:

Type cat file1 file2 and press <Enter>.

To concatenate (join) files using the cat command with redirection:

Type cat file1 file2 >new_file and press <Enter>.

Linux Operating System | V1.0 Nov 2013

Page 71 of 133

To make a copy of a file using the cat command with redirection:

Type cat original_file >new_file and press <Enter>.

The cat commands stdin is the keyboard (if no file is given as an argument)
and its stdout the screen.
Command
$ cat file_name
$ cat

stdin

stdout

file

screen

keyboard

screen

Create a new file called random using redirection with the


cat command, and put the text This is a random,
useless file into the file.
Check the contents of the random file using the cat
command.
Join the data and random files in a third file called
combined using redirection with the cat command.
Check the contents of the combined file using the cat
command.

To redirect output to a file without overwriting existing file contents:

Type command >>file_name and press <Enter>.

Using the append symbol >> adds, or appends, output to the end of the file,
rather than overwriting what is already there. If the file does not already
exist, it is simply created.

Redirect the output of the cal 12 2007 command to the


data file without overwriting the contents of the file.
Check the contents of the data file to check that the output
of the cal 12 2007 command was added to the data file
without overwriting its original contents.

6.3 Redirecting the standard input file


The input redirection symbol is <
To redirect input from the keyboard to a file:

Type command <file_name and press <Enter>.


or
Type command 0<file_name and press <Enter> (where 0 is the file
descriptor number of the input channel).

Linux Operating System | V1.0 Nov 2013

Page 72 of 133

6.4 Redirecting the standard input and standard output


The stdin and stdout can be redirected at the same time.
To make a copy of the text file with the cat command using redirection
of stdin and stdout:

Type cat <text >text.bak and press <Enter>.

NOTE

Redirection symbols are easier to read if placed immediately in


front of the file involved.
Redirected input and output file names can be placed in any order,
so the command above is the same as: cat >text.bak <text.
The same file name cannot be used for the source and destination,
as in: cat <text >text, because the source file will be replaced by
an empty file before its contents are copied.

6.5 Redirecting the standard error file


The standard error file can be redirected away from the screen, but this can
only be done using file descriptor numbers.
To redirect the standard error file from the screen to a file:

Type command 2>file_name and press <Enter>.

To redirect stdout and stderr at the same time:

Type command >output.file 2>error.file and press <Enter>.

To redirect stdout and stderr to the same file:

Type command >output.file 2>&1 and press <Enter>.

NOTE

Redirection of the stderr file will be practised in section 7.2.

6.6 Pipelines
Linux allows commands to be strung together so that the stdout of one
command becomes the stdin of the next command. This process is called a
pipe, and allows data to be processed by several commands in succession.

Linux Operating System | V1.0 Nov 2013

Page 73 of 133

Pipelines:
Are used to redirect the flow of data between processes, giving greater
flexibility in the use of the Linux system.
Save time and disk space because intermediate data does not need to be
stored in a temporary file.
The vertical bar ( or |) symbol is used to denote a pipe.
To set up a pipe in Linux:

Type command1 command2

When using a pipe in Linux:


The whitespace characters are optional, and are only used for clarity.
The output of command1 does not appear on the screen, nor is it stored in a
file Linux stores the output of command1 in its memory buffer, and then
uses it as input for command2.
command2 begins processing as soon as there is output from command1 for it
to use as input (it does not wait for command1 to finish running). Such
simultaneous processing helps speed up the overall processing of the
pipeline.
For a command to be used in a pipeline, it must meet one of these conditions:

It must take its input from the stdin (then it can be used at the end of a
pipeline), for example, the more command.
It must send its output to the stdout (then it can be used at the beginning
of a pipeline), for example, the ls command.
It must take its input from the stdin and send its output to the stdout
(then it can be anywhere in a pipeline beginning, middle or end), for
example, the sort command.

The three commands above could be used to sort and display the contents of
the tmp subdirectory, one screen at a time, using the pipe: ls -l /tmp |
sort | more.

Linux Operating System | V1.0 Nov 2013

Page 74 of 133

Use the who command to get a list of those users who are
signed on, and note the order of the output.
Pipe the output of the who command to the sort command,
and compare the result with the output of the who
command.
Count the number of users signed on by piping the output
of the who command to the wc command.
A common use of the pipe command is to pipe a file to the
more command. Try the command: cat Ubuntu more
and use the <Spacebar> to see more of the file.
Create a file called crew using the vi or nano editor, and
type in the following text:
o Miranda cer-laz-beng
o Thane

unk-dre-assa

o Jacob

cer-laz-fsan

o Kasumi

unk-hum-thie

o Ashley

san-gun-srgt

o Jack

unk-pur-biot

Send a sorted list of all the crew entries with unknown


allegiances to a file called unknown, using the grep
command to select only unk designations, using a pipe to
send the output of the grep command to the sort
command, and using redirection to direct the output of the
sort command to the file unknown.
Check the result by using the cat command to view the
unknown file.

6.7 Filters
Commands that take their input from the stdin and send their output to the
stdout are called filter programs or filters. A defining feature of filters is that
they are commands or programs that can be used anywhere in a pipeline, and
they generally perform some useful transformation of the data that passes
through them. Commands such as sort and wc are good examples of filters.
The tr (translate) command is another filter command. It is used to:
Convert one character into another character.
Compress a group of characters into a single character.
Delete specific characters.

Linux Operating System | V1.0 Nov 2013

Page 75 of 133

To use the translate command:

Type tr [options] string1 [string2] and press <Enter>.

When using the tr command:


Specifying both strings translates the characters in string1 to those in
string2.
The strings may be individual characters or ranges of characters.
The d option can be used to delete characters from the file (string2 is not
required).
To convert all lowercase t characters in a file to uppercase:

Type tr t T <file_name and press <Enter>.

To convert all lowercase a, b, c in the output of the who command to


uppercase:

Type who tr a-c A-C and press <Enter>.

To display a file with all the a characters deleted:

Type cat file_name tr d a

Use the tr command to change all the vowels in the


Ubuntu file to uppercase letters.
Use pipelining and the tr command to display the output of
the who command in uppercase letters.
Use pipelining and the tr command to display Ubuntu
(using the cat command) with all the spaces deleted.

6.8 Sampling data in a pipeline


The tee command is used to sample data at a point in a pipeline. Sampling
data can be useful if a pipeline process is not producing the expected result.
The tee command sends a copy of the data passing through a pipeline to a
file. It is a filter command that reads the stdin and writes to both the stdout
and a file. The tee command works like a T-connection in a pipeline.
When using the tee command:
The data is not altered in any way, it is merely sent in two different
directions (see Figure 6.1).
If the specified file name exists, its contents will be overwritten.
If the specified file name does not exist, it will be created.

Linux Operating System | V1.0 Nov 2013

Page 76 of 133

The a option will append data to the specified file, instead of overwriting its
contents.

command 1

pipe

tee

pipe

command 2

file

Figure 6.1 The tee command works like a T-connector in a pipeline


To check data after the who command and write it to a file called
sample:

Type who tee sample sort and press <Enter>.

Sort the crew file, writing the sorted list to the check file
with tee and use pipelining to append a count of how many
unknown entries there are to the check file.
Get the date using the date command and append the
output of the command to the file check using tee, then
display a count of the number of words in the date output.
View the check file using the cat command.
Note that check contains the sorted crew file as well as the
date on the last line.

Linux Operating System | V1.0 Nov 2013

Page 77 of 133

1. True or False: When using a pipe in Linux, it is required to


separate the various commands with a single whitespace
character.
2. True or False: The standard error file cannot be redirected.
3. What is the Linux end-of-file signal?
A. <Ctrl><f>
B. <Ctrl><e>
C. <Ctrl><d>
D. <Ctrl><l>
4. Which Linux command would redirect both stdout and
stderr to the same file?
A. command 1&2>output_file
B. command 1>2>output_file
C. stderr cannot be redirected
D. command >output_file 2>&1
5. Commands that take their input from the stdin and send
their output to the stdout are called _____________.
A. filters
B. standard files
C. pipe files
D. pipes
6. Which one of the following statements is not true about the
standard input and output channels in Linux?
A. These channels are viewed by Linux as files.
B. These channels cannot be detached from their normal
input/output files.
C. When a process is run, standard input and output channels
are opened.
D. The standard error file is attached to the screen.

Linux Operating System | V1.0 Nov 2013

Page 78 of 133

Unit 7 Linux Processes


At the end of this unit you will be able to:

Monitor the status of a Linux process.


Display information about processes running in a terminal.
Run Linux processes in the background.
Terminate processes.

7.1 Process status


Linux is a multitasking operating system, which means that it can run more
than one process at a time. Linux users are able to check on the status of
running programs and influence the running of those programs.
Any executing program is called a process, and has a unique Process
IDentification number (PID). Although Linux can schedule many processes,
in reality the CPU can handle only one process at a time. Linux switches
between processes very quickly, making it appear as though all the processes
are running simultaneously. Linux is called a time-sharing system because
many processes share CPU time.
To monitor the status of a process using the process status command:

Type ps [options] and press <Enter>.

When using the ps command:


If no options are specified, the command will display process status
information for all processes associated with your terminal.
Option a displays information about every process running on a terminal.
Option u displays information in a user-friendly format.
Option x displays processes that do not have a controlling terminal.
Option p PID displays information on a specific process number.
Four fields of information are generally shown by the ps command:

PID
Terminal name
Execution time used so far
Command name

Linux Operating System | V1.0 Nov 2013

Page 79 of 133

To display information about every process running on a terminal:

Type ps a and press <Enter>.

Open a terminal and query the processes running on the


system.
Experiment with some of the other ps commands, and
compare the different results.

7.2 Running processes in the background


Normally, an executing process must finish before another can be run, but it is
possible to run processes in the background, allowing the user to continue with
other work at the prompt. However, running too many processes in the
background can slow down the system so much that no time will be saved.
To prevent the output of background processes getting mixed up with the
output of foreground processes, redirect the output of the background
processes to a file.
To prevent other conflicts, do not run background
processes that require input from the keyboard.
The first prompt to be displayed after a background process has executed will
tell the user that the process is complete.
To run a process in the background:

Type command & and press <Enter>.

When issuing a command to run a process in the background, a PID is


displayed, and the user is returned to the prompt to continue with other work.

Run the find command for directory files on the root directory
in the background, and redirect the results to a file called
found and stderr to a file called errorlog so that they do not
come up on the screen.
(find / -type d >found 2>errorlog &)
Note the PID.
Check on running processes using the ps command.
Notice that now you have an additional process (compare with
the PID of the background process).
Note that you can go ahead and continue with other work in
the foreground (such as the ps command).
You can see how the contents of the found file have changed
using the more command. Use <Ctrl><c> to cancel the more
command if the listing gets too long.

Linux Operating System | V1.0 Nov 2013

Page 80 of 133

7.3 Terminating processes


There are times when it is necessary to terminate a process prematurely.
Linux uses a variety of signals to achieve this, such as the hangup, interrupt,
quit, terminate and kill signals.
When a user logs off, the system sends a hangup signal to all processes
related to that user and they are terminated. This may be useful if a system
seems to hang and does not respond to the keyboard.
To prevent a mistaken hangup signal from terminating your processes, use
the nohup command.
To protect processes from the hangup signal:

Type nohup command and press <Enter>.

The nohup command:


Allows a process to continue executing even if it receives a hangup
command.
Appends output to a file named nohup.out.
If a command is preceded by nohup, the process will execute even if the user
exits the terminal.
To protect a find process executing in the background:

Type nohup find / -type f & and press <Enter>.

After exiting a terminal window while the background process is running, the
user can view the results of that process by opening another terminal window.
To view the results of a protected process:

Type more nohup.out and press <Enter>.

If a user were to initiate two background processes that take a long time to
complete, protect one and not the other, note the PIDs of the two processes,
log off using the exit command, and open another terminal window the ps
command will show that the unprotected command had been terminated, but
not the protected process. However, this may be difficult to test because most
modern processors will complete the processes before a user can exit and
reopen the terminal window.
Pressing <Ctrl><c> will send an interrupt signal to halt an executing process
and return to the prompt. If the prompt is not at the start of a new line,
simply press <Enter>.
Linux Operating System | V1.0 Nov 2013

Page 81 of 133

Start running find in the foreground (find / -type d


print).
Interrupt the execution of the program by pressing
<Ctrl><c>.
Check the status using the ps command note that the
process is no longer running.

Commands that will not be stopped by the interrupt signal will sometimes be
stopped by the quit signal. Pressing <Ctrl><\> sends the quit signal.
Background processes are protected from interrupt and quit signals, so they
cannot be used to terminate misbehaving background processes. In cases like
this, you can use the termination signal together with the PID.
To terminate a background process:

Type kill PID and press <Enter>.

Run the find command in the background


(find / -type f >found 2>&1 &).
Note the PID allocated to the process.
Check this number among the process scheduled on your
terminal using the ps command.
Try sending the interrupt signal using <Ctrl><c>.
Check if it has stopped running using the ps command.
Now try sending the termination signal using kill PID.
Check if it has stopped running, using the ps command.

Some programs are even immune to the termination signal. In such cases,
use the kill signal. This signal always terminates any process that you own,
and is known as a sure kill. Use this signal as a last resort since processes
cannot trap it and clean up first.
To execute a sure kill:

Type kill 9 PID and press <Enter>.

To view all the signal numbers that can be used with the kill command:

Type kill l and press <Enter>.

Linux Operating System | V1.0 Nov 2013

Page 82 of 133

1. True or False: In Linux, every executing program has a


unique Process IDentification number.
2. True or False: Linux switches between processes very
quickly, making it appear as though all the processes are
running simultaneously.
3. True or False: Linux is called a time-sharing system because
many processes share CPU time.
4. True or False: A termination signal combined with a PID is
needed to halt processes running in the background.
5. The ________ command is used to monitor the status of a
process.
A. pm
B. ps
C. mon
D. chk
6. The process status command shows the terminal name, the
execution time used so far, the command name and the
___________.
A. process reference
B. inode number
C. PID
D. time remaining
7. A ____________ is an instance of a program that is currently
executing on the system.
A. parent
B. filter
C. process
D. command
8. A background process with a PID of 7865 is not responding to
software terminations signals. Which signal would you use to
halt its execution?
A. surekill 7865
B. kill 7865
C. ps 7865 -s
D. kill -9 7865

Linux Operating System | V1.0 Nov 2013

Page 83 of 133

Unit 8 Mozilla Firefox


At the end of this unit you will be able to:

List and describe the various features of Mozilla Firefox.


Configure Mozilla Firefox.

Firefox is an open source software project managed by the Mozilla Corporation,


and is the default web browser for Ubuntu Linux 12.04. Internet statistics
showed that Firefox occupied close to 20% of the global market share in web
browsers at the time of writing, which makes it the third most popular web
browser. You can study these figures on the following website:
http://en.wikipedia.org/wiki/Comparison_of_web_browsers
Although Firefox is generally associated with Linux, it has much popularity
among Windows users due to the number of special features it provides. After
using Firefox for a while, you might just find it hard to revert to using Internet
Explorer, although this is dependent on your preference. The next section will
look at the various features of Firefox.

8.1 The features of Mozilla Firefox


8.1.1 Its free!
Firefox is open source software, which means that it is free. Windows users
can download the latest version for free at www.mozilla.org.

8.1.2

Tabbed browsing

Firefox enables you to open multiple web pages in a single browser window,
using multiple tabs. You can configure your browser to open links in a new tab
instead of a new window. This is especially useful when you are researching a
single topic on a few different websites, and you are constantly switching
between pages to cross-reference your work.

8.1.3

Automatic spell check

Whether you are using Web-based email or updating your blog, Firefox has a
built-in spell checking mechanism that can prevent you from making any
embarrassing mistakes.

Linux Operating System | V1.0 Nov 2013

Page 84 of 133

8.1.4

Integrated search engines

In the top right hand corner, Firefox has a built-in search bar pre-loaded with
most of the common search engines, e.g. Google and Yahoo. You also have
the freedom to switch between any of these search engines, as well as add
your own engines from any of your favourite sites. When you are using Google
or Yahoo, a drop-down list will appear as soon as you start typing in the search
bar, making suggestions based on common keywords.

8.1.5

Session restoration

When your browser closes unexpectedly, Firefox can easily restore your
previous session. All the tabs you had open as well as any downloads that
were in progress, will be restored, which means that you will never lose your
place. Instead of loading your home page when you start up Firefox, you can
configure it to load your previous session.

8.1.6

Improved security

Firefox offers the following security features:

Anti-spyware protection
Phishing protection
Pop-up blocker
Sandbox security model: a sandbox is a mechanism that is used to run
untested code and programs safely from untrusted sources.
Firefox uses TLS (Transport Layer Security) and SSL (Secure Sockets
Layer) to provide secure communication with Web servers.

8.1.7

Fully customisable

You can customise your browser by installing various add-ons, such as


extensions and themes. There are hundreds of extensions to choose from,
such as Tab Effect, BlockSite, FoxLingo (translation tool), FoxyProxy and
ChatZilla.

8.1.8

Cross platform usability

Firefox provides support for Microsoft, Mac OS X and Linux systems.

8.1.9

Easy to update

Firefox is also updated on a regular basis, and you can configure your browser
to download and install free updates automatically.

Linux Operating System | V1.0 Nov 2013

Page 85 of 133

8.1.10

Support for multiple web standards

Firefox supports the following Internet standards:


Table 8.1 Firefox supported file types
HTML
(Hypertext Markup Language)

The most common markup language used to


create web pages.

XML
(Extensible Markup Language)

Generally used to describe data. When writing


in XML, you have to define your own tags, as
they are not predefined.

XHTML (Extensible Hypertext


Markup Language)

Similar to HTML language, also conforms to


XML standards.

SVG
(Scalable Vector Graphics)

An XML specification. SVG is a file format


used for describing 2D vector graphics.

CSS (Cascading Style Sheets)

Normally used to style web pages written in


HTML or XML.

ECMAScript

Also known as JavaScript or Jscript.

DOM
(Document Object Model)

An API (Application Programming Interface)


for HTML and XML documents.

MathML

An XML application aimed at integrating


mathematical formulae into web documents.

DTD
(Document Type Definition)

Defines the legal building blocks of an HTML


document.

XSLT (Extensible Stylesheet


language Transformations)

A language used to transform XML documents


into other XML documents.

XPATH (XML Path Language)

An expression language used


information in an XML document.

PNG
(Portable Network Graphics)

A graphics format created to improve and


replace GIF.

to

find

8.2 Configuring Mozilla Firefox


In this exercise, you will configure Mozilla Firefox as your
default Web browser. The setup information you will be given
in this exercise is only for demonstrative purposes. Setup
information will normally be provided by either your Internet
service provider or a network administrator.

Linux Operating System | V1.0 Nov 2013

Page 86 of 133

Start by clicking the Mozilla Firefox icon on the sidebar, typically below
the Home Folder icon. When you start Firefox for the first time, and your
computer has an Internet connection, you are greeted with an Ubuntu start
page displaying a Google search box and Ubuntu help, shop and community
links (Figure 8.1). If your lab or computer has Internet access available,
review the Ubuntu help and community pages for help and information
about Ubuntu, as well as how you can join the Ubuntu community. You can
reach this page from any computer with an Internet connection by going to
start.ubuntu.com.

Figure 8.1 Ubuntu Start Page

From the Edit menu along the top menu bar, select Preferences. On the
Firefox Preferences page (Figure 8.2) you can make all the configuration
changes needed to set up your browser.

Linux Operating System | V1.0 Nov 2013

Page 87 of 133

Figure 8.2 Main tab

On the General tab, you can configure the following settings:


o Startup You can either configure Firefox to show your preferred
homepage, a blank page, or the tabs and windows that were open in
your previous session.
o Downloads You can choose how Firefox manages downloads, i.e. how
to monitor them and where they should be saved.

On the Tabs tab (Figure 8.3), you can specify how Firefox should open new
pages. Firefox can either open pages in a new window or a new tab (refer
to section 4.1.2). The tab bar can be enabled by selecting Always show
the tab bar.

Linux Operating System | V1.0 Nov 2013

Page 88 of 133

There are various extensions that you can install to improve the
functionality of tabbed browsing:
o Tab Mix Plus Enables you to duplicate tabs and set tab clicking
options.
o Colorful Tabs Each tab is given a different colour to help you to
distinguish between open tabs.
o Tab Preview Hovering the mouse pointer over a tab will display its
contents.
o Tab Catalog Will show the contents of all tabs in a thumbnails-styled
list.
o PermaTabs You can turn your favourite tabs into permanent tabs
o TabRenamizer If you do not want nosy co-workers to see which tabs
you have open, you can easily rename your tabs.
o Tab Effect Adds transition effects to your tab bar when you switch
between tabs.

Figure 8.3 Tabs tab

Linux Operating System | V1.0 Nov 2013

Page 89 of 133

On the Content tab (Figure 8.4), you can specify how Firefox should display
the contents of web pages.

Figure 8.4 Content tab


o You can choose to have the browser block pop-up windows and prevent
it from automatically loading images. On both of these settings you can
add a list of websites that should be treated as exceptions to the rules.
o When you enable JavaScript (Figure 8.5), you can click on the
Advanced button to specify the level of control that these scripts have
within the browser window.

Linux Operating System | V1.0 Nov 2013

Page 90 of 133

Figure 8.5 Advanced JavaScript Settings


o The type and size of the default font can be changed. By clicking on the
Colors button, you can also specify the colour of backgrounds and links.

The Applications tab (Figure 8.6) allows you to specify what action Firefox
should perform when it encounters various file types, e.g. which application
it should use to open mp3 audio files.

Linux Operating System | V1.0 Nov 2013

Page 91 of 133

Figure 8.6 Applications tab

On the Privacy tab (Figure 8.7) you can specify how Firefox keeps track of
your browsing history. You can configure Firefox to remember visited
pages, data you have entered into online forms and search engines, as well
as any content that you have downloaded. You can also set Firefox to send
a Do Not Track request to websites, stopping them from tracking your
physical location and site activity, usually for targeted advertising purposes
(note that it is up to the website to support the standard for Do Not Track
requests and not always a given that a particular website does), as well as
configure cookie preferences and exceptions. The location bar, also called
an address bar, options refer to the suggestions displayed when you enter
partial addresses or website names into the bar.

Linux Operating System | V1.0 Nov 2013

Page 92 of 133

Figure 8.7 Privacy tab


o Cookies are text files that could contain personal information. These
files, stored in a special folder on your computer, are accessed by the
Web server each time you visit a website so that the page displayed is
exactly as you last left it (or customised it). They are also used to keep
records of your site preferences and even the contents of your online
shopping cart, as well as the location and website activity tracking
mentioned above. Cookies are sometimes seen as a security threat and
as an infringement of Internet privacy. As cookies are able to keep track
of user activity, they could inadvertently disclose personal information.
To manually configure how Firefox handles cookies, such as what cookies
are kept or to block cookies from specific websites, select the option to
Use custom settings for history under the History section. This will
reveal Firefoxs options for configuring what history is remembered, what
cookies are accepted, and for how long cookies are kept.
Linux Operating System | V1.0 Nov 2013

Page 93 of 133

o Recent history You can configure Firefox to automatically clear your


recent history when you close the browser, or you can clear it manually.
In the Clear Recent History option box (Figure 8.8), you can select
which specific sections of recent history you want to delete.
To manually clear recent history:

Select clear your recent history on the Privacy tab in Firefox


Preferences.
On the menu bar on the Firefox browser window, expand the Tools
menu, and select Clear Recent History.
Press <Ctrl><Shift><Del>.

Figure 8.8 Clear Recent History


As an aside, on the menu bar of the Firefox browser window, expand the
View menu and hover the mouse point over Sidebar. By selecting
History, you will be able to view your browsing history in a sidebar on
the main browser window. From there you can easily view all of your
recently visited websites, and quickly navigate back to them.
You can also expand the History menu from the menu bar of the Firefox
browser window, and select Show All History to have a new window
appear from which you can see a more detailed list of your browsing
history.
You can also restore previously closed browser tabs and
windows, or restore a previous sessions, from the History menu.

Linux Operating System | V1.0 Nov 2013

Page 94 of 133

On the Security tab (Figure 8.9) in Firefox Preferences, specify which


warning messages you want to receive while browsing the Internet. The
following options are available to you:
o Firefox can warn you when sites try to install add-ons. By clicking on the
Exceptions button, you can specify a number of sites that are allowed
to install add-ons.
o You can also be warned when Firefox suspects that you are visiting a
forged site, or a site reported to have recently been attacked (or hacked,
and therefore had its security compromised).
o You can choose whether Firefox should remember passwords for sites.
By clicking on the Exceptions button, you can specify a number of sites
that Firefox should remember passwords for. You also have the option
of using a master password that protects access to your stored
passwords in the Password Manager.

Figure 8.9 Security tab

Linux Operating System | V1.0 Nov 2013

Page 95 of 133

NOTE

Cross site forgery is a malicious exploitation of a known, trusted


website by another that lures users into entering private data which is
then accessed by a third party. This is also known as session riding
or a one-click attack.

On the Sync tab, you can set up a Firefox Sync account which is used by
Firefox to synchronise your browsing history, bookmarks, passwords and
open tabs across multiple devices and browsers.

The Advanced preferences page is split into a further four tabs (Figure
8.10), where you can configure general settings, specify how Firefox
connects to the Internet, manage updates, and configure the encryption
level you want to implement. The four tabs are:

Figure 8.10 Advanced tab


o General On this tab you can configure basic accessibility and browsing
settings, set Firefox as the default browser, and opt in or out of sending
crash reports and performance information.

Linux Operating System | V1.0 Nov 2013

Page 96 of 133

o Network On the Network tab, you can configure how Firefox connects
to the Internet, as well as clearing the cache and selecting the amount of
space in MB that should be reserved for cache. Caching documents
means storing temporary documents in memory for fast retrieval.
Caching helps to reduce bandwidth usage and server load.
Under Connection, select Settings. On the Connection Settings page
(Figure 8.11), you have three options:

You
You
You
You

can
can
can
can

connect directly to the Internet


have Firefox automatically detect network settings
have Firefox use existing system settings
manually connect to a proxy server

Figure 8.11 Connection settings

Linux Operating System | V1.0 Nov 2013

Page 97 of 133

NOTE

A proxy is a server on your network that receives and processes


requests from clients, and then forwards them on to another server.
If you are manually connecting to a proxy, ensure that you select the
option Use this proxy server for all protocols, as this will enable
you to access secure websites, e.g. Internet banking login pages.

o Update Here you can configure Firefox components to automatically


keep your search engines, used with the search bar on the main browser
window, up to date.
o Encryption Under Protocols (Figure 8.12), you can select which
encryption protocols to use. Ensure that both SSL 3.0 and TLS 1.0 are
selected. Under Certificates, you can leave the default settings.

Figure 8.12 Encryption

Linux Operating System | V1.0 Nov 2013

Page 98 of 133

Unit 9 Mozilla Thunderbird


At the end of this unit you will be able to:

Explain Bayes Theorem.


Explain the features of the Mozilla Thunderbird mail client.
Set up a test email account.

9.1 Introduction to Mozilla Thunderbird email


Mozilla Thunderbird, or just Thunderbird, is an open source groupware
application and is also the default email application for the Ubuntu 12.04
distribution. Thunderbird has many of the same features as other email
applications that you might have used before, such as Outlook and Evolution.
The next section will give you insight into some the most common features of
the Thunderbird mail client.

9.2 The features of Thunderbird


The features of Thunderbird include the following:

Intelligent junk mail control Thunderbird uses a Bayesian-based


filtering method to detect spam. Bayesian email filters utilise the Bayes
Theorem. Bayes Theorem states that the probability that an email is spam,
provided that it contains certain key words, is equal to the probability of
locating these key words in spam email, times the probability that any email
is spam, divided by the probability of finding these key words in any email,
i.e.:

A Bayesian spam filter looks at the following characteristics in an email:


o
o
o
o
o

the words in the body of a message


email headers
HTML code
word pairs and phrases
meta information

Linux Operating System | V1.0 Nov 2013

Page 99 of 133

Extensions and themes Thunderbird allows the addition of additional


features through the use of installable extensions. Lightning, which adds
calendar functionality to Thunderbird, is a popular extension. Themes, used
for changing the overall look and feel of Thunderbird, can also be installed.
Saved Search folders (virtual folders) This feature allows you to
create and save intelligent searches, using your own specified criteria. You
also have the ability to combine mail from different email accounts into a
single view.
Integrated security Thunderbird offers native support for security
features such as network encryption with SSL/TLS, digital signing and email
encryption using S/MIME (Secure/Multipurpose Internet Mail Extensions), as
well as additional features through the use of extensions.
Filters This feature enables you to organise mail, upon arrival or on
request, into various folders. You can also create multiple filters.
Improved searching Thunderbird automatically indexes emails to speed
up and improve searching.
Server support Thunderbird provides support for Microsoft Exchange
Server through the use of extensions, as well as GroupWise, and can act as
an Exchange or GroupWise client.
Multiple accounts Thunderbird enables you to receive, manage and
organise emails from multiple accounts or servers.

9.3 Setting up an email account


In this next exercise you will configure a test e-mail account in
order to familiarise yourself with the setup process of the
Thunderbird email client. The setup information you will be
given in this exercise is only for demonstrative purposes.
Setup information will normally be provided by either your
Internet service provider or a network administrator.

Click on the Dash Home button on the sidebar, and select Thunderbird
Mail (if Thunderbird Mail is not visible on the Dash Home screen, enter
thunderbird in the search bar and select Thunderbird Mail from the search
results).

On startup, Thunderbird will display the Welcome to Thunderbird window


(Figure 9.1), asking you if you would like to create a new email account.
Click the skip this and use my existing email button.

Linux Operating System | V1.0 Nov 2013

Page 100 of 133

Figure 9.1 Welcome to Thunderbird

On the Mail Account Setup page (Figure 9.2), fill in the your name and
email address fields, along with a password of your choosing. For the
sake of this exercise, you can fill in any name, email address, and
password.

Linux Operating System | V1.0 Nov 2013

Page 101 of 133

Figure 9.2 Mail Account Setup

Once you have entered your details, click Continue.

Thunderbird will now attempt to look up your email accounts email provider
and settings in order to complete the rest of the account setup
automatically. However, as this guide assumes that your computer does
not have Internet access and this exercise is only meant to demonstrate the
setup procedure, the attempt will fail. To continue with the account setup
you can either wait for the lookup to fail, or skip the lookup by clicking the
Manual config button.

The next step is to provide Thunderbird with incoming and outgoing mail
server settings (Figure 9.3):

For the incoming mail servers settings, select IMAP from the Incoming
drop-down list. IMAP stands for Internet Message Access Protocol, and
in most cases has taken over from POP3 (which stands for Post Office
Protocol 3) as most peoples standard Internet protocol for receiving email.

Enter a server hostname for the incoming mail server, such as


imap.ubuntu.com.

Select port 143 from the Port drop-down list, and None from the SSL
dropdown list (port 143 is the default port used for unencrypted IMAP
traffic).

Linux Operating System | V1.0 Nov 2013

Page 102 of 133

Under Authentication, select Normal password from the drop-down list.

For the outgoing mail servers settings, you may notice that SMTP is
already locked as the only option. SMTP stands for Simple Mail Transfer
Protocol, and is the standard Internet protocol for sending mail.

Enter server hostname, such as smtp.ubuntu.com, and select port 587


for the outgoing mail server. Port 587 is typically used by mail clients to
send mail, while port 25 is used by mail servers to transfer mail to and
between other mail servers, though mail clients can, in most cases, also
make use of port 25 to send mail.

For the outgoing mail servers SSL and Authentication drop-down lists,
select None and Normal password, respectively.

In the Username field, enter your email address (the same one used
earlier) and click Done.

Figure 9.3 Mail Server Settings

A Warning message will now appear (Figure 9.4), warning you that your
mail settings do not make use of encryption. This is, of course, a very
insecure way of configuring an email account, especially given the
revelations regarding information security and the scope of surveillance by
government intelligence agencies in recent times. However, in this case we
are lucky in that the account being set up (probably) does not exist, nor is it
likely to be used at all (let alone spied upon). Ignore the warning by
checking the I understand the risks checkbox and then clicking Done.

Linux Operating System | V1.0 Nov 2013

Page 103 of 133

Figure 9.4 Warning!

You will now be


will attempt to
server settings.
and the account

returned to the Mail Account Setup page, and Thunderbird


check your password and verify your account and mail
However, as this computer is not connected to the Internet
itself is a fake, the verification will fail (Figure 9.5).

Figure 9.5 Verification failure

To get around Thunderbirds online verification checks, click on Advanced


config to open Thunderbirds Account Settings page (Figure 9.6). From
here, simply click OK and the account setup will be complete.

Linux Operating System | V1.0 Nov 2013

Page 104 of 133

Figure 9.6 Account Settings

9.4 Personalising Thunderbird and configuring account


settings
After you have added your account to Thunderbird, you can personalise the
account settings to suit your specific preferences. You can open Thunderbirds
account settings by expanding the Edit menu from the top menu bar and
selecting Account Settings (see Figure 9.6 above). These options allow you
to configure preferences such as how Thunderbird handles junk mail, manage
how disk space is used, configure an account signature and display name, the
various server settings that you configured previously, set archival
preferences,
settings
regarding
composition
behaviour,
account
synchronisation, and more. You can also use the Account Actions menu to
add and delete accounts.
You can also configure Thunderbird Preferences, which can be used to
customise the look and feel of Thunderbird, expanding the Edit menu from the
top menu bar and selecting Preferences. The console is laid out much like
Firefoxs preferences:
along the top of the window you will see tabs
representing different categories of options (as listed in the table below), and
just below that you will be able to configure the various settings for the
selected category.

Linux Operating System | V1.0 Nov 2013

Page 105 of 133

Table 9.1 Thunderbird account preferences


On this tab you can configure options such as Thunderbirds
default start page, and how Thunderbird alerts you to the
arrival of new messages.
This tab contains options for settings Thunderbirds default
font, colours, emoticon settings, plain text message quoting
options, and message tags.
Here you can set options such as how often drafts are autosaved, the default font and colour options for HTML messages,
auto-completion options, and spell check options.
This tab includes options for setting how Thunderbird connects
to chat accounts, and auto-away settings.
On this tab you can set junk message options, whether
Thunderbird checks messages for scams, allow anti-virus
clients to quarantine messages, the passwords that
Thunderbird remembers, and cookie and tracking settings.
This tab allows you to set how Thunderbird handles
attachments, like the default behaviour for attachments on
incoming and outgoing messages.
Here you can set return receipt, scrolling, search, message
reading and display options. There are also network, disk
space, update and certificate settings.

Linux Operating System | V1.0 Nov 2013

Page 106 of 133

Unit 10 More Applications


At the end of this unit you will be able to:

Describe the five main LibreOffice applications.


Explain the role of the GIMP application.
Configure the Linux workspace switcher.

10.1 LibreOffice
LibreOffice 3.5 (Figure 10.1) is the default presentation, word processing,
database, spreadsheet and diagramming application for Ubuntu Linux, and
comes standard with the 12.04 distribution. The LibreOffice applications are
very similar to the Microsoft Office applications. You will notice that the menus
are very similar to those found in MS Office applications, e.g. File, Edit, Insert,
Format and Tools.

Figure 10.1 LibreOffice

Linux Operating System | V1.0 Nov 2013

Page 107 of 133

10.1.1 Word processing


LibreOffice Writer (Figure 10.2) is the default word processing application for
Ubuntu 12.04.

Figure 10.2 LibreOffice Writer

Linux Operating System | V1.0 Nov 2013

Page 108 of 133

10.1.2

Spreadsheets

The LibreOffice Calc programme (Figure 10.3) is the equivalent of Microsoft


Excel. The layout is very similar, e.g. the naming of rows and columns, the
bar that is used to perform calculations, and the ability to switch between
different sheets.

Figure 10.3 LibreOffice Calc

Linux Operating System | V1.0 Nov 2013

Page 109 of 133

10.1.3 Databases
LibreOffice Base (Figure 10.4) is the open source equivalent of Microsoft
Access. However, in an effort to reduce Ubuntus overall installation footprint,
it is not actually included with the default Ubuntu 12.04 Desktop installation.
This application has the same functionality as Access, i.e. you can create
Tables, Queries, Forms and Reports.

Figure 10.4 LibreOffice Base

Linux Operating System | V1.0 Nov 2013

Page 110 of 133

10.1.4 Presentations
LibreOffice Impress (Figure 10.5) is the open source equivalent of Microsoft
PowerPoint. This application has the same functionality as PowerPoint, i.e. you
can create colourful slides, add animation effects to the graphics and headings,
and set transition effects between slides.

Figure 10.5 LibreOffice Impress

Linux Operating System | V1.0 Nov 2013

Page 111 of 133

10.1.5 Diagrams
LibreOffice Draw (Figure 10.6) is the open source equivalent of Microsoft Visio.
This vector graphics editor has much of the same functionality as Visio, i.e. you
can draw technical diagrams, create large scale posters, and build dynamic 3D
illustrations.

Figure 10.6 LibreOffice Draw

Linux Operating System | V1.0 Nov 2013

Page 112 of 133

10.2 GNU Image Manipulation Program (GIMP)


GIMP is a comprehensive open source application for editing images (Figure
10.7) and has traditionally been the standard image editing application for
Ubuntu Linux. However, like LibreOffice Base, in an effort to reduce Ubuntus
installation size it is no longer included with the standard Ubuntu 12.04
Desktop installation.
GIMP has the same functionality as Microsoft Paint, except that it is a far more
advanced editing application, in truth coming closer to Adobes Photoshop in
terms of features and functionality.

Figure 10.7 GIMP

Linux Operating System | V1.0 Nov 2013

Page 113 of 133

10.3 The Workspace switcher


The multiple workspaces of Linux means the user is not restricted to a single,
cluttered desktop. For example, a Linux user can open related documents and
applications on some workspaces, while continuing to work on other
workspaces that are clean and uncluttered. However, there may be some
applications or tools such as the calculator that a user would like to be
available on all workspaces.
Clicking on the Workspace icon on the bottom of the Ubuntu sidebar (or
pressing the <Windows><S>, also referred to as Super-s) will change the
desktop to a zoomed-out view of the four available workspaces (four is the
default number of workspaces, though this number, as well as other interface
elements, can be changed and configured through the use of an additional
application such as Ubuntu Tweak, MyUnity or CompizConfig Settings
Manager). Here you can see a thumbnail view of all four workspaces, and
switch to whichever workspace you like by clicking on it (Figure 10.8). You
can also configure keyboard shortcuts via Ubuntus system settings to quickly
switch between and move windows between different workspaces.

Figure 10.8 Workspaces

Linux Operating System | V1.0 Nov 2013

Page 114 of 133

1. True or False: Firefox can be configured to restore your


windows and tabs from your previous session.
2. Name the graphics format that was created to improve and
replace GIF.
3. True or False: The Thunderbird email client can only function
as a Microsoft Exchange client.
4. Which of the following is also known as JavaScript?
A. DTD
B. SVG
C. DOMScript
D. ECMAScript
5. True or False: Applications can be made available on multiple
workspaces on the Linux desktop.
6. True or False: The use of Mozilla Firefox is restricted to the
Ubuntu Linux operating system.
7. True or False: The Thunderbird mail client can be configured
to receive emails from more than one account.

Linux Operating System | V1.0 Nov 2013

Page 115 of 133

Answers
Unit 1

Unit 2

1)
2)
3)
4)
5)
6)
7)

1)
2)
3)
4)
5)
6)
7)

True
True
True
A
C
B
A

True
True
False
A
D
C
C

Unit 3

Unit 4

1)
2)
3)
4)
5)
6)
7)
8)
9)

1)
2)
3)
4)
5)

True
C
True
A
Syntax
Command
Option
Argument
B

A
ls i
ls a
mkdir mysub
A

Unit 5

Unit 6

1) False
2) True
3) C
4) D
5) D
6) True
7) False
8) False
9) True
10)
True
11)
True
12)
D
13)
A
14)
C
15)
B
16)
B
17)
A
18)
B
19)
D
20)
C
21)
B

1)
2)
3)
4)
5)
6)

Linux Operating System | V1.0 Nov 2013

False
False
C
D
A
B

Unit 7
1)
2)
3)
4)
5)
6)
7)
8)

True
True
True
True
B
C
C
D

Page 116 of 133

Unit 10
1)
2)
3)
4)
5)
6)
7)

True
PNG
False
ECMAScript
True
False
True

Linux Operating System | V1.0 Nov 2013

Page 117 of 133

Unit 11 Theory and Practical Examinations


The Linux Operating System module consists of a theory examination and a
practical examination.
It is recommended that you practise doing the
exercises in the study guide as much as possible to improve your chances of
passing both examinations.

11.1 Theory examination


The theory examination will be made up of various types of questions from all
the sections in the study guide.

11.2 Practical examination


Please take note of the following regarding the practical examination:
You must know how to perform various tasks at the command line.
You are expected to know how to configure various applications, e.g. Mozilla
Firefox and Thunderbird.

Linux Operating System | V1.0 Nov 2013

Page 118 of 133

Exercise Checklist
ULNXC-14 V1.0
Student:

Start date:

Student, please note that unless all of the exercises in this study guide have
been completed and signed off by an lecturer, you will not be allowed to write
the Linux Operating System examination.
Date

Sign

Unit 1
Exercises
Unit 2
Exercises
Unit 3
Exercises
Unit 4
Exercises
Unit 5
Exercises
Unit 6
Exercises
Unit 7
Exercises
Unit 8
Exercises
Unit 9
Exercises
Unit 10
Exercises

Linux Operating System | V1.0 Nov 2013

Page 119 of 133

Glossary
Term

Definition

See Root folder (/).

Absolute
pathname
Accelerated-X

A pathname that identifies a particular file uniquely.

Afterstep

A popular window manager. See also Window manager.

Android

A Linux distribution made for use on mobile devices.


See also Distribution; Linux.

Applications

See Utilities.

Assembly
language

The language in which Unix was originally written; fast


and able to interact directly with computer hardware.

Bash

See Bourne-again shell (bash).

Bayes Theorem

A theorem for calculating the probability of an email


being spam.

Bayesian email
filters

Email filters that make use of Bayes Theorem to


determine whether an email is to be filtered as spam or
not. See also Bayes Theorem.

Binary data files

Store information such as functions and graphics.

Bourne shell
(sh)

An early command line shell created by Stephen


Bourne; provides little help to the user. See also
command line shell.

Bourne-again
shell (bash)

A widely-used, feature-rich, user-friendly command line


shell for Linux developed from the Unix Bourne and C
shells by the GNU project. See also Boune shell (sh); C
shell (csh); command line shell; GNUs Not Unix (GNU);
Linux; Unix.

C language

A programming language in which Unix was rewritten in


the early 1970s.

C shell (csh)

A command line shell derived from the syntax of the C


programming language and written at Berkley. See also
C language.

Command
interpreters

See Command line shells.

A popular commercial X Server. See also X Server.

Linux Operating System | V1.0 Nov 2013

Page 120 of 133

Term

Definition

Command line
shells
Command mode

Used to issue commands to the shell and provide full


access to the system. See also Shell.
The starting mode of vim and vi; allows commands to
be executed. See also Vi; Vim.

Data blocks

A part of the Linux file system where the actual data is


stored. See also Linux file system.

Debian

A common Linux distribution which forms the foundation


of the Ubuntu distribution. See also Distribution; Linux;
Ubuntu.

Demand-paged
virtual memory

A system of virtual memory that allows the system to


run programs requiring more memory than the available
system RAM.

Desktop
environments

Provide a complete, integrated X Windows system,


ensuring a consistent look and feel across applications.
See also X Windows system.

Desktop
managers
Directory files

See Desktop environments.

Distribution

Different variations of Linux installations, including


differing desktop environments or applets. See also
Desktop environment.

Edubuntu

A variation of the Ubuntu Linux distribution. See also


Distribution; Linux; Ubuntu.

Enhanced C shell
(tcsh)

A version of the C shell with additional user-friendliness.


See also C shell (csh).

Enlightenment

A popular window manager. See also Window manager.

Error channel

Specifies the destination to which error messages


should be sent.

Evolution

An Open Source GroupWare application and the default


email application for the Ubuntu Linux distribution. See
also Distribution; Linux; Open Source; Ubuntu.

Executable
program files

Files that exist on the hard drive until they are executed
in memory to become processes.

Serve as storage space to organise other files.

Linux Operating System | V1.0 Nov 2013

Page 121 of 133

Term

Definition

Execute
permissions

A category of permissions specifying whether a file or


directory may be run or changed to and searched.

F Virtual Window A popular window manager. See also Window manager.


Manager (VWM)
Fedora
File descriptor
numbers

A popular Linux distribution. See also Distribution;


Linux.
Numbers that have been assigned to the input, output,
and error channels. See also Error channel; Input
channel; Output channel.

File permissions
(ordinary,
directory, block,
character
device)

Control access to ordinary and directory files.

Filter programs

See Filters.

Filters

Commands that take their input from the standard input


and send their output to the standard output. See also
Standard input; Standard output.

Firefox

An Open Source software project managed by the


Mozilla Corporation and the default web browser for
Ubuntu Linux. See also Open Source; Ubuntu.

Freedom toaster

A project aimed at making it easier to access Open


Source software. See also Open Source.

FVWM

See F Virtual Window Manager (VWM).

General Image
Manipulation
Program (GIMP)

A comprehensive open source application for editing


images.

GIMP

See General Image Manipulation Program (GIMP).

GNOME

See GNU Network Object Model Environment (GNOME).

GNU Network
Object Model
Environment
(GNOME)

The default desktop environment for Ubuntu, Debian


and Fedora Linux distributions. See also Debian;
Desktop environments; Distribution; Fedora Core;
Linux; Ubuntu.

Linux Operating System | V1.0 Nov 2013

Page 122 of 133

Term

Definition

Gobuntu

A variation of the Ubuntu Linux distribution. See also


Distribution; Linux; Ubuntu.

Graphical User
Interface (GUI)
shells

A virtual desktop that a user can interact with, through


the use of a mouse and icons, to carry out tasks.

Group
permissions

A class of permissions specifying permissions assigned


to the group to which the owner of a file belongs.

GUI shells

See Graphical User Interface (GUI) shells.

IceWM

A popular window manager. See also Window manager.

Inode area

A set of blocks next to each other on the file system


that contains a table listing all of the inode numbers for
the system. See also Inode numbers; Linux file system.

Inode numbers

Numbers used to track file information within the file


system. See also Linux file system.

Input channel

Specifies the source from which input should be taken.

K Desktop
Environment
(KDE)

A popular, free desktop environment. See also Desktop


environments.

KDE

See K Desktop Environment (KDE).

Kernel

Thought of as the heart of an operating system;


communicates directly with system hardware.

Kubuntu

A variation of the Ubuntu Linux distribution. See also


Distribution; Linux; Ubuntu.

Linked files

Files that are associated with one another.

Linux

A multi-user, multitasking and open source operating


system. See also Open Source.

Linux file system

The file system for the Linux operating system,


comprising the superblock, inode area and data blocks.
See also Data blocks; Inode area; Superblock.

Linux terminal

A Linux command line interpreter. See also Command


line interpreter.

Linux Operating System | V1.0 Nov 2013

Page 123 of 133

Term

Definition

Live CD

A CD from which a user can boot an operating system


without having to install the operating system or format
their hard drive.

Mageia

A popular Linux distribution. See also Distribution;


Linux.

Metro-X

A popular commercial X Server. See also X Server.

Minix

An educational version of Unix, written in the 1980s by


Andrew Tanenbaum.

Mint

A popular Linux distribution. See also Distribution;


Linux.

Multics

A predecessor to Unix.

Multitasking

Refers to the ability of an operating system to run


multiple processes at a time.

Named pipes

The channel that passes information from one process


in memory to another.

Open source

Refers to software that is freely available to be used and


modified by anyone.

LibreOffice

The default presentation, word processing, database


and spreadsheet application for Ubuntu Linux. See also
Linux; Ubuntu.

Other
permissions

A class of permissions specifying permissions assigned


to users who are not the file owner and do not belong to
the same group as the file owner.

Output channel

Specifies the destination to which output should be sent.

Partial pathname See Relative pathname.


Partitioner

A utility that scans the hard disks in a computer and


detects the current file system.

PID

See Process Identification number (PID).

Pipelines

String commands together so that the standard output


of one command becomes the standard input of the
next. See also Standard input; Standard output.

Linux Operating System | V1.0 Nov 2013

Page 124 of 133

Term

Definition

Pre-emptive
multitasking

A system of multitasking whereby the operating system


controls tasks and the allotment of clock cycles to
applications.

Process
Identification
number (PID)

A unique identification number,


process running on the system.

Protected
process

Refers to a process that has been protected so that it


will continue running even if the executing terminal
window has been closed or the executing user logged
off and back on again.

Read
permissions

A category of permissions specifying whether a file or


directory may be viewed.

Redirection

The practice of altering the standard input, output or


error channels to other files.

Relative
pathname

A pathname that begins with the current directory and


describes the path to a file from there.

Root folder (/)

The base of the Linux file system.

Root user

A privileged account that is used to maintain the Linux


system.

Sampling

Refers to the process of sampling the data at a point in


a pipeline. See also Pipelines.

Search for Files


tool

A tool provided by the GNOME desktop for finding files


and folders in the Linux file system. See also GNU
Network Object Model Environment (GNOME).

sh

See Bourne shell (sh).

shell

Provides an interface between the user and the kernel.


See also Kernel.

Shell
metacharacters

Characters used in the command line prompt in a Linux


terminal.

Slackware

A popular Linux distribution. See also Distribution;


Linux.

Socket files

A named pipe file that allows a process on another


computer to write to a file on the local computer while

Linux Operating System | V1.0 Nov 2013

assigned

to

each

Page 125 of 133

Term

Definition

another process reads from the file.


Special device
files

Files representing various system devices.

Standard error

Refers to the file that Linux uses as the error channel.


See also error channel.

Standard input

Refers to the file that Linux uses as the input channel.


See also input channel.

Standard output

Refers to the file that Linux uses as the output channel.


See also output channel.

Stderr

See Standard error.

Stdin

See Standard input.

Stdout

See Standard output.

Sudo

A prefix that allows authorised users to run commands


requiring administrative privileges.

Sudoers

A group of users who have administrative privileges.

Superblock

An area of the Linux file system containing static data


used to control the whole file system. See also Linux file
system.
See Root user.

Superuser
Suse

A popular Linux distribution. See also Distribution;


Linux.

Text files

Usually contain configuration information.

Text entry mode

The mode in vim and vi that allows a user to add text to


a file.

Thunderbird

An Open Source GroupWare application and the default


email application for the Ubuntu Linux distribution. See
also Distribution; Linux; Open Source; Ubuntu.

Ubuntu

A popular Linux distribution headed by a group of Open


Source developers started by Mark Shuttleworth and
based on a strong Debian foundation. See also Debian;
Distribution; Linux; Open Source.

Linux Operating System | V1.0 Nov 2013

Page 126 of 133

Term

Definition

Unix

An operating system written by Ken Thompson, Brian


Kernighan and Dennis Richie in Assembly language at
Bell Laboratories the late 1960s as a replacement for
Minix and later rewritten in C. See also Assembly
language; C language; Minix.

User permissions A class of permissions specifying permissions assigned


to the owner of a file.
Utilities

Executable programs written to do particular jobs well.

Vi

A text editor that can be used to create and modify


documents.

Vim

A text editor that provides additional user-friendly


features over vi. See also Vi.

Window
manager

The component that controls the appearance of the


windows in an X Windows environment. See also X
Windows.

Workspace
switcher

An application included with Ubuntu Linux that allows


the user to work on multiple desktops.

Write
permissions

A category of permissions specifying whether a file or


directory may be changed.

X Server

Sets up the graphics display and displays desktop


elements.

X Windows

Provides the Graphical User Interface and windowing


environment for Linux systems.

XFree86

A popular free and open source X Server. See also Open


Source; X Server.

Xubuntu

A variation of the Ubuntu Linux distribution. See also


Distribution; Linux; Ubuntu.

Linux Operating System | V1.0 Nov 2013

Page 127 of 133

Linux Operating System Evaluation Form


ULNXC-14 V1.0
How would you evaluate the Linux Operating System study guide? Place a
or in one of the five squares that best indicates your choice. Your response
will help us to improve the quality of the study guides and modules, and will be
much appreciated.
Very
poor

Poor

Fair

Good

Excellent

The study guide is clear and understandable.


The exercises help you to grasp the course
material.
You know what to expect in the examinations.
The practical exercises test your knowledge and
ability.
Your lecturer was able to help you.
What did you enjoy most?

What did you enjoy least?

General comments (what would you add, leave out, etc.?).

Please note any errors that you found in the study guide.

Campus:

Lecturer:

Date:

Please remove this evaluation form and return it to your lecturer so that it can
be forwarded to the Division for Courseware Development. Thank you.

Linux Operating System | V1.0 Nov 2013

Page 128 of 133

Bedfordview Campus
1st Floor, 14 Skeen Boulevard
Bedfordview, 2008
P.O. Box 1389, Bedfordview, 2008
Tel: +27 (0)11 450 1963/4, Fax: +27 (0)86 686
4950
Email: bedfordview@cti.ac.za

Bloemfontein Campus
Tourist Centre, 60 Park Avenue,
Willows, Bloemfontein, 9301
P.O. Box 1015, Bloemfontein, 9300
Tel: +27 (0)51 430 2701, Fax: +27 (0)51 430 2708
Email: bloemfontein@cti.ac.za

Cape Town Campus


The Brookside Building, 11 Imam Haron Street
(old Lansdowne Road), Claremont, 7708
P.O.Box 2325, Clareinch, 7740
Tel: +27 (0)21 674 6567, Fax: +27 (0)21 674
6599
Email: capetown@cti.ac.za

Durban Campus
59 Adelaide Tambo Drive (old Kensington Drive)
Durban North, 4067
P.O. Box 20251, Durban North, 4016
Tel: +27 (0)31 564 0570/5, Fax: +27 (0)31 564
8978
Email: durban@cti.ac.za

Durbanville Campus
Kaapzicht, 9 Rogers Street, Tyger Valley, 7530
P.O. Box 284, Private Bag X7
Tyger Valley, 7536
Tel: +27 (0)21 914 8000, Fax: +27 (0)21 914
8004
Email: durbanville@cti.ac.za

East London Campus


12 Stewart Drive, Berea, East London, 5241
PostNet Suite 373
Private Bag X9063, East London, 5200
Tel: +27 (0)43 721 2564, Fax: +27 (0)43 721 2597
Email: eastlondon@cti.ac.za

Nelspruit Campus
50 Murray Street
Nelspruit, 1200
P.O. Box 9497, Sonpark, Nelspruit, 1206
Tel: +27 (0)13 755 3918, Fax: +27 (0)13 755
3918
Email: nelspruit@cti.ac.za

Port Elizabeth Campus


Building 4, Ascot Office Park
Cnr Ascot & Conyngham Roads, Greenacres,
6065
P.O. Box 40049, Walmer, 6065
Tel: +27 (0)41 374 7978, Fax: +27 (0)41 374 3190
Email: port_elizabeth@cti.ac.za

Potchefstroom Campus
16 Esselen Street
Cnr Esselen Street & Steve Biko Avenue
Die Bult, Potchefstroom, 2531
P.O. Box 19900, Noordbrug, 2522
Tel: +27 (0)18 297 7760, Fax: +27 (0)18 297
7783
Email: potchefstroom@cti.ac.za

Pretoria Campus
Menlyn Corporate Park, Building A
175 Corobay Avenue (Cnr Garsfontein), Pretoria,
0181
PostNet Suite A147, Private Bag X18
Lynnwood Ridge, 0040
Tel: +27 (0)12 348 3060, Fax: +27 (0)12 348 3063
Email: pretoria@cti.ac.za

Randburg Campus
6 Hunter Avenue, Cnr Bram Fischer Drive
Ferndale, Randburg, 2194
P.O. Box 920, Randburg, 2125
Tel: +27 (0)11 789 3178, Fax: +27 (0)11 789
4606
Email: randburg@cti.ac.za

Vanderbijlpark Campus
Building 2, Cnr Rutherford & Frikkie Meyer Blvds
Vanderbijlpark, 1911
P.O. Box 6371, Vanderbijlpark, 1900
Tel: +27 (0)16 931 1180, Fax: +27 (0)16 933 1055
Email: vanderbijlpark@cti.ac.za

Group Head Office


Fourways Manor Office Park, Building 1
Cnr Roos & Macbeth Streets, Fourways, 2191
P.O. Box 1398, Randburg, 2125
Tel: +27 (0)11 467 8422, Fax: +27 (0)11 467
6528
Website: www.cti.ac.za

You might also like