Previous | Next

Objectives| Introduction| What System Administrators Do| What System Administrators Need to Know| Why UNIX?| UNIX Past, Present, and Future| Linux| Some Necessary Knowledge| Preemptive Verses Non-preemptive| The vi Editor| Conclusions| Review Questions

Section 1


FOUNDATIONS


Objectives


This section provides the gentle introduction to the profession (some say art) of Systems Administration. This section has been written to

Introduction


Before starting, write down what you think the responsibilities of a Systems Administrator are. At the end of this course come back and see if you agree with what you have written.

Systems Administration is one of the most complex, fulfilling and misunderstood professions within the computing arena. Everybody who uses the computer depends on the Systems Administrator doing their job correctly and efficiently. However the only time users tend to give the Systems Administrator a second thought is when the computer system is not working.

Very few people, including other computing professionals, understand the complexity and the time consuming nature of Systems Administration. Even fewer people realise the satisfaction and challenge that Systems Administration presents to the practitioner. It is one of the rare computing professions in which the individual can combine every facet of the computing field into one career.

At some time during their career a Systems Administrator will make use of knowledge from the following (far from exhaustive) list of fields, both computing and non-computing.


What Systems Administrators do


Systems Administration is an old responsibility gaining new found importance and acceptance as a profession. It has come into existence because of the increasing complexity of modern computer systems and networks and because of the economy's increasing reliance on computers. Any decent size computer site now requires at least one person to keep the computers running happily. If the computers don't work the business suffers.

It can be said that Systems Administrators have two basic reasons for being

These two reasons often conflict with one another. Management will wish to restrict the amount of money spent on computer systems. The users on the other hand will always want more disk space and faster CPUs. The System Administrator must attempt to balance these two conflicting aims.

The real work required to fulfill these aims depends on the characteristics of the particular computing system and the company it belongs to. Factors that affect what a Systems Administrator needs to do come from a number of categories including the following.


Users



Computers



Support



What Systems Administrators need to know


The short and sweet answer is that to be a really good Systems Administrator you need to know everything about the entire computer system including operating system, hardware, software, users, management, network and anything else you can think of that might affect the system in any way.

Failing that lofty aim the System Administrator must have the ability to gain this all encompassing knowledge. The discovery process may include research, trial and error, or begging. The abilities to learn and problem solve may well be the two most important for a Systems Administrator.


Why UNIX?


Some parts of Systems Administration are independent of the type of computer being used, for example handling user complaints and getting on with management. However by necessity there is a great deal of complex platform dependent knowledge that a Systems Administrator must have in order to carry out their job.

Tell me and I'll forget; show me and I may remember;
involve me and I'll understand.

This text has been written with the UNIX operating system in mind as the main computing platform. In particular this text has been written with the Linux operating system, a version of UNIX that runs on IBM PC clones, in mind. It is necessary to have access to the root password of a UNIX (not necessarily Linux) machine to get the most benefit from this course.

The reasons for choosing UNIX, and especially Linux, over any of the other available operating systems include

Just as there are advantages in using UNIX there are also disadvantages. "My Operating System is better than yours" is a religious war that I don't want to discuss here.


UNIX Past, Present and Future


The history of UNIX is an oft told tale and it is sometimes hard to pick the right version. The story has been told many ways and the following is one version.
Reading.
Unix System Administration Handbook (2nd Ed.) 1.1 The Sorid History of UNIX

Purpose.
To provide some idea of how UNIX developed to explain why it is where it is today.

At the current point in time it appears that UNIX has esconced itself into the following market niches Both these roles are being challenged by the arrival of new operating systems like Windows NT.

Linux


This course has been specifically written to centre on the Linux operating system. Linux was chosen because it is a free, complete version of the UNIX operating system that will run on cheap, entry level machines. The following reading provides you with some background into the development of Linux.
Reading.
Unix System Administration Handbook (2nd Ed.) 1.2 Contemporary UNIX Products

Purpose.
Explain the origins and development process that brought Linux to life so that you understand where it fits into the entire picture.


Some Necessary Knowledge


The rest of this section is taken up with imparting to you some of the basic knowledge that is required. The list of topics and jargon is by no means complete but it is a start.


The Operating System


Essentially the operating system is the most important piece of software on a machine. This piece of software acts like the elected government of the computer system it provides One of the major acts to be carried out during the booting of a computer is the loading and running of the operating system kernel. The kernel is the name given to the executable program that is the operating system. The kernel contains all the code that specifies how the operating system is to perform its duties. The actual format and content of the kernel will depend on the type of operating system. A later section of this course will examine specifics about the kernel of a UNIX operating system.

One of the defining characteristics of an operating system is the number of people and the number of programs that can use the operating system at any one time. Table 1.1 outlines some of the terminology.

Term			Meaning

single user		Only one person can use the operating system.
multi user		Many people can use the system at the same time.
			  The OS must prevent different users from
			  interfering with each other.
single tasking		*Only one process (a running program) can be
			  running at any time.
multi tasking		*Multiple process can appear to be executing at
			  any one time.
preemptive		The operating system decides when a process has
  multi tasking		  had enough time on the CPU.
non-preemptive		The process itself decides when it has had enough
  multi tasking		  time.

	* sometimes known as single and multi programming or processing.

	Table 1.1.  Characteristics of an Operating System.
Table 1.2 relates these characteristics to some of today's operating systems.

Operating System	Characteristics

MS-DOS			single-tasking, single user
			  (not much of an OS)
Windows			non-preemptive multi tasking, single user
Windows NT		preemptive multi tasking, single user*
OS/2			preemptive multi tasking, single user
UNIX			preemptive multi tasking, multi user

	* Microsoft say its multi-user and it is after a fashion.
	  You can have multiple users but only one of them can use
	  the machine at any one time.

	Table 1.2.  Charactericistics of Today's Operating Systems.

Preemptive versus Non-preemptive


When an operating system allows multitasking it appears that many processes are all executing at the same time. This is not the case!

The CPU (central processing unit) can only execute one instruction at a time. So only one process is actually being executed. The others are waiting for their turn on the CPU. Multitasking works by the processes sharing the CPU time. One process will use the CPU for a time and then another will use it. It appears that many processes are running because this change occurs very quickly.

Who decides when to change the process on the CPU?

The answer to this question is the basic difference between preemptive and non-preemptive multitasking. In a preemptive system the operating system decides when a process has had enough time on the CPU. In a non-premptive OS each process can decide when it has had enough.

Under a non-preemptive system problems arise if you have a process that is greedy or goes into an endless loop. It will never get off the CPU.


The vi Editor


The mention of vi sends shudders through the spines of some people, while other people will quiver with pleasure. vi is a standard UNIX editor that has the deserved status of being a mongrel to learn. However hand in hand with the difficulty of learning comes a very powerful editor. It is strongly suggested that you use and become familiar with vi.


Why vi?


vi is an anachronistic antique of an editor hated by most people but it is very powerful once you understand its intricacies and more importantly, it is the only screen editor available on every UNIX system which is why we will cover it.


How to use vi.


vi is a modal editor. That means that it has different modes and depending on the mode it is in, certain keys will perform different tasks.

Mode Name	Purpose

Command Mode	most keys perform a specific vi command, when vi is
		  started it is in this mode
Insert Mode	is initiated by many different vi commands, in this mode
		  letters typed are inserted at the current cursor location,
		  hitting the ESC key will return vi to Command Mode
Ex Escape Mode	allows the use of ex commands for the editing of text.
(last line mode)  Enter this mode by typing a colon : while in command mode.
		  The colon will appear at the bottom of the screen, when
		  you hit enter you will be returned to Command Mode

	Table 1.3.  vi Modes.
vi performs all editing on a copy of the file that is held in an editing buffer. Changes are not made to the actual file until they are explicitly saved using the appropriate command.During one editing session you can be editing multiple files. This is done by specifying all the files you wish to edit when starting vi, and using special editing commands to change between the different files.

vi also supplies a mechanism to enable file recovery. If the system crashes while editing a file with vi the file can be recovered.

vi accepts a number of command-line switches that modify its operation. Table 1.4 lists some of these command line options.

Switch		Purpose

-r file		attempt to recover file
-L		list all files that can be recovered after a system crash
-R		invokes vi using read only mode.  The file will not be
		  able to be modified
+command	after invoking vi execute the vi command signified by
		  command
command		any cursor positioning command

	Table 1.4. vi Command-Line Switches.

Exiting vi.


Table 1.5 lists some of the different methods that can be used to exit from vi. All methods shown must be carried out from command mode.

Command	Purpose

:q	quit only if no changes were made
:q!	exit and don't save any changes
:wq	save the editing buffer and then exit
:x	same as ZZ
ZZ	save the editing buffer only if changes were made and then exit

	Table 1.5. Commands to exit vi.

vi's File Manipulation Commands.


vi provides many methods for manipulating files. Table 1.6 lists some of them.

Command		Purpose

:r file		read a file into the buffer after the current line
:xr file	read a file into the buffer after the line specified by x
:w [file]	save the edit buffer to a file, if no filename is
		  specified the current filename is assumed
:w! [file]	:w may not work all the time (e.g. the file already exists,
		  the file is readonly), the ! tells vi to try its best
:s,ew [file]	save the section of the buffer specified s (start line)
		  and e (end line) including those lines

		Table 1.6. vi's File Manipulation Commands.

vi's Text Insertion Commands.


Table 1.7 lists the commands used to take vi from command mode into insert mode.vi has a number of special features that work in conjunction with most of the commands listed in Tables 1.7-1.10 including For example:
Typing (while in command mode)
75i
hello
<ESCAPE-KEY>
will insert the word hello 75 times.
Command	Purpose

i	insert text before current cursor location
a	insert text after the current cursor location
I	insert text at the start of the current line
A	insert text at the end of the current line
o	insert text on a new line below the current line
O	insert text on a new line above the current line

	Table 1.7. vi's Text Insertion Commands.

Inserting Control Characters


There will come times when it is wished to manipulate control characters.

For example:

A user has just copied a text file from and MS-DOS machine. The differences between what MS-DOS uses to indicate the end of a line and how UNIX performs the same task means that there are additional ^M characters at the end of each line. A command to remove these characters might be
sed '1,$s/^M//g' msdos.file
This command is designed to replace the control M character (ASCII value 13) with nothing. Simply typing a ^ character followed by an M character will not work (this will replace the two characters ^ and M with nothing).

Some systems allow a control character to be specified by hitting the CTRL-V key combination, and then entering the desired control character.


vi's Text Modification Commands


Table 1.8 lists the vi commands used to move, delete and copy text.

Command	Purpose

dw	delete word under the cursor
dd	delete current line
D	delete to the end of the current line
X	delete the character before the cursor
x	delete the character under the cursor
cw	delete current word and enter Insert Mode
cc	delete current line and enter Insert Mode
rc	replace current character with the character c
J	join the current and next lines together

		Table 1.8. vi's Text Modification Commands.

vi's Screen Control Commands


Table 1.9 lists the vi commands used to move the screen.

Command		Purpose

<ctrl-d>	scroll forward half a screen
<ctrl-u>	scroll backward half a screen
<ctrl-f>	move forward a whole screen
<ctrl-b>	move backward a whole screen
<ctrl-l>	redraw the screen

		Table 1.9. vi's Screen Control Commands.

vi's Cursor Movement Commands.


Table 1.10 lists the commands used to move the cursor.

Command	Purpose
l, spacebar or right cursor key		move one space right
h, backspace or left cursor key		move one space left
j, + or down cursor key			move one line down
k, - or up cursor key			move one line up
H	move to the top left hand corner of the screen
M	move to the middle of the screen
L	move to the start of the last line on the screen
$	move to end of the current line
0	move to the start of the current line
^	move to the first non-blank character of the current line
w	move to next word
e	move the end of the current word
b	move to previous word
(	move to the start of a sentence
)	move to the start of the next sentence
{	move to the start of a paragraph
}	move to the start of the next paragraph
nG	move to line number n

		Table 1.10. vi's Cursor Movement Commands.

Conclusions


Systems Adminsitration is a complex and interesting field requiring knowledge from most of the computing area. It provides a challenging and interesting career. The UNIX operating system is an important and available competitor in the current operating systems market and forms the practical system for this subject.


Review Questions


1.1. What does a Systems Administrator do?

1.2. What characteristics would make a good Systems Administrator?

1.3. What are the primary aims of an operating system?

1.4. List the current operating systems you consider important in the commerical environment.

1.5. What is a kernel?


Previous | Next

David Jones (author)
Chris Hanson (html 22/08/96)