high-level programming languages
like FORTRAN,
requiring that the program to be run first be translated into machine language before it
could be executed. The translation process required running another program, the
compiler
.
So the programmer would have to specify that to run their program, first they would have
to load and run the FORTRAN compiler which would input their program. The FORTRAN
*
At the time of writing, the current version of CentOS is 6.4. This is the version primarily covered in this chapter.
4
◾
Linux with Operating System Concepts
compiler would execute, storing the result, a compiled or machine language program, onto
tape. The programmer would then load their program from tape and run it. See the process
as illustrated in Figure 1.1. In order to help facilitate this complex process, programmers
developed the
resident monitor
. This program would allow a programmer to more easily
start programs and handle simple input and output. As time went on, programmers added
more and more utilities to the resident monitor. These became operating systems.
An operating system is a program. Typically it comprises many parts, some of which are
required to be resident in memory, others are loaded upon demand by the operating sys-
tem or other applications software. Some components are invoked by the user. The result is
a layered series of software sitting on top of the hardware.
The most significant component of the operating system is the
kernel
. This program con-
tains the components of the operating system that will stay resident in memory. The kernel
handles such tasks as process management, resource management, memory management,
and input/output operations. Other components include services which are executed on-
demand, device drivers to communicate with hardware devices, tailored user interfaces
such as shells, personalized desktops, and so on, and operating system utility programs
such as antiviral software, disk defragmentation software, and file backup programs.
The operating system kernel is loaded into memory during the computer’s booting oper-
ation. Once loaded, the kernel remains in memory and handles most of the tasks issued
to the operating system. In essence, think of the kernel as the interface between the users
Mount compiler program
onto tape drive
Load compiler into memory
and run the compiler
Load programmer’s source
code (via punch cards)
as input to compiler
Run compiler on source
code, save output (compiled
program) to another tape
Unmount compiler, mount
compiled program
Run program using
punch cards for input,
save output to tape
Unmount output tape, move
to print spooler to print results
aaaaaaa bbbbb cccc
11111 113333 4333
57175 382383 15713
5713987 137 1 81593
137565 173731 191
5715 5275294 2349782
3578135 31487317 32
3534 3978348934 34
869725 25698754 34
6598 3897 3459734
6897897 539875 34
FIGURE 1.1
Compiling and running a program.
Introduction to Linux
◾
5
and application software, and the hardware of the computer system. Figure 1.2 illustrates
the various levels of the computer system from the user at the top to the hardware at the
bottom. The idea is that the user controls the computer through layers of software and
hardware components. First, the user interfaces with the running application software.
The user might for instance select Open and then select a file to open in the software. The
application software then communicates with the OS kernel through system calls. The ker-
nel communicates with the hardware via device drivers. Further, the user might communi-
cate directly with the operating system through services and an OS shell. We will explore
operating system concepts in more detail as we move throughout the chapter.
1.3 THE LINUX OPERATING SYSTEM: GUIs
As with most operating system today, Linux can be operated through a GUI. Many users
only have experience with a GUI and may not even be aware that there is a text-based
(command-line) interface available. It is assumed, because you are using this book, that
you want to understand the computer’s operating system at more than a cursory level. We
will want to explore beyond the GUI. In Linux, it is very common to use the CLI as often,
or even more often, than the GUI. This is especially true of a system administrator because
many tasks can only be performed through the CLI. But for now, we will briefly examine
the Linux GUI.
The two common GUIs in Red Hat Linux are Gnome and KDE. Both of these GUIs
are built on top of an older graphical interface system called X-Windows. X-Windows,
or the X Window System, was first developed at MIT in 1984. It is free and open source.
User
Hardware
Application software
Operating system utilities
Layers
of the
operating
system
Software device drivers
ROM BIOS device drivers
Operating system kernel
Services
Shells
FIGURE 1.2
Layers of the computer system.
6
◾
Linux with Operating System Concepts
The windowing system is architecture-independent meaning that it can be utilized on any
number of different platforms. It is also based on a client–server model where the X Server
responds to requests from X Clients to generate and manipulate various graphical items
(namely windows). The clients are applications that use windows to display their contents
and interact with the users. The clients typically run on the same computer as the server
but can also run remotely allowing a server to send its windowing information to comput-
ers over a network. This allows the user to access a remote computer graphically. The cur-
rent version of X Windows is known as X11.
With X Windows implemented, users have a choice between using X or a more advanced
GUI that runs on top of (or is built on top of) X Windows. In our case, we will examine
two such windowing systems: Gnome and KDE. Both GUIs offer very similar features
with only their appearances differing. And although each comes with its own basic set of
application software, you can access some of the software written for one interface in the
other interface (for instance, many KDE applications will run from within Gnome). We
will briefly examine both windowing systems here but it is assumed that the reader will
have little trouble learning either windowing system.
1.3.1 User Account and Logging In
To use Linux, you must of course have it installed on your computer. Many people will
choose to install Linux as a dual booting operating system. This means that when you first
boot your computer, you have a choice of which operating system to boot to. In most cases,
the dual booting computers have a version of Windows and (at least) one version of Linux.
You can also install Linux as the only operating system on your computer. Alternatively,
you can install Linux inside of a VM. VMs are described in Section 1.5 of this chapter.
To use Linux, you must also have a user account on the machine you are seeking to access.
User accounts are installed by the system administrator. Each user account comes with its
own resources. These include a home directory and disk space, a login shell (we cover shells
in Chapter 2), and access rights (we cover permissions in Chapter 3). Every account comes
with a username and an associated password that only the user should know. We explore
the creation of user accounts and other aspects of user accounts in Chapter 9.
After your computer has booted to Linux, you face a login screen. The login mechanism
supports operating system security to ensure that the user of the computer (1) is an autho-
rized user, and (2) is provided certain access rights. Authentication is performed through
the input of the user’s username and password. These are then tested against the stored
passwords to ensure that the username and password match.
In CentOS 6, the login screen provides the user with a list of the system’s users. If your
username appears in this list, you can click on your name to begin the login process.
Alternatively, if your name does not appear, you must click on the “Other…” selection
which then asks you to enter your user name in a textbox. In either case, you are then asked
to enter your password in a textbox. Figure 1.3 illustrates this first login screen.
If you select “Other…,” the login window changes to that shown in Figure 1.4. Now you
are presented with a textbox to enter your user name. At this point, you may either click on
“Log In” or press the enter key.
Introduction to Linux
◾
7
The login process is complete if the user name and password match the stored password
information. If not, you will be asked to try to log in again.
The default is to log you into the GUI. However, you can also set up the login program
to log you into a simple text-based, single window for command line interaction. We will
concentrate on the two most common GUIs in Red Hat Linux, Gnome, and KDE here.
1.3.2 Gnome
The Gnome desktop is shown in Figure 1.5. Along the top of the desktop are menus:
Applications, Places, System. These menus provide access to most of the applications soft-
ware, the file system, and operating system settings, respectively. Each menu contains
FIGURE 1.3
Login screen.
FIGURE 1.4
Logging in by user name.
8
◾
Linux with Operating System Concepts
submenus. The Applications menu consists of Accessories, Games, Graphics, Internet,
Office, Programming, Sound & Video, and System Tools.
The Accessories submenu will differ depending on whether both Gnome and KDE are
installed, or just Gnome. This is because the KDE GUI programs are available in both win-
dowing systems if they are installed.
Two accessories found under this submenu are the Archive Manager and Ark, both
of which allow you to place files into and extract from archives, similar to Winzip in
Windows. Other accessories include two calculators, several text editors (gedit, Gnote,
KNotes, KWrite), two alarm clocks, a dictionary, and a screen capture tool. Figure 1.6
shows the full Accessories menu, showing both Gnome-oriented GUI software and KDE-
oriented GUI software (KDE items’ names typically start with a “K”). The KDE GUI soft-
ware would not be listed if KDE accessories have not been installed.
The Games, Graphics, and Internet menus are self-explanatory. Under Internet, you will
find the Firefox web browser as well as applications in support of email, ftp, and voice over
IP telephony and video conferencing. Office contains OpenOffice, the open source version
of a productivity software suite. OpenOffice includes Writer (a word processor), Calc (a
spreadsheet), Draw (drawing software), and Impress (presentation graphics software). The
items under the Programming menu will also vary but include such development environ-
ments as Java and C
++
. Sound & Video contain multimedia software.
Finally, System Tools is a menu that contains operating system utilities that are run
by the user to perform maintenance on areas accessible or controllable by the user. These
include, for instance, a file browser, a CD/DVD creator, a disk utility management pro-
gram, and a selection to open a terminal window, as shown in Figure 1.7. To open a termi-
nal window, you can select Terminal from the System Tools menu. If KDE is available, you
can also select Konsole, the KDE version of a terminal emulator.
The next menu, Places, provides access to the various storage locations available to
the user. These include the user’s home directory and subdirectories such as Documents,
FIGURE 1.5
Gnome desktop.
Introduction to Linux
◾
9
Pictures, Downloads; Computer to provide access to the entire file system; Network, to
provide access to file servers available remotely; and Search for Files… which opens a GUI
tool to search for files. The Places menu is shown in Figure 1.8. Also shown in the figure is
the Computer window, opened by selecting Computer from this menu. You will notice two
items under Computer, CD/DVD Drive, and Filesystem. Other mounted devices would
also appear here should you mount any (e.g., flash drive).
FIGURE 1.6
Accessories menu.
FIGURE 1.7
System tools submenu.
10
◾
Linux with Operating System Concepts
Selecting any of the items under the Places menu brings up a window that contains the
items stored in that particular place (directory). These will include devices, (sub)directo-
ries, and files. There will also be links to files, which in Linux, are treated like files. Double
clicking on any of the items in the open window “opens” that item as another window.
For instance, double clicking on Filesystem from Figure 1.8 opens a window showing the
contents of Filesystem. Our filesystem has a top-level name called “/” (for root), so you see
“/” in the title bar of the window rather than “Filesystem.” The window for the root file
system is shown in Figure 1.9. From here, we see the top-level Linux directories (we will
discuss these in detail in Chapters 3 and 10). The subdirectories of the root filesystem are
predetermined in Linux (although some Linux distributions give you different top-level
directories). Notice that two folders have an X by them: lost
+
found and root. The X denotes
that these folders are not accessible to the current user.
FIGURE 1.8
Places menu.
FIGURE 1.9
Filesystem folder.
Introduction to Linux
◾
11
The final menu in the Gnome menu bar is called System. The entries in this menu allow
the user to interact with the operating system. The two submenus available are Preferences
and Administration. Preferences include user-specific operating preferences such as the
desktop background, display resolution, keyboard shortcuts, mouse sensitivity, screen
saver, and so forth. Figure 1.10 illustrates the Preferences submenu.
Many of the items found under the Administration submenu require system adminis-
trator privilege to access. These selections allow the system administrator to control some
aspect of the operating system such as changing the firewall settings, adding or deleting
software, adding or changing users and groups, and starting or stopping services. These
settings can also be controlled through the command line. In some cases in fact, the com-
mand line would be easier such as when creating dozens or hundreds of new user accounts.
The Administration submenu is shown in Figure 1.11.
The System menu includes commands to lock the screen, log out of the current user, or
shut the system down. Locking the screen requires that the user input their password to
resume use.
There are a number of other features in the desktop of Gnome. Desktop icons, similar
to Windows shortcut icons, are available for the Places entries of Computer, the user’s
home directory, and a trash can for deleted files. Items deleted via the trash can are still
stored on disk until the trash is emptied. You can add desktop icons as you wish. From
the program’s menu (e.g., Applications), right click on your selection. You can then select
“Add this launcher to desktop.” Right clicking in the desktop brings up a small pop-up
FIGURE 1.10
Preferences submenu under system menu.
12
◾
Linux with Operating System Concepts
menu that contains a few useful choices, primarily the ability to open a terminal window.
Figure 1.12 shows this menu.
Running along the top of the desktop are a number of icons. These are similar to desktop
icons. Single clicking on one will launch that item. In the case of the already existing icons,
these pertain to application software. You can add to the available icons by selecting an
application from its menu, right clicking on it and selecting “Add this launcher to panel.”
As seen in Figure 1.5 (or Figure 1.11), the preexisting icons are (from left to right) the
Firefox web browser, Evolution email browser, and Gnote text editor. Toward the right of
the top bar are a number of other icons to update the operating system, control speaker
volume, network connectivity, the current climate conditions, date and time, and the name
of the user. Clicking on the user’s name opens up a User menu. From this menu, you can
obtain user account information, lock the screen, switch user or quit, which allows the user
to shut down the computer, restart the computer, or log out.
FIGURE 1.11
Administration submenu.
FIGURE 1.12
Desktop menu.
Introduction to Linux
◾
13
At the bottom of the desktop is a panel that can contain additional icons. At the right of
the panel are two squares, one blue and one gray. These represent two different desktops, or
“workspaces.” The idea is that Gnome gives you the ability to have two (or more) separate
work environments. Clicking on the gray square moves you to the other workspace. It will
have the same desktop icons, the same icons in the menu bar, and the same background
design, but any windows open in the first workspace will not appear in the second. Thus,
you have twice the work space. To increase the number of workspaces, right click on one
of the workspace squares and select Properties. This brings up the Workspace Switcher
Preferences window from which you can increase (or decrease) the number of workspaces.
1.3.3 KDE Desktop Environment
From the login screen you can switch desktops. Figure 1.13 shows that at the bottom of the
login window is a panel that allows you to change the language and the desktop. In this
case, we can see that the user is selecting the KDE desktop (Gnome is the default). There
is also a selection to change the accessibility preferences (the symbol with the person with
his or her arms outspread) and examine boot messages (the triangle with the exclamation
point). The power button on the right of the panel brings up shutdown options.
Although the Gnome environment is the default GUI for Red Hat, we will briefly also
look at the KDE environment, which is much the same but organized differently. Figure
1.14 shows the desktop arrangement. One of the biggest differences is in the placement of
the menus. Whereas Gnome’s menus are located at the top of the screen, KDE has access to
menus along the bottom of the screen.
There are three areas in the KDE Desktop that control the GUI. First, in the lower left-
hand corner are three icons. The first, when clicked on, opens up the menus. So, unlike
Gnome where the menus are permanently part of the top bar, KDE uses an approach more
like Windows “Start Button menu.” Next to the start button is a computer icon to open up
the Computer folder, much like the Computer folder under the Places menu in Gnome. The
next icon is a set of four rectangles. These are the controls to switch to different workspaces.
The default in KDE is to have four of them.
FIGURE 1.13
Selecting the KDE desktop.
14
◾
Linux with Operating System Concepts
On the bottom right of the screen, are status icons including the current time of day
and icons that allow you to manipulate the network, the speaker, and so on. In the upper
right-hand corner is a selection that brings up a menu that allows you to tailor the desktop
by adding widgets and changing desktop and shortcut settings.
Figure 1.15 illustrates the start button menu. First, you are told your user name, your
computer’s host name, and your “view” (KDE, Desktop). A search bar is available to search
FIGURE 1.14
KDE desktop.
FIGURE 1.15
Start button applications menu.
Introduction to Linux
◾
15
for files. Next are the submenus. Much like Gnome, these include Graphics, Internet,
Multimedia, and Office. Settings are similar to Preferences from Gnome while System and
Utilities make up a majority of the programs found under Administration in Gnome. Find
Files/Folders is another form of search. Finally, running along the bottom of this menu are
buttons which change the items in the menu. Favorites would list only those programs and
files that the user has indicated should be under Favorites while Computer is similar to the
Computer selection from the Places menu in Gnome. Recently Used lists those files that
have been recently accessed. Finally, Leave presents a pop-up window providing the user
with options to log out, switch user, shut down, or restart the computer.
Finally, as with Gnome, right clicking in the desktop brings up a pop-up menu. The
options are to open a terminal window using the Konsole program, to open a pop-up win-
dow to enter a single command, to alter the desktop (similar to the menu available from the
upper right-hand corner), or to lock or leave the system.
The decision of which GUI to use will be a personal preference. It should also be noted
that both Gnome and KDE will appear somewhat differently in a non-Red Hat version of
Linux. For instance, the Ubuntu version of Gnome offers a series of buttons running along
the left side of the window. To learn the GUI, the best approach is to experiment until you
are familiar with it.
1.4 THE LINUX COMMAND LINE
As most of the rest of the text examines the CLI, we only present a brief introduction here.
We will see far greater detail in later chapters.
1.4.1 The Interpreter
The CLI is part of a
Do'stlaringiz bilan baham: |