You are on page 1of 71

STUDY GUIDE

CBLX3103
Introduction to Linux

Copyright © Open University Malaysia (OUM)


STUDY GUIDE CBLX3103 Introduction to Linux

STUDY GUIDE
CBLX3103
Introduction to Linux

Writer: Mohd Saufy Rohmad


University Teknologi MARA

Developed by: Centre for Instructional Design and Technology


Open University Malaysia

First Edition, August 2017


Copyright © Open University Malaysia (OUM), August 2017, CBLX3103
All rights reserved. No part of this work may be reproduced in any form or by any means
without the written permission of the President, Open University Malaysia.

1 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Copyright © 2
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

INTRODUCTION TO STUDY GUIDE


This Study Guide is intended for Open University Malaysia's CBLX3103
Introduction to Linux course. It comes in TWO parts, as described below:

Part One comprises the Course Introduction, which gives you an overview
of the course. More specifically, it provides you with the course synopsis,
objectives, learning outcomes and study load. There is a brief description of
the main textbook which you must read to fulfill the course requirements.
There is also a list of additional reading references. You are encouraged to
go into myINSPIRE to check out the assessment, assignment and final
examination formats.

Part Two comprises the Learning Guide. This starts with an overview, a
recommended weekly study schedule to guide your learning process and a
brief description of the various elements in the Learning Guide. There is also
a list of topics to be covered. For each topic, you are given the specific
learning outcomes, a topic overview and a listing of the focus areas together
with assigned readings and the pages where information on the focus areas
is found. To consolidate your learning and to test your understanding, a
summary of the main content covered and study questions are provided at
the end of each topic.

Finally, there are two appendices, Learning Support and Study Tips, to
help you walk through the course successfully.

Please read through this Study Guide before you commence your course.
We wish you a pleasant study experience.

3 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Contents
Part One: Course Introduction ................................................................... 5
Synopsis ............................................................................................ 5
Objectives .......................................................................................... 5
Learning Outcomes ........................................................................... 6
Study Load ......................................................................................... 6
Main Textbook ................................................................................... 6
Assessment ....................................................................................... 6

Part Two: Learning Guide ........................................................................... 7


Overview ............................................................................................ 7
Topic 1: Introduction to Operating System (OS) ................................ 9
Topic 2: Investigating Linux’s Principles and Philosophy................. 13
Topic 3: Understanding Software Licensing .................................... 17
Topic 4: Using Common Linux Programs ........................................ 21
Topic 5: Managing Hardware ........................................................... 26
Topic 6: Getting to Know the Command Line .................................. 30
Topic 7: Managing Files ................................................................... 34
Topic 8: Getting Help ....................................................................... 37
Topic 9: Using Program and Process .............................................. 40
Topic 10: Searching, Extracting and Archiving Data........................ 44
Topic 11 Editing Files ...................................................................... 47
Topic 12: Creating Scripts................................................................ 51
Topic 13: Understanding and Creating Users and Groups .............. 54
Topic 14: Setting Ownership and Permission .................................. 58
Topic 15: Navigating Linux File System ........................................... 61
Topic 16: Managing Network Connections ...................................... 63

Appendices ................................................................................................ 67
Appendix A: Learning Support ......................................................... 67
Appendix B: Study Tips ................................................................... 68

Copyright © 4
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

PART ONE: COURSE INTRODUCTION

Synopsis

This course introduces the basics of Linux operating system. Operating


system is the core software that integrates the hardware and software,
hence the efficiency of the operating system is very crucial for total computer
system performance and acceptance. This Study Guide will guide you
through the Linux operating system, the best operating system on Earth.
Why I say Linux is the best is because of the openness of the codes and the
availability of the entire manual on the net. When it is widely accessible, it
will be more secure because the people who are using and modifying its
source codes are not only limited to the official programmers of Linux but the
entire community of Linux programmers!

The main point to remember is that this course is intended to be a practical


course. Get your Linux installed and run the command. Run it, experience it,
feel it and understand how it works! Get your Linux virtual machine running,
get your USB bootable Knoppix running, get your hands dirty and feel the
satisfaction of real command line and open source enthusiast!

Let us begin!

Objectives

The general aims of this course are to:

1. Introduce learners to the Linux operating system as an operating


system that can be used daily for working, entertainment and education
purposes;

2. Introduce learners to the attributes and main features of Linux; and

3. Familiarize learners with the basic Linux command line to enable them
to further explore the power behind the Linux operating system.

5 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Learning Outcomes

By the end of this course, you should be able to:

1. Appreciate the beauty of Linux;

2. Explain the use of Linux and its vast capabilities; and

3. Competently write basic Linux commands.

Study Load

It is standard OUM practice that learners accumulate 40 study hours for


every credit hour. As such, for a three-credit hour course, you are expected
to spend at least 120 hours of learning. Table 1 gives an estimation of how
the 120 hours can be accumulated.

Table 1: Allocation of Study Hours

Activities No. of Hours


Reading the module and completing the exercises 60
Attending 4 tutorial sessions (2 hours for each session)* 8
Engaging in online discussions 17

Completing assignment(s) 20
Revision 15
Total 120
* Unless otherwise specified

Main Textbook

Smith, R. W. (2012). Linux essentials. Indianapolis, IN: John Wiley & Sons.

Assessment

Please refer to myINSPIRE for information on the assessment format and


requirements.

Copyright © 6
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

PART TWO: LEARNING GUIDE

Overview

This Learning Guide is arranged by topic. It covers essential content in the


main textbook and is organized to stretch over TEN study weeks before the
examination period begins. Use this Learning Guide to plan your
engagement with the course content. You may follow the recommended
weekly study schedule in Table 2 to help you progress in a linear fashion,
starting with Week 1.

Table 2: Recommended Weekly Study Schedule

Topic Week
Topic 1: Introduction to Operating System 1
Topic 2: Investigating Linux’s Principles and Philosophy
Topic 3: Understanding Software Licensing
Topic 4: Using Common Linux Programs 2
Topic 5: Managing Hardware
Topic 6: Getting to Know the Command Line 3
Topic 7: Managing Files
Topic 8: Getting Help 4
Topic 9: Using Program and Process
Topic 10: Searching, Extracting and Archiving Data 5
Topic 11: Editing Files 6
Topic 12: Creating Scripts 7

Topic 13: Understanding and Creating Users and Groups 8


Topic 14: Setting Ownership and Permission
Topic 15: Navigating the Linux File System 9

Topic 16: Managing Network Connections 10

7 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Each topic in the Learning Guide comprises the following sections (refer to
Figure 1):

• Learning Outcomes: Outline the specific tasks to be accomplished;

• Topic Overview: Briefly explains what the topic touches on so as to


provide a general interpretative framework for understanding the topic
content;

• Focus Areas: Identify the main and sub areas to be covered;

• Assigned Readings: Help you to navigate the main textbook and reading
materials;

• Content Summary: Provides an interpretative framework for understanding


the core content; and

• Study Questions: Help learners focus on key subject areas.

Figure 1: Organisation of the learning guide

Copyright © 8
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 1: Introduction to Operating Systems (OS)

Learning Outcomes

By the end of this topic, you should be able to:

1. Define an operating system;

2. Describe the factors influencing the choice of an operating system;

3. List the differences of the Linux operating system as compared to


Windows and Mac operating systems; and

4. Describe five types of Linux distributions.

Topic Overview

This topic provides an overview of the operating system (OS). It highlights


the definition and basic issues of an OS such as what is an OS, how do
users interact with an OS, how does Linux OS compare against other OS
and how do specific Linux implementations vary from other OS.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

1.1 What is an OS? Chapter 1, pp 1–3

1.2 Investigating user interfaces Chapter 1, pp 4–7

1.3 Where does Linux fit in the OS Chapter 1, pp 43–48


world?

1.4 What is a distribution? Chapter 3, pp 98-99

9 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Content Summary

1.1 Operating system (OS) is the software that we use when we boot the
computer. We interact with application software through OS interface.
However, the selection of an OS depends on the purpose the OS is
used for. Users generally choose an OS that is very user-friendly and
stable. On the server side, the OS needs to be stable, secure and easy
to manage without sacrificing its stability and security. For developers,
OS needs to be open, stable and customizable.

1.2 Do we have an OS that is suitable for all purposes? Linux is the one of
them. It is open source, fully customizable (with some technical cost of
course), secure and has user-friendly graphical user interface (GUI).
Some people still think of the modern Linux as the traditional Unix
which runs on server, can only be accessed remotely using terminals
and the physical machine that hosts Unix does not have any interface
and only in black and white. Modern Linux contains all that the user
wants from an OS.

1.3 What is an operating system (OS)?

An operating system (OS) is the software that manages the hardware.


It provides the best interface for the software to use the hardware. It
encapsulates technical details of the hardware and provides user-
friendly interface for the software application when using the hardware.
It also multiplexes the single hardware to be used by many software
programs. For example, the single CPU is being used by multiple
software programs. The synchronization is done by an OS.

1.4 An OS also extends the capability of the hardware device. For


example, the security services from the hardware manufacturers are
being extended to the software by the OS. Basically, the elements
contained in an OS are:

(a) Kernel – Main software program that links the application


software and hardware;

(b) Command line – Interpreter for all commands entered by the


user;

(c) Graphical user interface – The GUI system that brings colorful
and interactive communications with the user;

(d) Utility programs – Linux application software;

Copyright © 10
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

(e) Libraries – Software library that interacts with the applications


and OS components; and

(f) Productivity programs – Web browser, e-mail tools and other


software programs for working purposes.

1.5 Investigating user interface

Linux has graphical user interface (GUI) and text-based user interface.
Most users like GUI but Linux also has a very strong foundation for
text-based user interface. This subtopic discusses the graphic- and
text-based user interface in Linux with the following focus:

(a) Using a text-mode user interface – Text-mode user interface is


where the whole interface between the user and Linux is via the
command line; and

(b) Using graphical user interface – GUI interface is for users who
are less familiar with the command and more comfortable with
icons and GUI.

1.6 Where does Linux fit in the OS world?

From the server OS point of view, Linux is already a favorite OS.


Meanwhile, Linux is slowly catching up as the preferred OS in the user
market. Although Windows is still dominant in the user market, Linux is
starting to gain acceptance by and widely used among developer
community and small enterprises. This subtopic discusses the main
features of Linux and comparing it to Unix, Windows and Mac X
operating systems.

(a) Comparing Linux to Unix – The book compares the history of


Unix and how Linux differs from Unix;

(b) Comparing Linux to Windows – The main difference between


Linux and Windows is their openness. This factor then brings
other differences between them; and

(c) Comparing Linux to Mac OS X – The main difference between


Linux and Mac is the integration of software and hardware. It
makes Mac the perfect choice but at an expensive price.

11 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

1.7 What is a distribution?

Since Linux is an open source operating system, everybody that


understands the system and have the skills to modify it can have their
own variant or distribution of Linux. We have Centos, Fedora, Ubuntu,
Suse and hundreds of other distributions. Each distribution is different
in their GUI, how process is being managed and how application is
being handled by the OS. Basic system such as kernel and GNU
command is not changed. GNU (GNU not Unix) is the core Linux
command that is used throughout any Linux distributions. This subtopic
will discuss the following:

(a) Creating a complete Linux-based OS – Describes what is


inside a complete Linux OS;

(b) A summary of common Linux distribution – Presents the main


Linux distribution; and

(c) Understanding release cycle – Release cycle is the duration of


a new Linux distribution version into the market.

Study Questions

1. What is your definition of an operating system (OS)?

2. What is the function of the Linux kernel?

3. Describe five differences between Linux and Unix.

4. What is a common security problem in Windows that is essentially non-


existent in Linux?

5. Is it possible for us to create our own Linux distribution? Explain your


answer.

Copyright © 12
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 2: Investigating Linux’s Principles and


Philosophy

Learning Outcomes

By the end of this topic, you should be able to:

1. Describe the basic principles of open source software;

2. List the application platform of Linux; and

3. Analyze how Linux is suitable for any types and sizes of computing
machines.

Topic Overview

This topic provides an explanation of the Linux philosophy and describes


how operating system usage span through the entire spectrum of computing
devices from embedded to high-end server systems. It provides the
fundamentals to understand the idea of open source software in general and
how this has become the foundation of the Linux belief.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

2.1 Linux through the ages Chapter 2, pp 21–24

2.2 Open source world and principles Chapter 2, pp 24–27

2.3 Understanding OS roles in all Chapter 3, pp 27–29


computing platforms

13 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Content Summary

2.1 The history of modern computer system tells us that there has been a
competition between the force that wanted to integrate hardware and
software element as one integrated element and others who favored
the separation between hardware and software as independent,
separate components which grow in tandem. Intel and Microsoft
continue to grow as separate entities with strong technical relationship
and continually support each other. However, Apple’s intention is to
integrate everything in one single brand and give end-to-end users
satisfaction from hardware to the entire software package.

2.2 Linux through the ages

From an assignment at the University of Helsinki, Linux Torvalds


developed Linux until it became a full-blown operating system (OS). It
grew from there and programmers worldwide kept contributing to it,
and today Linux is being used in very big servers. It continues to grow
from server OS to network OS and finally to client and user-based OS.
This subtopic will discuss the following:

(a) Understanding Linux’s origin – The book shows a flashback of


the history of Linux since the time of DOS and PC; and

(b) Seeing the Linux world today – Discusses the development of


current Linux OS.

2.3 Using open source software

Is open source software (OSS) considered as second grade software?


This is half-truth. In terms of the quality of codes, OSS is the best.
However, in terms of support, it depends on how the owners provide
quality maintenance support to its users. This divides OSS into a few
categories.

Copyright © 14
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

The philosophy that underlies much of the software development for


Linux is different from those that drive most software development for
Windows. These differing philosophies affect how you obtain the
software, what you can do with it and how it changes over time. These
principles and also the description of how Linux functions as a sort of
“magnet” integrate software from many sources into one place.
Following are points summarized in this subtopic:

(a) Understand basic open source principles – Discusses the


principles of open source software and divides it into several
categories; and

(b) Linux as the software integrator – Discusses how Linux has


become the software integrator for all other small software under
it.

2.4 Understanding OS roles

Computers fulfill many roles in the world today and as computers have
become more common and less expensive, those roles have also
multiplied. Linux serves as the OS for most of these roles, each
drawing on its own subset of support utilities. Some of these roles also
require tweaking the kernel. Three of these roles are described briefly −
embedded computers, desktop and laptop computers, and server
computers.

(a) Understanding embedded computers – Embedded world is the


future of computing system. Linux fits perfectly in this computing
environment because of its flexibility and robustness;

(b) Understanding desktop and laptop computers – This is the


computing system that has medium power capability and medium
performance demand. Linux also scale-up to this kind of
computing environment due to its flexibility; and

(c) Understanding server computers – This is a high performance


system. Linux suits this environment because of its scalability and
security features.

15 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Study Questions

1. What is the main philosophy of Linux which makes is so great?

2. Discuss the technical challenges when Linux scaled up from small


mobile devices to high-end server platforms.

3. Explain how the supporting tools around Linux help its development
and acceptance into the various industries.

4. Is there a difference between servers and desktops that run on Linux?

Copyright © 16
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 3: Understanding Software Licensing

Learning Outcomes

By the end of this topic, you should be able to:

1. Differentiate between software copyright and licenses;

2. Identify the business impact of licensing; and

3. Describe the types of open source licenses.

Topic Overview

This topic gives an introduction to software licensing. It provides an


understanding of software copyright, licensing and how Linux views open
source code as the base for its platform. It also provides the definition of a
few main types of open source licenses.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

3.1 Investigating software licensing Chapter 3, pp 33–36

3.2 The Free Software Foundation Chapter 3, pp 36–38

3.3 The Open Source Initiative Chapter 3, pp 39–40

3.4 The Creative Commons Chapter 3, p 41

3.5 Using open source licenses Chapter 3, pp 42–44

17 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Content Summary

3.1 Linux is the open source software where you can get access and run
the full source code for free. However, there are a few types of
software licensing categories that we need to understand in Linux.
Understanding this is very important if we want to use the code in our
commercial products because software is a type of intellectual property
(IP). IP is governed by the copyright law and, in some countries, patent
laws. As a general rule, this makes it illegal to copy software unless
you are the software’s author. Open source software, however, relies
on licenses which are documents that alter the terms under which the
software is released. As described in this topic, open source licenses
grant additional rights to software users.

3.2 Open source software in general owes a great deal to three


organizations, namely the Free Software Foundation (FSF), the Open
Source Initiative (OSI) and the Creative Commons. Each organization
has a distinct philosophy and role to play in the open source world.
There are also numerous specific open source licenses which are
summarized at the end of this topic along with the ways businesses
can use them.

3.3 Investigating software licensing

The copyright law has existed for centuries. However, it was not
designed with software in mind. Nevertheless, copyright law does apply
to software. Licenses that software authors apply to their software
interact with the copyright law to create the specific rights that you have
– or don’t have – to use, modify and redistribute their software. These
basic principles as well as the differences are described in broad
strokes between proprietary and open source licensing terms. The
subtopic is mainly divided into two parts:

(a) Copyright and software – The book discusses the relation


between copyright and software which is being used widely in the
computing world;

(b) Using license to modify copyright terms – The author


compares license and copyright, and discusses a few types of
software licenses.

Copyright © 18
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

3.4 The Free Software Foundation (FSF)

The Free Software Foundation (FSF) is a critical force in the open


source world. Founded in 1985 by Richard Stallman, the FSF is the
driving force behind the GNU’s (not Unix) project described in the
previous two topics. The FSF has a certain philosophy that manifests
itself in the General Public License (GPL) which is FSF’s preferred
software license. This subtopic looks into:

(a) Understanding the FSF philosophy – It discusses the definition


of software freedom as defined by FSF;

(b) Free software and the GPL – General Public License is the legal
expression of FSF’s principles and this part discusses the general
idea of the GPL license.

3.5 The Open Source Initiative (OSI)

In the 1980s and 1990s, the free software movement gathered


momentum in certain circles including academia and among hobbyists.
Businesses, however, were slow to adopt the free software. Many who
finally did adopt it do so reluctantly or even unwittingly. They include
system administrators who are pressured to perform their duties with
minuscule budgets and would quietly install Linux, Apache, Samba and
other free software as a way to avoid having to buy expensive
commercial alternatives. There are two areas under this subtopic:

(a) Understanding the open source philosophy – With little


history, the author lays down the philosophy of open source; and

(b) Defining open source software – The author defines what it


means by open source software.

3.6 The Creative Commons

The Creative Commons, headquartered at Mountain View, California


(http://creativecommons.org) was founded by Lawrence Lessig. Its goal
is to combat what its creators and supporters view as a creative culture
that is increasingly tied to permissions granted (or not granted) by
those who hold the copyrights on earlier works. Much of our current
culture is derived from earlier cultural works. For instance, Star Wars
was inspired, in part, by common myths and legends. Star Wars itself
is copyrighted and limits the rights of current artists to distribute works
that are derivative of it, at least without permission.

19 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

3.7 Using open source licenses

As an individual user, you might not need to delve too deeply into open
source licenses in detail. The principles behind the OSI guidelines
guarantee that you have the right to use open source programs as you
see fit and even to redistribute those programs. However, if you are
building a business, particularly a business that creates or distributes
open source software, you may need to have an in-depth
understanding of these licenses and their implications. Thus, a few of
the licenses are described in more detail as well as some of the ways
companies can use open source licenses as part of their business
models.

(a) Understanding open source licenses – This part discusses


major open source licenses and their definitions; and

(b) Understanding open source business models – This part


presents a few options of business models using the open source
software.

Study Questions

1. How can open source licenses overwrite the restrictions on software


copyright?

2. State the main different characteristics between General Public


License (GPL), Lesser General Public License (LGPL) and
Massachusetts Institute of Technology (MIT) licenses.

3. How can a highly skilled technical programmer leverage on open


source business model to reap profits and financial gains?

4. What is the problem addressed by creative commons license?

5. What would be the implications if users ignore the Linux licensing


issue?

Copyright © 20
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 4: Using Common Linux Programs

Learning Outcomes

By the end of this topic, you should be able to:

1. Describe the Linux desktop environment;

2. Explore the productivity software that suits user’s needs;

3. Discuss the main software protocols and the software security issues
from servers’ perspective; and

4. Use appropriate programming language that best serves the user’s


needs.

Topic Overview

This topic introduces learners to the Linux desktop environment and several
other types. It also gives learners the basics in order to launch the Linux
program and the file manager which performs the basic file exploration on
Linux machine. The topic also provides insights on how to get your tools
running on Linux and the types of e-mail clients, web browsers, office tools
and multimedia applications. Besides that, this topic shows learners the
example of command port and application on the Linux server side. Finally, it
explains the type of programming language and the language that best suits
the user’s needs.

21 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

4.1 Using Linux desktop environment Chapter 4, pp 49–54

4.2 Working with productivity Chapter 4, pp 56–62


software

4.3 Using server programs Chapter 4, pp 63–68

4.4 Managing programming Chapter 4, pp 69–70


languages

Content Summary

4.1 Linux comes with the command program that can perform any tasks
similar to what other operating systems can do. It comes with Microsoft
Office-like applications, graphic and video editing programs,
mathematical modelling tools like Matlab and many other high quality
software tools that can replace any of your favorite application on other
operating systems.

4.2 Using Linux desktop environment

Linux desktop environment is the way to control your Linux desktop


and the way to run the program on Linux. Linux provides several
desktop environment options so that you can choose the one that you
like most.

Copyright © 22
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Chances are your first experience working with a Linux system will
involve a desktop environment, which is a set of program that controls
the screen and provides small utility programs to perform tasks such as
managing files. Linux provides several desktop environment options,
so if you do not like one, you can choose another option. In addition to
presenting information on available desktop environments, some of the
tools that you can use to launch programs and manage files are
described in the topic.

(a) Choosing a desktop environment – Describes several main


Linux desktop environments;

(b) Launching programs – Describes few ways to launch the Linux


program; and

(c) Using file manager – File manager is the Linux tool for executing
and exploring files.

4.3 Working with productivity software

The area of productivity software is extremely broad. Hundreds, if not


thousands, of productivity applications exist and entire books have
been written about many of them. However, in this topic, only the
names and brief descriptions of a few of the most important tools will
be provided. This subtopic is divided into the following:

(a) Finding the right tool for the job;

(b) Using the web browser;

(c) Using e-mail clients;

(d) Using office tools;

(e) Using multimedia applications;

(f) Using Linux for cloud computing; and

(g) Using mobile applications.

23 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

4.4 Using server programs

Linux is a powerful OS for running server programs, so it should come


as no surprise that you can find a wide variety of server programs for
Linux. In the following pages, some common server protocols and the
programs that use them are described. Also briefly described are the
process of installing and launching the server as well as the basic
information on server security issues.

(a) Identifying common server protocols and programs –


Common Linux protocols are listed here with brief explanations;

(b) Installing and launching the server – This part briefly describes
the way to install and launch a server program on Linux; and

(c) Securing servers – Describes the general rules to securing


server applications.

4.5 Managing programming language

Users generally do not need to deal with programming languages.


However, basic knowledge of what they are and how they differ from
one another is important for Linux users for a variety of reasons. The
rest of this topic is devoted to presenting basic information on
programming languages. The discussion is divided into two parts:

(a) Choosing compiled versus interpreted language – Discusses


the difference between compiled language and interpreted
language, what makes them different and what are the
advantages of both; and

(b) Identifying common programming languages – This part


presents the list of programming languages supported by Linux.

Copyright © 24
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Study Questions

1. Can users roll out or launch their Linux desktop environment? Discuss
the difficulties and list the technical challenges involved.

2. List 100 open source applications and compare against close source
applications.

3. Analyze the security strength of Linux server side software.

4. Write a layer-by-layer programming level from hardware programming


using the language that is easy to be programmed by the user. You
need to study a little on the programming language and how each
language interacts with the others.

5. Critically analyze the advantages and disadvantages of adopting the


stable open source Linux software for daily usage by big corporations.

25 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 5: Managing Hardware

Learning Outcomes

By the end of this topic, you should be able to:

1. Execute the command to know the CPU types on Linux;

2. Identify the partition type on Linux and the tools related to disk; and

3. Discuss the drivers on Linux and their types on Linux.

Topic Overview

This topic discusses aspects of hardware that resizes on Linux. Since


operating system deals directly with the hardware, we do not need to
understand how Linux handles it. This topic consists of seven subtopics and
ranges from the CPU to handling drivers and USB devices on Linux.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

5.1 Learning about CPU Chapter 5, pp 75–78

5.2 Identifying motherboard Chapter 5, p 78


capabilities

5.3 Sizing the power supply Chapter 5, p 78

5.4 Understanding disk issues Chapter 5, pp 81–88

5.5 Managing displays Chapter 5, pp 89–90

5.6 Handling USB devices Chapter 5, p 92

5.7 Managing drivers Chapter 5, pp 93–94

Copyright © 26
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Content Summary

5.1 Although Linux is the software, it relies on hardware to operate. The


capabilities and limitations of the hardware will influence the
capabilities and limitations of Linux running on that hardware.
Therefore, you should know these features for any computers that you
use extensively or those that you plan to buy. This topic will help you
learn about and perform basic management tasks with your hardware.
The topic begins with low-level issues such as the nature of central
processing unit (CPU) and motherboard. Also included but often
overlooked is the power supply which can cause problems if it is
undersized or misbehaves. Hard disks require special care in their
setup and will be briefly described. A common sticking point in Linux is
display issues. A malfunctioning display prevents any interactions with
the computer. Today, most external devices are attachable via the
universal serial bus (USB). The features of USB will also be described
in this topic. Finally, the topic covers the common issues of drivers,
which are the software components that control the hardware devices.

5.2 Learning about CPU

The CPU (sometimes called the processor) is the “brain” in your


computer as it does most of the computer’s actual computing. This
subtopic discusses CPU-related elements to help learners get some
ideas which are related to the Linux hardware.

(a) Understanding CPU families – Linux supports a wide range of


CPU instruction and instruction set implementation. This makes
Linux perfect for a wide range of CPUs; and

(b) Identifying the CPU – Discusses the various commands to


identify the CPU on Linux.

5.3 Identifying motherboard capabilities

If the CPU is the computer’s brain, the motherboard is the computer’s


central nervous system. The motherboard is a large circuit board inside
the computer. It is dominated by a chipset, which is one or more chips
that provide key functionality for the computer. They handle the hard
disk interfaces, USB interfaces, network devices and so on. Some
chipsets include video circuitry for video cards although this
functionality is sometimes separate while at other times it is built into
the CPU.

27 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

5.4 Sizing the power supply

A computer’s power supply takes the alternating current (AC) power


from a wall outlet and converts it to the direct current (DC) that your
motherboard and everything else you plug into it uses. Laptop
computers and some small desktop units use power adapter “bricks”
that you can place on the floor. Larger desktop computers have internal
power supply units. These internal units are larger, both physically and
in terms of the amount of power they can deliver.

5.5 Understanding disk issues

Disks are a critical part of most Linux installations. Three basic disk
issues are described in this topic, namely disk hardware interfaces,
disk partitioning and file systems. Also described are some of the
issues surrounding removable disks including optical (CD-ROM, DVD-
ROM and Blu-ray) discs. This subtopic is divided into:

(a) Disk interface – Discusses two types of disk hardware interfaces


in today’s computer hardware system;

(b) Partitioning a disk – Presents the structure of disk partitioning


on Linux;

(c) Understanding file system issues – This part further explains


the issues and details of file system on Linux. It discusses the
advance file system format used widely in Linux; and

(d) Using removable and optical disks – Discusses how Linux


handles external storage media.

5.6 Managing displays

Linux provides two display modes, namely text-mode and graphical


user interface (GUI). A text-mode display is fairly straightforward and
requires little or no management. GUI displays, on the other hand, are
more complex. In Linux, the X Window System (or X for short)
manages GUI displays. In the next few pages, a description of what X
is and how X interacts with common display hardware is presented.

(a) Understanding the role of X – Discusses the complex


interactions and processes behind Linux X Window system;

(b) Using common display hardware – Describes the challenges in


managing drivers for video chipsets.

Copyright © 28
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

5.7 Handling USB device

Most modern computers use USB as the primary interface for external
peripherals. Keyboards, mice, cameras, flash storage, hard disks,
network adapters, scanners, printers and more can all connect via
USB. For the most part, USB devices work in a plug-and-play manner,
that is, you plug them in and they work.

5.8 Managing drivers

Most hardware devices require the presence of special software


components in order to be useful. A piece of software that “talks” to the
hardware is known as a driver. Therefore, you should know how drivers
work on Linux. This subtopic discusses driver issues on Linux:

(a) Understanding the types of drivers – Briefly describes the


types of drivers on Linux; and

(b) Locating and installing drivers – Discusses the ways to locate


and install drivers on Linux.

Study Questions

1. State the different CPU families listed in this topic and support the type
of CPU from the commands you used.

2. Write a report which describes the element state in cat/proc/CPU info.

3. List all input and output ports in your motherboard and all Linux
commands in order to identify them precisely. Write a report and
explain your findings from the commands. (For example: lspci, lsusb)

4. List the complete partition table of your Linux machine used for this
subject. Then describe precisely, byte by byte, how your entire hard
drive looks like.

5. List all the devices in /dev in your Linux. Then divide the drivers into
three types of drivers as defined in Linux.

29 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 6: Getting to Know the Command Line

Learning Outcomes

By the end of this topic, you should be able to:

1. Write command on Linux;

2. Apply the different ways to run Linux program; and

3. User navigation and shell control-related commands.

Topic Overview

This topic is the start of the learner’s practical journey on Linux command
line. It describes and explains related elements on shell, navigating
directories as well as relative and absolute file reference on Linux. This topic
is very important to generate learner’s interest and intimacy with Linux
command line.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

6.1 Starting a command line Chapter 6, pp 99–103

6.2 Running programs Chapter 6, pp 103–105

6.3 Manipulating files Chapter 6, pp 106–108

6.4 Using shell features Chapter 6, pp 111–112

Copyright © 30
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Content Summary

6.1 You may think of the command line as an archaic relic from the 1970s
with about as much relevance to computing today as a disco ball. Not
so! Although Linux has numerous GUI programs, they are mostly just
flashy frontends to underlying text-mode tools. By learning those tools,
you will be able to unlock Linux’s true power, enabling you to get your
work done more quickly. You will need to log in and administer the
system remotely. Command-line tools can also be scripted, meaning
that you can write a simple program to perform a task more quickly or
easily than could be done using the standard program alone. For these
reasons, most topics in this Study Guide describe both the GUI and
command-line ways of getting things done.

6.2 Starting a command line

A Linux command line, or shell as it is more appropriately called, is a


program like any others and must be launched in some ways. Three
methods are commonly used for this − starting a shell in a GUI window
called a terminal, logging into the computer in a text-mode console and
logging into the computer remotely using a text-mode login protocol.

The default shell in most Linux distributions is the Bourne-Again Shell


(Bash or bash), which is based on an older shell called the Bourne
Shell. Other shells are available. Most of these are similar to Bash in
broad strokes although some details differ. Each account specifies its
own default shell. Therefore, individual users can change their shells if
they like. This subtopic includes:

(a) Launching a terminal;

(b) Logging into a text-mode console; and

(c) Logging remotely.

31 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

6.3 Running programs

Once you have opened a terminal or logged in using a text-mode tool,


you should know how to use the shell. Bash includes a few built-in
commands but much of what you will do in a shell involves running
other programs. There are three ways to run a program:

(a) Running text-mode programs;

(b) Running GUI programs; and

(c) Running programs in the background.

6.4 Manipulating files

Manipulating files is a crucial skill for Linux command liner. This


subtopic enables the learner to execute basic file listing command, file
navigation command and changing directories in Linux. It also
introduces the learner to the relative and absolute path in Linux.
Command manipulation file is also introduced here to enable the user
to understand the command and test it on the system.This task
involves skills in the following areas:

(a) Obtaining file listings;

(b) Changing directories;

(c) Using absolute and relative file reference; and

(d) Using common file manipulation commands.

6.5 Using shell features

Shell is home of the Linux command line. Knowing the basic command
lines on our shell gives us the confidence and comfort in our own home
directory. This subtopic introduces the shell command completion and
command history.

Copyright © 32
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Study Questions

1. Launch your program within one day to fully utilize the command line.

2. Enable ssh on your friend’s machine and try to connect with each
other’s machine.

3. Run the software on the background and use ps command to get the
process id of that running software.

4. List all your hidden files in your home directory. Hidden file is the file
starting with “.” (For example: .vim). List them all and describe the
function of each file.

5. Google on how to back-up all the command lines you used in history to
add a file called historycommand.

33 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 7: Managing Files

Learning Outcomes

By the end of this topic, you should be able to:

1. Master the command to create, copy and move files on Linux;

2. Justify the rationale of hard and soft links on your Linux; and

3. Create and manage directories on Linux.

Topic Overview

This topic basically tells the user how to create, copy and move files on
Linux. This is a must-have skill for IT/CS learners. This operation is handy
and learners must understand well. This topic also introduces the hard and
soft links which are widely used in Linux. Finally, it shows the user how to
create and manage directories on Linux.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

7.1 Manipulating files Chapter 7, pp 117–123

7.2 Manipulating directories Chapter 7, pp 124–127

Copyright © 34
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Content Summary

7.1 In Linux, everything is a file. Everything means from data file, execution
file right up till the device is interpreted and processed as a file. Hence,
the understanding and skills to manage files in Linux is very crucial in
order to master the Linux.

7.2 Manipulating files

Files can be created, copied, moved and renamed on Linux. There are
detailed options on each command used to operate the file. Link is also
covered. It is important to understanding what the link is in order to
avoid confusions when working on Linux.

Links will save a lot of storage on Linux. This subtopic covers a few
interesting and practical elements including:

(a) Creating files;

(b) Copying files;

(c) Moving and renaming files;

(d) Using links;

(e) Deleting files;

(f) Using wildcards; and

(g) Understanding case sensitivity.

7.3 Manipulating directories

This is another must-have skill set to be acquired by Linux users.


Creating directories, deleting directories, managing information in
directories are skills that will reduce the operation time for Linux
command liners. Directory path is also important to avoid confusion
and makes finding file easier. This subtopic on manipulating directories
includes:

(a) Creating directories;

(b) Deleting directories; and

(c) Managing directories.

35 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Study Questions

1. Create one file. Then, create five other files which are linked to that
initial file.

2. Read through the man mkdir and state the meaning of all the command
options.

3. Delete a directory with all files and all directories under it using rm
command with the required options.

Copyright © 36
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 8: Getting Help

Learning Outcomes

By the end of this topic, you should be able to:

1. Use manual pages to find help;

2. Find the right command options to execute; and

3. Use the right command option for the right purpose.

Topic Overview

This topic shows the learner how to survive on Linux. Each command comes
with manual pages. The entire options are listed on manual pages and must
be the reference point for command liners. Info pages are also useful for
newer generation of command liners which require fast and precise results.
Other options to get help are also listed and discussed in this topic.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

8.1 Using manual pages Chapter 8, pp 131–135

8.2 Using information pages Chapter 8, pp 138–139

8.3 Finding additional documentation Chapter 8, pp 140–145

37 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Content Summary

8.1 This topic guides you on how to get help when using Linux. Linux was
built by different levels of programmers and was spread by users who
have deep interests and who are enthusiastic about it. Some people
say that Linux is difficult but if you know the right place to find help and
spend some time reading the manuals, you will get right level of
intimacy with Linux and the right understanding to move on, for sure.

8.2 Using manual pages

When you do not have Internet connection and you are using Linux,
just relax because everything is on the manual page. Manual page or
man page is the page that helps you to select the right option to your
command and to use the right command that best meets your intention.
It can be located by the section number of the manual pages. It also
has the man man (the manual pages for the manual pages) and man –
k options to search for manual pages that contain certain words.
However, man pages are a little lengthy and use quite standard English
for local beginner command liners. Following that is the information
pages. This subtopic is divided into:

(a) Understanding the purpose of man pages;

(b) Locating man pages by section number;

(c) Searching for man pages;

(d) Reading man pages; and

(e) Using less.

8.3 Using information pages

Info is the information page for Linux command. What is the difference
with man? Info is brief and a straightforward help for command liners.
Info also has info to get info itself. This subtopic discusses:

(a) Understanding the purpose of info pages; and

(b) Reading info pages.

Copyright © 38
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

8.4 Finding additional documentation

Since everything is connected, basically you can find help on Linux


everywhere. Online documentation is everywhere, for example,
yolinux.com is an excellent site for Linux beginners and intermediate
users. There are local and foreign Linux experts that you can consult
with too. Web forums, mailing lists, IRC are good sites for more real-
time help on any Linux problems. A few tips suggested by the textbook
include:

(a) Locating program documentation on your computer;

(b) Locating program documentation online; and

(c) Consulting the experts.

Study Questions

1. Describe step-by-step ways to get help in order to set up the Linux load
balancing server. Write a flow chart or use any other methods to
present your idea.

2. Glance through man pages for command date and try five options to
print date in Linux using different types of data output options.

3. Take one command and describe the difference between man page
and info page for that command. Suggest when we need to use man
page for that command and when to use info page.

39 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 9: Using Program and Process

Learning Outcomes

By the end of this topic, you should be able to:

1. Explain how Linux package management works;

2. Discuss the idea of process hierarchy in Linux and how it works; and

3. Practice using process-related command.

Topic Overview

This topic introduces process and package management in Linux. It


describes what the package in Linux is and how software is being installed in
a Linux package. The concept of process also enables the learner to
understand how the basic unit of operation in Linux is being managed.
Finally, log file is introduced to expose the user to debugging capabilities of
Linux and its kernel.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

9.1 Understanding package Chapter 9, pp 149–153


management

9.2 Understanding the process Chapter 9, p 154


hierarchy

9.3 Identifying running processes Chapter 9, pp 155–159

9.4 Using log files Chapter 9, pp 160–162

Copyright © 40
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Content Summary

9.1 Computer is built to run processes and programs. Linux has its own
way to handle processes and programs. This topic discusses the
package management and process hierarchy that is the backbone of
the Linux program processing system.

9.2 Understanding package management

Package is where the Linux software is being packed in one file.


However, the package in Linux differs from one distribution to another.
The popular ones are RPM (RedHat package management) uses
RedHat and fedora core Linux. The Linux package management
principle is described and discussed. The package system is also
explained and RPM, as the main de facto Linux package, is presented
with the relevant command. However, Debian also has its own
package system similar to fedora. For advance users, compiled version
of the software is the best choice because it enables users to compile
any software on any Linux distributions. This subtopic discusses the
following:

(a) Linus package management principles – Discusses the


principles behind Linux package management;

(b) Understanding package systems – Explains why the package


system is different between each distribution and the software
installation tasks involved;

(c) Managing RPM systems – Explains the command to manage


RPM and a few explanations on RPM systems; and

(d) Managing Debian system – Discusses the dpkg package


management system for Debian.

9.3 Understanding the process hierarchy

Process is how a program is loaded into the memory. Process is


hierarchy that has a number on it. The first process load on Linux after
the kernel boot is initialization (init). When you run ps –aux on Linux,
the top process with process id 1 is init process. Then, the process is
extended to another process, and another process, until the last
process on that machine. This is the main idea of this subtopic and it is
a very important one.

41 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

9.4 Identifying running processes

Command ps and top can be used to display process information on


Linux. Command free, vmstat is used to display memory information.
This command is very useful in diagnosing the current process
structure and the resources used by the process. This command is
also used regularly with other commands such as grep and find, in
order to produce the precise command that suits our need. This
subtopic discusses and practically explains three elements:

(a) Using ps to identify processes;

(b) Using top to identify processes; and

(c) Measuring memory use.

9.5 Using log files

Log file is the file that stores the debug information of the program and
software. Log file is very useful in Linux as a repair and debug tools.
Kernel debug message can also be obtained using command dmesg
that is very useful in debugging kernel level software. This subtopic
discussion includes:

(a) Locating log files – Introduces the learner to the default location
of log file on Linux /var/log;

(b) Producing more verbose log file entries – Discusses the


eligibility to configure log files to produce more verbose output;
and

(c) Examining the kernel ring buffer – This is dmesg, the ring
kernel buffer.

Copyright © 42
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Study Questions

1. Run a command that prints all processes and filter the process which
belongs to your username.

2. Trace back the process hierarchy on your Linux, print it on paper and
write all the processes in the stage and hierarchy from init until the last
process is executed.

3. Dump your dmesg output to a file and identify any errors or warning
messages on your system.

4. Describe three differences between ps and top.

5. Glance through the manual page for your package manager and
execute command to search for package apache on your machine and
upgrade it.

43 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 10: Searching, Extracting and Archiving Data

Learning Outcomes

By the end of this topic, you should be able to:

1. Recognize the regular expression in Linux;

2. Use redirection operation on their command line; and

3. Use tar and compression tools to back up files.

Topic Overview

This topic introduces the most exotic topic for Linux in this Study Guide.
Regular expression is an art in Linux. Its tremendous capabilities will make
your work easier and faster. This is the topic that needs detailed practical
work from the learner and detailed understanding of it. The topic also
introduces the learner to searching tools that are widely used on a daily
basis as the Linux command liner. Others include the input/output redirection
that you will frequently encounter in scripting and redirecting output of the
command line.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

10.1 Using regular expression Chapter 10, p 165

10.2 Searching for and extracting data Chapter 10, pp 167–171

10.3 Redirecting input and output Chapter 10, pp 172–175

10.4 Archiving data Chapter 10, pp 176–180

Copyright © 44
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Content Summary

10.1 Text and data processing is one of the killer applications for Linux
command line interface (CLI). It gives power to user in performing
text processing. This capability is widely used by Linux tools and
scripting. Searching and extracting data processing command as well
as input/output redirection are also presented. Archiving tools are
discussed in order to introduce learners to the way data is packed in
an archived format.

10.2 Using regular expression

Regular expression is the way to do text processing in Linux. There


are basic and extended regular expressions in Linux. The most
powerful regular expression feature is detailed out in the text with a
pointer to a practical example.

10.3 Searching for and extracting data

Two commands, grep and find, are useful in finding data. These two
commands need to be understood and well-practiced by the learner
so that they can be used intuitively whenever needed. This subtopic
discusses the following commands:

(a) Using grep;

(b) Using find; and

(c) Using wc.

10.4 Redirecting input and output

The standard input/output in Linux is standard input, standard output


and standard error. We can redirect input to output as well as error to
output. These are also very useful capabilities of Linux command
line. Pipe is also introduced to give the user full power of input and
output piping on Linux. The discussion in this subtopic includes:

(a) Using basic redirection operators;

(b) Using pipes; and

(c) Generating command lines.

45 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

10.5 Archiving data

Tar is the tools used to archive data on Linux. It collects a group of


files into a single “package” file that you can easily move around on a
single system and backup to a recordable DVS, USB flash drive, tape
or other removable media, or transfer across a network. Three
elements are discussed here:

(a) Using tar;

(b) Using compression; and

(c) Using zip.

Study Questions

1. Write a short report about the history of regular expression and the
maximum capabilities of regular expression in Linux.

2. Try to explore the best and smartest way to search for whole files in
your system containing your hostname.

3. Create any meaningful command that have five redirection piping.


Then discuss the command.

4. Analyze the size reduction of tar files after being tarred and study the
compression tools that can be performed on the tar files on Linux.

5. Compare various compression tools and format available on Linux


such as zip versus tar and gz versus gunzip.

Copyright © 46
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 11: Editing Files

Learning Outcomes

By the end of this topic, you should be able to:

1. Apply the Linux file editing tools (preferably vim);

2. Explain how Linux software uses configuration files with the software;
and

3. Use vi editor and vi command, one by one.

Topic Overview

This topic introduces the learner to file editing tools in Linux. As a system
engineer and programmer, the user will have to deal with files most of the
time. Hence, mastering editing tools is very crucial for serious Linux users.
This topic introduces pico, nano and vi. We suggest that the learner seriously
use the most powerful tool which is vi as their daily file editing tool.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

11.1 Understanding the role of text Chapter 11, p 185


files

11.2 Choosing an editor Chapter 11, p 187

11.3 Launching an editor Chapter 11, p 189

11.4 Editing files with pico or nano Chapter 11, pp 189–190

11.5 Editing files with vi Chapter 11, pp 193–197

11.6 Using configuration file Chapter 11, p 197


conventions Chapter 11, p 199

11.7 Editing formatted text files Chapter 11, p 200

47 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Content Summary

11.1 Understanding the role of text files

In Linux, text file is the file that stores the configuration file, source
code and scripting which build up the system. Text file is the second
type of big file in Linux after binary file which is executed by the
processor.

11.2 Choosing an editor

Each editor has its advantages and disadvantages. It is always


simplicity against complexity. Easy editor is less powerful. Hard and
difficult editor such as vi is very powerful. This subtopic will introduce
a few types of editors for you to get to know, practice and choose one
that is best for you. Four editors are discussed, from both GUI and
text-based:

(a) Vi;

(b) Emacs;

(c) Pico;

(d) Nano;

(e) Gedit;

(f) KWrite and Kate; and

(g) NEdit.

11.3 Launching an editor

Editor can be launched using common GUI or using command on the


terminal.

Copyright © 48
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

11.4 Editing files with pico and nano

Editing tools is a topic by itself. Here, the text introduces basic


commands and shortcuts used in the tools. Vi on its own is a
separate subtopic because it covers detailed explanation of the tool.
This subtopic covers:

(a) Using text editor conventions;

(b) Exploring basic nano text-editing procedures; and

(c) Saving your changes from nano.

11.5 Editing files with vi

Vi is a legendary file editing tool that is widely used by system


administrators and programmers worldwide. Knowing and mastering
vi is a great advantage for Linux command liners. This subtopic
covers vi on the following:

(a) Exploring basic vi text-editing procedures – Discusses the


general idea of vi and a few operating modes of vi; and

(b) Saving your changes from vi – Explains the art of vi editing


command to be mastered by learners.

11.6 Using configuration file conventions

Configuration file is the file used to configure your software. The tools
will read the configuration file and parse the data in the command line
of the software. This is the usual command way in Linux. Hence, the
user needs to know the main configuration file for the command
software that is frequently being used.

11.7 Editing formatted text files

Formatted file is the text file with special format such as html and xml.
This subtopic introduces the learner to the html style of file formatting
and gives some insights on how the formatting will look like.

49 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Study Questions

1. Download any 2,000 lines of C code in a file and execute 20 vi


commands on it. Practice until you become really, really familiar with
and used to it.

2. Open apache configuration file on your machine and understand the


options in it.

3. Open html file in your browser and edit the file. See the effects on the
web displayed.

4. Compare the look and feel of using pico, nano, emacs and vi as a file
editor. How do you feel when using all these?

5. Open two files using vi and try to move 10 lines from file A to any
locations in file B.

Copyright © 50
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 12: Creating Scripts

Learning Outcomes

By the end of this topic, you should be able to:

1. Explain how scripting can be an effective way to express logic using


Linux commands; and

2. Write a simple script to execute simple command and logic.

Topic Overview

This topic introduces scripting on Linux. It uses the same programming


construct as any programming language. It will be an interesting topic since
learners can practice the commands that they have learnt and include some
logic in it.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

12.1 Begin constructing a shell script Chapter 12, p 204

12.2 Using commands Chapter 12, p 207

12.3 Using arguments Chapter 12, p 208

12.4 Using variables Chapter 12, p 210

12.5 Using conditional expressions Chapter 12, p 212

12.6 Using loops Chapter 12, p 213

12.7 Using functions Chapter 12, p 214

12.8 Setting the script exit value Chapter 12, p 215

51 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Content Summary

12.1 Linux command can be grouped together to form a script. A script is


a sequence of commands that executes line by line in a file. A script
is a program written in an interpreted language, typically associated
with a shell or other programs whose primary purpose is something
other than an interpreted language. In Linux, many scripts are shell
scripts, which are associated with Bash or another shell (if you are
familiar with batch files in DOS or Windows, scripts serve a similar
purpose.) You can write shell scripts to help automate tedious
repetitive tasks or to perform new and complex tasks.

12.2 Shell scripting programming construct

Shell code begins with the pointer to shell interpreter as the first line
of the code. Then it follows any commands that can be used with
complete options on it. It can have arguments, variables, conditional
expressions, loops and functions similar to common C programming
language. Details of fun programming of shell codes are introduced in
the text with working code snippets that can be tested directly on
interpreter. This topic discusses the following:

(a) Begin constructing a shell script;

(b) Using commands;

(c) Using arguments;

(d) Using variables;

(e) Using conditional expressions;

(f) Using loops;

(g) Using functions; and

(h) Setting the scripts exit values.

Copyright © 52
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Study Questions

1. Write a code to find your username on the machine that you use and
print the date you logged in using any of the date formats.

2. Find the script that manages your initialization booting of your Linux
that decides which run level your Linux is operating at.

3. Write a script that copies a file by asking the user to enter the source
and destination filename.

53 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 13: Understanding and Creating Users and


Groups

Learning Outcomes

By the end of this topic, you should be able to:

1. Create users and groups on Linux using command line and GUI; and

2. Manage the groups using command line and GUI.

Topic Overview

This topic introduces users and group management in Linux. Understanding


and configuring users and groups is crucial to systems and network
administrators. The text presents commands, tips and tools that are used to
administer Linux users and groups. We combine this topic with Topic 14 in
order to provide the opportunity for practical skills with understanding.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

13.1 Understanding accounts Chapter 13, pp 217–222

13.2 Using account tools Chapter 13, pp 223–225

13.3 Working as root Chapter 13, pp 226–230

13.1 Creating new accounts Chapter 14, pp 235–239

13.2 Modifying accounts Chapter 14, pp 241–247

13.3 Deleting accounts Chapter 14, pp 250–251

13.4 Managing groups Chapter 14, pp 252–253

Copyright © 54
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Content Summary

13.1 Linux is a multi-user OS, meaning that it provides features to help


multiple individuals use their computers simultaneously. Collectively,
these features constitute accounts.

13.2 Understanding accounts

Accounts enable multiple users to share a single computer without


causing too much trouble to each other. They also enable system
administrators to track who is using system resources and,
sometimes, who is doing things he or she should not be doing. This
subtopic covers:

(a) Understanding account features;

(b) Identifying accounts; and

(c) Understanding groups.

13.3 Using account tools

A few commands can help you learn about the users and groups on
your computer. Most notably, whoami and id utilities can tell you
about your own identity while who and w utilities can provide
information about who is currently using the computer. This subtopic
covers two parts:

(a) Discovering your own identity; and

(b) Learning who is online.

55 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

13.4 Working as root

Root is the superuser or admin in Linux. Due to its nature as a multi-


user OS, Linux can be used by thousands of users at the same time.
However, as a Linux expert-to-be, knowing why root exists, how to do
things using root and how to use root privileges safely are important
aspects for managing a Linux system. This subtopic discusses the
following:

(a) Reasons for working as root;

(b) Acquiring root privileges; and

(c) Using root privileges safely.

13.5 Creating new accounts

Linux administrators must know how to create accounts. This part


deals with the important issues of deciding how to use groups and
selecting good passwords. It also explains how to create accounts
using both GUI and text-mode tools. It covers the following:

(a) Deciding on a group strategy;

(b) Selecting a good password;

(c) Creating accounts using GUI tools; and

(d) Creating accounts from the shell.

13.6 Modifying accounts

Modifying an account is sometimes necessary for the user or system


administrator. Before proceeding with how modifying account is being
performed, we must know when we need to do this. This subtopic
includes:

(a) Deciding when to modify accounts;

(b) Checking for logged-in users;

(c) Modifying accounts using GUI tools; and

(d) Modifying accounts from the shell.

Copyright © 56
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

13.7 Deleting accounts

Unused accounts can consume disk space. That makes it necessary


to delete the accounts. More importantly, unused accounts can be
abused either by their former owners or by others who are able to
break into the accounts. This subtopic discusses the following:

(a) Avoiding account-deletion pitfalls;

(b) Deleting accounts using GUI tools; and

(c) Deleting accounts from the shell.

13.8 Managing groups

Group is analogous to user in Linux. A single group contains many


users. Sometimes we need to create, modify and delete group
information. This subtopic deals with:

(a) Managing groups using GUI tools; and

(b) Managing groups from the shell.

Study Questions

1. List the users and groups on your machine.

2. Create new account and log in to that new account. Navigate the
default home directory created.

3. Create a new group and add all users to that group.

57 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 14: Setting Ownership and Permission

Learning Outcomes

By the end of this topic, you should be able to:

1. Recognize the concept of ownership in Linux; and

2. Set the permission in Linux.

Topic Overview

This topic deals with permission-setting in Linux. Owner, group and others’
permission are discussed and implemented here.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

14.1 Setting ownership Chapter 15, pp 257–260

14.2 Setting permission Chapter 15, pp 260–267

Copyright © 58
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Content Summary

14.1 Linux implements file ownership and permission for protection


purposes. Each file in Linux has its owner and permission is required
for the owner, groups and others associated with it. Owner belongs to
the creator of the file. Groups refer to the group of users that the
owner belongs to. One owner (user) can become a member of any
number of groups.

14.2 Setting ownership

Linux’s security model is based on that of Unix, which was designed


as a multi-user OS. This security model therefore assumes the
presence of multiple users on the computer and provides the means
to associate individual files with the users who create them. In other
words, files have owners. This subtopic helps learners in:

(a) Understanding ownership;

(b) Setting ownership in a file manager; and

(c) Setting ownership in a shell.

14.3 Setting permission

File ownership is meaningless without some ways to specify which


particular users can do with their files or with other users’ files. That is
where permission enters the picture. Linux’s permission structure is
modeled after that of Unix. It requires a bit of explanation before you
can tackle the issue. Once you understand the basics, you can begin
modifying the permission using either a GUI file manager or a text-
mode shell. You can also set default permissions for new files that
you create. This subtopic concludes with four smaller explanations as
follows:

(a) Understanding permission;

(b) Setting permission in a file manager;

(c) Setting permission in a shell; and

(d) Setting the umask.

59 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Study Questions

1. State the permission of root command that the user can execute.

2. List the permission of root command that the user cannot execute.

3. Identify a group with a few users in the group who can execute the
command belonging to the group.

Copyright © 60
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 15: Navigating Linux File System

Learning Outcomes

By the end of this topic, you should be able to:

1. Identify the Linux file system and its directory structure; and

2. Perform the special execute permission on the file.

Topic Overview

This topic discusses the structure of Linux file system and the special
execute permission.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

15.1 Understanding where things go Chapter 16, pp 272–274

15.2 Using special permission bits and Chapter 16, pp 277–281


file features

Content Summary

15.1 File system is where the files are stored. In Linux, files are stored in
its format and have a lot of advantages compared to file system used
in other operating systems. The arrangement of the files in Linux is
important and has specific rules. Linux defines specific directories for
specific types of files in the system. This topic will describe the
locations where certain files in Linux are stored and the permission
pertaining to each file which enables or disables access to that file.
Relevant command is also discussed to enable the learner to
navigate through the file system in order to have a look and feel of
the Linux file system.

61 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

15.2 Understanding where things go

Knowing where your file is stored is important to avoid losing it in


Linux command line interface (CLI). Linux uses the unified directory
tree, whereby every partition, removable disk, network file share and
other disk or disk-like storage device is accessible as a directory in a
single directory tree. The file system is mounted off the root (/)
device. This subtopic discusses:

(a) User files vs system files;

(b) File system hierarchy standard; and

(c) Important directories and their contents.

15.3 Using special permission bits and file features

Sticky bits, SUID (Set owner User ID up on execution), SGID (Set


Group ID up on execution) using octal and symbolic codes are
discussed here. The user will be guided to understand and test the
command. The following are discussed:

(a) Using sticky bits;

(b) Using special execute permissions;

(c) Hiding files from view; and

(d) Viewing directories.

Study Questions

1. Create a file and analyze its service set identifier (SSID) and SGID.

2. Analyze the PATH of your Linux machine and add a new directory to
the PATH. Then you need to move /bin/ls to the new PATH directory.

3. List all configuration files in the file system and write their
functionalities.

Copyright © 62
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Topic 16: Managing Network Connections

Learning Outcomes

By the end of this topic, you should be able to:

1. Explain how Linux implements its network subsystem;

2. Execute a few networking commands on Linux; and

3. Test end-to-end network connections.

Topic Overview

In this last topic, we will discuss about the networking in Linux. Networking is
a very big topic by itself and it involves multiple knowledge areas. As such,
this topic only serves as an introductory for learners to know more about the
command to manage network connections on Linux.

Focus Areas and Assigned Readings

Focus Areas Assigned Readings

Smith, R. W. (2012). Linux essentials.


Indianapolis, IN: John Wiley & Sons.

16.1 Understanding network features Chapter 17, p 285

16.2 Configuring a network connection Chapter 17, pp 287–295

16.3 Testing your network connection Chapter 17, pp 299–303

16.4 Protecting your system from the Chapter 17, p 303


bad guys

63 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Content Summary

16.1 Linux and networking cannot be separated. Linux is created for


networking purposes and most of its main features cater for
computers that communicate with each other. Linux networking stack
is a big topic by itself. Therefore, this topic will only introduce the
learners to the essential and “must know” areas. We are now living in
the era where connectivity is a necessity. Hence, knowing the basics
of how Linux handles networking and how to configure network
interface is a must for learners. This topic will cover the
understanding of Linux networking features, configuring a network
connection and testing Linux network connection. The topic ends by
discussing how to protect Linux from the bad guys.

16.2 Understanding network features

Networking features between computers are defined by the


international standard body called the IETF (Internet Engineering
Task Force). Networking comprises numerous protocols and
technologies that interact in complex ways. Following is the main
networking protocol and terms that are mainly used in the networking
world:

(a) Dynamic host configuration protocol (DHCP);

(b) Ethernet;

(c) Hostname;

(d) Internet;

(e) Internet protocol (IP) address;

(f) Network mask;

(g) Router;

(h) Transmission control protocol (TCP)/IP; and

(i) Wi-Fi.

Copyright © 64
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

16.3 Configuring a network connection

In Linux, there are a few ways to configure the network connections.


The default way is using GUI which is almost the same as Windows.
In this subtopic, we will discuss the ways to configure wired and
wireless network interface as well as understand a few technical
issues in order to handle the problems in network configuration in
Linux. The list of discussion in this subtopic includes:

(a) Deciding whether to use DHCP;

(b) Creating a Wi-Fi connection;

(c) Using a network configuration GUI; and

(d) Using text-based tools.

16.4 Testing your network connection

This part introduces the command used to test network conditions.


This is a diagnostic tool that is very useful especially when you are
stuck with network disconnectivity. A few network tests are identified
and the commands used to diagnose the problem are listed as
follows:

(a) Checking your routing table;

(b) Testing basic connectivity;

(c) Finding break in connectivity;

(d) Testing domain name servers (DNS); and

(e) Checking your network status.

65 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

16.5 Protecting your system from the bad guys

Security is very big topic in computing. We need to really secure our


machines from the bad guys. Security is a huge topic by itself but the
basic things that need to be done to secure your system are:

(a) Shut down unused servers;

(b) Enable firewall;

(c) Use good passwords;

(d) Be suspicious; and

(e) Keep your software up to date.

Study Questions

1. Configure five interface of Ethernet on your machine which uses IP


range from 192.168.1.1 to 192.168.1.5 with subnet of 255.255.255.0.

2. Connect to your Wi-Fi connection using command line interface.

3. List 10 main network applications on Linux using their TCP/IP port.

Copyright © 66
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

Appendices
Appendix A: Learning Support

Tutorials

There are eight hours of face-to-face facilitation in the form of FOUR tutorials
of two hours each. You will be notified of the date, time and location of these
tutorials together with the name and e-mail address of your facilitator as
soon as you are allocated a group.

Discussion and Participation

Besides the face-to-face tutorials, you have the support of online discussions
in myINSPIRE with your facilitator and course mates. Your contributions to
online discussions will greatly enhance your understanding of the course
content and help you complete the assignment(s) and prepare for the
examination.

Feedback and Input from Facilitator

As you work on the activities and the assigned text(s), your facilitator will
provide assistance to you throughout the duration of the course. Should you
need assistance at any time, do not hesitate to contact your facilitator and
discuss your problems with him or her.

Bear in mind that communication is important for you to be able to get the
most out of this course. Therefore, you should, at all times, be in touch with
your facilitator, e-facilitator and course mates, and be aware of all the
requirements for successful completion of the course.

Tan Sri Dr Abdullah Sanusi (TSDAS) Digital Library

The TSDAS Digital Library has a wide range of print and online resources for
the use of its learners. This comprehensive digital library provides access to
more than 30 online databases comprising e-journals, e-theses, e-books and
more. Examples of databases available are EBSCOhost, ProQuest,
SpringerLink, Books24x7, InfoSci Books, Emerald Management Plus and
Ebrary Electronic Books. As an OUM learner, you are encouraged to make
full use of the resources available through this library.

67 © Open University Malaysia (OUM)


Copyright
STUDY GUIDE CBLX3103 Introduction to Linux

Appendix B: Study Tips

Time Commitments for Study

You should plan to spend about 12 hours of study time on each topic, which
includes completing all assigned readings and activities. You must also set
aside time to discuss work online. It is often more effective to distribute the
study hours over a number of days rather than spend a whole day studying
one topic.

Study Strategy

The following is a proposed strategy for working through the course. If you
have difficulty following this strategy, discuss your problems with your
facilitator either through the online forum or during the tutorials.

(a) The most important step is to read the contents of this Study Guide
thoroughly.

(b) Organize a study schedule (as recommended in Table 2). Take note of
the amount of time you spend on each topic as well as the dates for
submission of assignment(s), tutorials and examination.

(c) Once you have created a study schedule, make every effort to stick to
it. One reason learners are unable to cope with postgraduate courses
is that they procrastinate and delay completing their course work.

(d) You are encouraged to do the following:

(i) Read the Study Guide carefully and look through the list of topics
covered. Try to examine each topic in relation to other topics;

(ii) Complete all assigned readings and go through as many


supplementary texts as possible to get a broader understanding
of the course content;

(iii) Go through all the activities and study questions to better


understand the various concepts and facts presented in a topic;
and

(iv) Draw ideas from a large number of readings as you work on the
assignments. Work regularly on the assignments as the semester
progresses so that you are able to systematically produce a
commendable paper.

Copyright © 68
Open University Malaysia (OUM)
STUDY GUIDE CBLX3103 Introduction to Linux

(e) When you have completed a topic, review the Learning Outcomes for
the topic to confirm that you have achieved them and are able to do
what is required.

(f) After completing all topics, review the Learning Outcomes of the course
to see if you have achieved them.

69 © Open University Malaysia (OUM)


Copyright
Copyright © Open University Malaysia (OUM)

You might also like