Linux Essentials LPI , Study notes of Computer Science

Linux Introductory Program for LPI Program

Typology: Study notes

2016/2017

Uploaded on 10/09/2017

yru4u4ea
yru4u4ea 🇺🇸

1 document

1 / 244

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Linux Essentials
The LPI Introductory Programme
Linup Front GmbH Postfach 10 01 21 64201 Darmstadt Germany
Telefon +49(0) 6151 9067 0 Telefax +49(0) 6151 9067 299 www.linupfront.de
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33
pf34
pf35
pf36
pf37
pf38
pf39
pf3a
pf3b
pf3c
pf3d
pf3e
pf3f
pf40
pf41
pf42
pf43
pf44
pf45
pf46
pf47
pf48
pf49
pf4a
pf4b
pf4c
pf4d
pf4e
pf4f
pf50
pf51
pf52
pf53
pf54
pf55
pf56
pf57
pf58
pf59
pf5a
pf5b
pf5c
pf5d
pf5e
pf5f
pf60
pf61
pf62
pf63
pf64

Partial preview of the text

Download Linux Essentials LPI and more Study notes Computer Science in PDF only on Docsity!

Linux Essentials

The LPI Introductory Programme

Linup Front GmbH ⋅ Postfach 10 01 21 ⋅ 64201 Darmstadt ⋅ Germany Telefon +49(0) 6151 9067 0 ⋅ Telefax +49(0) 6151 9067 299 ⋅ www.linupfront.de

Linup Front GmbH is a leading supplier of high-quality training materials for Linux and Open Source topics, at reason- able prices – for self-study, school, higher and continuing education and professional training. Please visit http://shop.linupfront.com/ for details and pricing, or contact us with questions or suggestions.

All representations and information contained in this document have been com- piled to the best of our knowledge and carefully tested. However, mistakes cannot be ruled out completely. The authors and Linup Front GmbH assume no respon- sibility or liability resulting in any way from the use of this material or parts of it or from any violation of the rights of third parties. Reproduction of trade marks, service marks and similar monikers in this docu- ment, even if not specially marked, does not imply the stipulation that these may be freely usable according to trade mark protection laws. All trade marks are used without a warranty of free usability and may be registered trade marks of third parties.

This document is published under the “Creative Commons-BY-NC-ND 3.0 Un- ported” licence. You may copy and distribute it and make it publically available as long as the following conditions are met:

Attribution You must make clear that this document is a product of Linup Front GmbH.

No commercial use You may not use this document for commercial purposes (contact us if you want to use this document commercially).

No derivatives You may not alter, transform, or build upon this document (con- tact us if necessary).

The full legal license grant can be found at http://creativecommons.org/licenses/by- nc- nd/3.0/legalcode

Authors: Tobias Elsner, Thomas Erker, Anselm Lingnau Technical Editor: Anselm Lingnau ⟨ anselm.lingnau@ linupfront.de ⟩ Typeset in Palatino, Optima and DejaVu Sans Mono Register this manual on-line via the QR code on the left or http://shop.linupfront. com/register/hnINuUQTazcf7HFRIM80of/ for updates and interesting special offers.

List of Tables

Preface

Linux Essentials is a new certification by the Linux Professional Institute (LPI) which is aimed especially at schools and universities in order to introduce children and young adults to Linux. The Linux Essentials certificate is slated to define the basic knowledge necessary to use a Linux computer productively, and through a cor- responding education programme aid young people and adults new to the open source community in understanding Linux and open-source software in the con- text of the ITC industry. See appendix C for more informaton about the Linux Essentials certificate. With this training manual, Linup Front GmbH introduces the first comprehen- sive documentation for Linux Essentials exam preparation. The manual presents the requisite knowledge extensively and with many practical examples and thus provides candidates, but also Linux newcomers in general, with a solid founda- tion for using and understanding the free Linux operating system as well as for attaining in-depth knowledge about running and administering Linux. In addi- tion to a detailed introduction to the background of Linux and free/open-source software, we explain the most important Linux concepts and tools such as the shell, how to handle files and scripts, and the file system structure. Insights into system administration, user and permission management and Linux as a network- ing client round off the presentation. Based on the content of this training manual, Linux Essentials alumni are well- prepared to pursue further certifications including the LPI’s LPIC programme as well as vendor-specific certificates like those from Red Hat or Novell/SUSE. The training manual is particularly suitable for a Linux Essentials preparation class at general-education or vocational schools, academies, or universities, but by virtue of its detailed approach and numerous exercises with sample solutions can also be used for self-study. This courseware package is designed to support the training course as effi- ciently as possible, by presenting the material in a dense, extensive format for reading along, revision or preparation. The material is divided in self-contained chapters detailing a part of the curriculum; a chapter’s goals and prerequisites chapters

goals prerequisites

are summarized clearly at its beginning, while at the end there is a summary and (where appropriate) pointers to additional literature or web pages with further information.

B Additional material or background information is marked by the “light- bulb” icon at the beginning of a paragraph. Occasionally these paragraphs make use of concepts that are really explained only later in the courseware, in order to establish a broader context of the material just introduced; these “lightbulb” paragraphs may be fully understandable only when the course- ware package is perused for a second time after the actual course.

A Paragraphs with the “caution sign” direct your attention to possible prob- lems or issues requiring particular care. Watch out for the dangerous bends!

C Most chapters also contain exercises, which are marked with a “pencil” icon^ exercises at the beginning of each paragraph. The exercises are numbered, and sam- ple solutions for the most important ones are given at the end of the course-

Computers, Software and

Operating Systems

Contents

1.1 What Is A Computer, Anyway?............... 14 1.2 Components Of A Computer............... 15 1.3 Software....................... 19 1.4 The Most Important Operating Systems............ 20 1.4.1 Windows And OS X................. 20 1.4.2 Linux...................... 21 1.4.3 More Differences And Similarities............ 22 1.5 Summary....................... 22

Goals

  • Obtaining basic computer hardware knowledge
  • Being aware of different operating systems and assessing their commonali- ties and differences

Prerequisites

  • Basic computing knowledge is useful

lxes-intro.tex ()

14 1 Computers, Software and Operating Systems

1.1 What Is A Computer, Anyway?

Before we get into the details of what a computer is, here are a few quotes from notable people within the computing community:

“Originally one thought that if there were a half dozen large com- puters in [the United States], hidden away in research laboratories, this would take care of all requirements we had throughout the country.” Howard H. Aiken, 1952

Howard Aiken was a computing pioneer and the designer of IBM’s first computer, Early computers the “Harvard Mark I”. The first computers in a modern sense were built during World War II to assist with decrypting secret messages or doing difficult calcu- lations, and they were big, complicated and error-prone devices – the electronic components such as transistors or integrated circuits which today’s computers consist of hadn’t been invented yet. What did come to light during this time and the years immediately after the war were a number of basic assumptions that had to hold for a device to be considered a “computer”:

  • A computer processes data according to a sequence of automatically executed instructions, a program.
  • Programs must allow for conditional execution and loops.
  • It must be possible to change or replace the program that a computer exe- cutes.

For example, many technical devices – from television sets and digital cameras to washing machines or cars – today contain programmed control units, almost small computers. Even so, we don’t consider these devices “computers”, because they only execute fixed, unchangeable programs. Conversely, a pocket calculator can be used to “process data”, but – at least as long as it isn’t a more expensive “programmable calculator” – that doesn’t happen automatically; a human being must tap the keys. In the early 1950s, computers were highly specialised devices that one would

  • exactly as Aiken stipulated – expect to see mostly within research institutions. Science-fiction films of the time display the halls, replete with rows of cupboards containing mysterious spinning reels. Within the space of not quite 70 years, this image has changed dramatically^1.

“There is no reason for anyone to have a computer in their home.” Ken Olsen, 1977

“Small” computers in the 1970s Ken Olsen was the CEO of another computer manufacturer, Digital Equipment Corporation (DEC), which spearheaded the development of “small” computers in the 1970s^2 – where “small” at the time was understood as meaning something like “does not need a machine hall with air conditioning and its own power plant and costs less than a million dollars”; advances in hardware technology allowed this to change, towards the end of the 1970s, to something like “can be bodily lifted by two people”.

B DEC is important to the Linux community because Unix – the operating system that insprired Linus Torvalds to start Linux some twenty years later

  • was first developed on DEC PDP-8 and PDP-11 computers.

home computers The 1970s also saw the advent of the first “home computers”. These cannot be compared with today’s PCs – one had to solder them together on one’s own (which (^1) The classic “quote” in this context is usually ascribed to Thomas J. Watson, the CEO if IBM, who is thought to have said, in 1943, something along the lines of “There is a world market for about five computers”. Unfortunately this has never been verified. And if he did actually claim this in 1943, he would have been right at least for the next ten years or so. (^2) DEC was acquired by Compaq in 1998, and Compaq by Hewlett-Packard in 2002.

16 1 Computers, Software and Operating Systems

can manipulate code just as well as addresses or kitchen recipes. (In the old days, one would “program” by plugging and unplugging leads on the outside of the computer, or programs were punched on paper tape or cards and could not be changed straightforwardly.)

Today’s computers normally feature 1 gibibyte of RAM or more. 1 gibibyte is 230 , or 1, 073, 741, 824 bytes^3 – really an inconceivably large number. By way of comparison: Harry Potter and the Deathly Hallows contains approxi- mately 600 pages of up to 1,700 letters, spaces, and punctuation characters

  • perhaps a million characters. Hence, one gibibyte corresponds to about 1,000 Harry Potter tomes, at somewhat more than a pound per book that is already a van full of them, and if you’re not just interested in the exploits of the young wizard, 1,000 books is an impressive library.

Graphics card Not so long ago people were happy if their computer could con- trol an electric typewriter to produce its output. The old home computers were connected to television sets, producing images that could often only be called atrocious. Today, on the other hand, even simple “smartphones” feature quite impressive graphics, and common PCs contain graphics hard- ware that would have cost the equivalent of an expensive sports car or small house in the 1990s^4. Today’s watchword is “3D acceleration”, which doesn’t mean that the display actually works in 3D (although even that is slowly get- ting fashionable) but that processing the graphics inside the computer does not just involve left, right, top and bottom – the directions visible on a com- puter monitor – but also front and back, and that in quite a literal sense: For photorealistic games it is quite essential whether a monster lurks in front of or behind a wall, hence whether it is visible or not, and one of the goals of modern graphic cards is to relieve the computer’s CPU of such decisions in order to free it up for other things. Contemporary graphics cards con- tain their own processors, which can often perform calculations much faster than the computer’s own CPU but are not as generally useful.

B Many computers don’t even contain a separate graphics card because their graphics hardware is part of the CPU. This makes the computer smaller, cheaper, quieter and more energy-efficient, but its graphics performance will also take somewhat of a hit – which may not be an actual problem unless you are keen on playing the newest games.

Motherboard The motherboard is the (usually) rectangular, laminated piece of plastic that the computer’s CPU, RAM, and graphics card are affixed to – to- gether with many other components that a computer requires, such as con- nectors for hard disks, printers, a keyboard and mouse, or network cables, and the electronics necessary to control these connectors. Motherboards for computers come in all sorts of sizes and colours^5 – for small, quiet comput- ers that can act as video recorders in the living room or big servers that need a lot of space for RAM and several processors.

Power supply A computer needs electricity to work – how much electricity de- pends on exactly which components it contains. The power supply is used to convert the 240 V AC mains supply into the various low DC voltages that the electronics inside the computer require. It must be selected such that it can furnish enough power for all the components (fast graphics cards are usually the number-one guzzlers) while not being overdimensioned so that it can still operate efficiently. (^3) People will commonly call this a “gigabyte”, but a “gigabyte” is really 109 bytes, i. e., nearly 7 per- cent less. (^4) All thanks, incidentally, to the unflagging popularity of awesome computer games. Whoever be- lieves that video games are of no earthly use should take a minute to consider this. (^5) Really! Even though one shouldn’t select one’s motherboard according to colour.

1.2 Components Of A Computer 17

Most of the electricity that the power supply pumps into the computer will sooner or later end up as heat, which is why good cooling is very impor- tant. For simplicty, most computers contain one or more fans to blow fresh air onto the expensive electronics, or to remove hot air from the case. With appropriate care it is possible to build computers that do not require fans, which makes them very quiet, but such computers are comparatively ex- pensive and usually not quite as fast (since, with processors and graphics cards, “fast” usually means “hot”).

Hard disks While a computer’s RAM is used for the data currently being pro- cessed (documents, spreadsheets, web pages, programs being developed, music, videos, …—and of course the programs working on the data), data not currently in use are stored on a hard disk. The main reason for this is that hard disks can store much more data than common computers’ RAM—the capacity of modern hard disks is measured in tebibytes (1 TiB = 240 Byte), so they exceed typical RAM capacities by a factor of 100–1000.

B We pay for this increase in space with a decrease in retrieval times— RAM access times are measured in nanoseconds while those to data on (magnetic) hard disks are measured in milliseconds. This is a mere 6 orders of magnitude—the difference between a metre and 1,000 kilo- metres.

Traditionally, hard disks consist of rotating platters coated with a magneti- sable material. Read/write heads can magnetise this material in different places and re-read the data thus stored later on. The platters rotate at 4, to 15,000 RPM, and the difference between the read/write head and the platter is extremely minute (up to 3 nm). This means that hard disks are quite sensitive to disruption and falls, because if the read/write head comes into contact with the platter while the disk is running—the dreaded “head crash”—the disk is destroyed.

B Newfangled hard disks for mobile computers have acceleration sen- sors which can figure out that the computer is falling, to try and shut down the hard disk in order to prevent damage.

The newest fashion is SSDs or “solid-state disks”, which instead of magne- tised platters use “flash memory” for storage—a type of RAM which can maintain its content even without electricity. SSDs are faster than magnetic hard disks, but also considerably more expensive per gigabyte of storage. However, they contain no moving parts, are impervious to being shoved or dropped, and save energy compared to conventional hard disks, which makes them interesting for portable computers.

B SSDs are also reputed to “wear out” since the flash storage spaces (called “cells”) are only rated for a certain number of write opera- tions. Measurements have shown that this does not lead to problems in practice.

There are various methods of connecting a hard disk (magnetic or SSD) to a computer. Currently most common is “serial ATA” (SATA), older computers use “parallel ATA”, also called “IDE”. Servers also use SCSI or SAS (“serially attached SCSI”) disks. For external disks, one uses USB or eSATA (a variant of SATA with sturdier connectors).

B Incidentally: The difference between gigabytes and gibibytes (or ter- abytes and tebibytes) is most notable with hard disks. For example, you buy a “100 GB drive”, connect it to your computer and, shock hor- ror, realise that your computer only shows you 93 “GB” of free space on the new disk! However, your drive is not damaged (lucky you) –

1.3 Software 19

  • One commendable trend, for example, is the simplification of connec- tions. While almost every class of device used to have their own in- terface (parallel interfaces for printers, serial interfaces for modems, “PS/2” interfaces for keyboards and mice, SCSI for scanners, …), to- day most devices use USB (universal serial bus), a relatively foolproof and reasonably fast method which also supports “hot-plugging” con- nections while the computer is running.
  • Another trend is that towards more “intelligence” in the peripherals themselves: Formerly, even expensive printers were fairly stupid de- vices at an IQ level of electric typewriters, and programmers had to very carefully send exactly the right control codes to the printer to pro- duce the desired output. Today, printers (at least good printers) are re- ally computers in their own right supporting their own programming languages that make printing much less of a hassle for programmers. The same applies in a similar fashion to many other periperals.

B Of course there are still very stupid printers (especially at lower price points) which leave preparing the output to the computer itself. However, these still make a programmer’s life as easy as their more expensive relations.

Exercises

C 1.2^ [2] Open your computer (possibly under the direction of your teacher, instructor, or legal guardian—and don’t forget switching it off and unplug- ging it first!) and identify the most important components such as the CPU, RAM, motherboard, graphics card, power supply, and hard disk. Which components of your computer did we not talk about here?

1.3 Software

Just as important as a computer’s “hardware”, i. e., the technical components it consists of^6 , is its “software”—the programs it is running. This can very roughly be divided into three categories:

  • The firmware is stored on the computer’s motherboard and can only be firmware changed or replaced inconveniently if at all. It is used to put the computer into a defined state after switching it on. Often there is a way of invoking a setup mode that allows you to set the clock and enable or disable certain properties of the motherboard.

B On PCs, the firmware is called “BIOS” (Basic Input/Output System) or, on newer systems, “EFI” (Extensible Firmware Interface).

B Some motherboards include a small Linux system that purportedly boots more quickly than Linux and which is supposed to be used to surf the Internet or watch a DVD without having to boot into Windows. Whether this is actually worth the trouble is up to debate.

  • The operating system makes the computer into a usable device: It manages operating system the computer’s resources such as the RAM, the hard disks, the processing time on the CPU(s) available to individual programs, and the access to other peripherals. It allows starting and stopping programs and enforces a sep- aration between several users of the computer. Besides, it enables—on an elementary level—the participation of the computer in a local area network or the Internet. The operating system frequently furnishes a graphical user (^6) Definition of hardware: “The parts of a computer that can be kicked” (Jeff Pesis)

20 1 Computers, Software and Operating Systems

interface and thus determines how the computer “looks and feels” to its users. When you buy a new computer it is usually delivered with a pre-installed operating system: PCs with Microsoft Windows, Macs with OS X, smart- phones often with Android (a Linux derivative). The operating system, though, is not tied as closely to a computer as the firmware, but can in many cases be replaced by a different one—for example, you can install Linux on most PCs and Macs.

B Or you install Linux^ in addition to^ an existing operating system— usually not a problem either.

User-level programs • User-level programs allow you to do something useful, such as write doc- uments, draw or manipulate pictures, compose music, play games, surf the applications Internet or develop new software. Such programs are also called applica- utilities^ tions. Additionally, there are often^ utilities^ that the operating system pro- vides in order to allow you—or a designated “system administrator”—to make changes to the computer’s configuration and so on. Servers, in turn, often support software that provides services to other computers, such as web, mail or database servers.

1.4 The Most Important Operating Systems

1.4.1 Windows And OS X

When talking about computer operating systems, most people will automatically think of Microsoft Windows^7. This is due to the fact that nowadays most PCs are sold with Windows preinstalled—really not a bad thing in itself, since their owners can get them up and running without having to take the trouble to install an operating system first, but, on the other hand, a problem because it makes life hard for alternative operating sysetms such as Linux.

B In fact it is not at all straightforward to buy a computer without a prein- stalled copy of Windows—for example, because you want to use it exclu- sively with Linux—, except when building one from scratch. Theoretically you are supposed to be able to get a refund for an unused preinstalled copy of Windows from the computer’s manufacturer, but we know of nobody who actually managed to obtain any money.

Windows NT Today’s Windows is a descendant of “Windows NT”, which was Microsoft’s attempt to establish an operating system that was up to the standards of the time in the 1990s (earlier versions such as “Windows 95” were graphical extensions to the then-current Microsoft operating system, MS-DOS, and fairly primitive even by the standards of the day). Decency forbids us a critical appreciation of Win- dows here; let it suffice to say that it does approximately what one would expect from an operating system, provides a graphical user interface and supports most peripheral devices (support for more is provided by the individual device manu- facturers). Apple’s “Macintosh” was launched in 1984 and has since been using an oper- Mac OS ating system called “Mac OS”. Over the years, Apple made various changes to the platform (today’s Macs are technically about the same as Windows PCs) and op- erating system, some of them quite radical. Up to and including version 9, MacOS was a fairly flimsy artefact which, for example, only provided rudimentary sup- port for running several programs at the same time. The current “Mac OS X”—the “X” is a Roman 10, not the letter “X”—is based on an infrastructure related to BSD Unix and is not unlike Linux in many ways. (^7) Many people will not even be aware that there are other operating systems at all.