PARTITION SCHEME 51
(DURING INSTALLATION)
• A particular stage of the Linux Installation
process and is done most often with GUI
partitioning tools
create partitions of a given size
select the filesystem type
assign a mount point for each partition
• A minimal partition scheme involves:
root (/ partition), and
swap (swap partition)
PARTITIONS/DEVICE NAMES 52
SCHEME
• Both IDE and SCSI/SATA disks use device names
/dev/sd?, where the ? is replaced by a letter (a, b,
or c, and so on).
• These partitions (device name) start with the name
of the hard disk and append a number indicating
the partition on that hard disk, e.g. /dev/sda1,
/dev/sda2
• The logical drives/partitions (MBR-style) starting
with number 5. e.g. /dev/sda5
LINUX FILE HIERARCHY 53
root boot bin
directory usr lib
of entire share
filesystem
home Desktop
Documents
{username} Downloads
/ etc
dev
proc
sbin
root
hierarchy tree-structure
WINDOWS FILE HIERARCHY 54
COMPARISON
root Windows System32 Public
directory Microsoft Documents
for drive
Office Public
C Public Downloads
C:\ Program {username} Public Music
Files
Desktop
Users
My
Temp Documents
Downloads
hierarchy tree-structure
LINUX FILE HIERARCHY & PARTITIONS 55
boot mount Desktop
usr point Documents
home Downloads
mount
point
{username}
/ etc
dev mount
proc point
sbin
backup
LINUX FILE HIERARCHY (SINGLE 56
ROOT)
boot
usr {username} Desktop
home Documents
/ etc Downloads
dev
proc
sbin
backup
57
UBUNTU
INITIALIZATION
BOOT PROCESS 58
BIOS begins after the POST (Power
On Self Test)
BIOS hands the boot process over
to the master boot code, one of
several parts of the MBR (Master
Boot Record)
MBR will examine the partition
table, identify the active partition
(the partition that is marked to be
bootable), read the boot sector
from that partition, and then start
the code in that boot sector
BOOT PROCESS CONT. 59
• The code (the boot loader) in the
partition's boot sector will read in
the kernel from the partition and
start it
Note: It is possible to configure
the boot loader to be able to
boot (to choose) one of several
kernels, or even other operating
systems than Linux
• Kernel then runs init process
• The init starts other processes to
allow users to log in, and do things
LINUX BOOT LOADERS 60
• A boot loader is the first software program that runs
when a computer starts
• It is responsible for loading and transferring control
to an operating system kernel software (such as
Linux kernel)
• Types of Linux boot loader:
GRUB (GRand Unified Bootloader)
LILO (LInux LOader)
OS Loader
LOADLIN
GRUB 61
GRUB has two (2) boot methods:
To load an operating system directly (multiboot) – Support for
Linux, FreeBSD, NetBSD and OpenBSD
To chain-load another boot loader which then will load an
operating system actually – It is typically used for loading
Windows
GRUB originated in 1995 by Erich Boleyn, and the
original version of GRUB was renamed to GRUB
Legacy
By the end of 2009, most distributions were
installing GRUB 2 by default
GRUB CONFIGURATION FILES 62
/boot/grub/grub.cfg
grub.cfg is built by the grub2-mkconfig command, and normally
is not edited manually
/etc/default/grub
This file controls the user settings of GRUB2 and usually includes
additional environmental settings such as backgrounds and
themes
Scripts under /etc/grub.d/
The scripts in this directory are read during execution of the
grub2-mkconfig command
Run update-grub to update changes to the configuration
files
63
TOPIC 2: DESKTOP
ENVIRONMENTS AND SHELLS
This Photo by Unknown Author is licensed
under CC BY-NC
LEARNING OUTCOMES 64
Explain the Desktop Environments use in Linux
system
Explain the windowing system in Linux
Explain window managers and desktop
environments
Identify common window managers and desktop
environments used in Linux
Show the desktop environment components and
features.
LEARNING OUTCOMES 65
Explain shells and Common Line Interface for Linux
environment
Define shells and command line interface
Identifies type of shell
Identifies the shell environment files
Identifies the shell metacharacters
Use the command-line prompt from desktop
Use the completion of commands and filenames
Use shell variables and aliases
Use manual pages and info pages
Requirements
Computer (or VM) installed with Ubuntu Desktop
66
DESKTOP
ENVIRONMENTS
DESKTOP ENVIRONMENTS • Graphical user interface (GUI) provides user-friendly 67
interface comprising graphics, widgets, windows or
icons to represent, access and manage desired tasks
and services.
• All GUI-based operating systems use a desktop
environment. Desktop environments contain many
features, including
(but not limited to):
The look and feel of the system
The organization of the desktop
How the user navigates the desktop
A desktop environment is a
collection of software running
on top of an operating system
that makes up the desktop
Graphical User Interface.
Common Linux desktop
environments include xfce, KDE,
unity and GNOME.(but not
limited)
GUI COMPONENTS IN LINUX 68
• The core component of the
GUI is X Window (or X), a
windowing system on
Linux operating systems.
• X provides the ability to
draw graphical images in
windows that are
displayed on a terminal
screen.
• The programs that tell X
Window how to draw the
graphics and display the
results are known as X
clients.
69
WINDOWING SYSTEM • Windowing system
(or window
system) is a type of
graphical user
interface (GUI)
which implements
the WIMP
(windows, icons,
menus, pointer)
paradigm for a
user interface.
WINDOWING SYSTEM IN LINUX 70
• X Window System also called “X Window”, “X11” or
simply “X”, is an open source windowing system.
• It was created in 1984 at Massachusetts Institute of
Technology (MIT)
• The goal was to be able to use the graphical
applications across a network, independent of
hardware.
• The X.Org Foundation governs the X Window standard
for Unix/Linux desktops, and the X.Org Server is the
latest implementation of X Window System.
X WINDOW 71
• Allows graphical applications to be displayed on any monitor, without
running the applications on the machines to which these monitors are
connected – communication between a server component (X server) and
the application itself (client application)
X WINDOW: X SERVER 72
• X server:
Controls the graphical
screen
Manages the input
devices, such as
keyboard and mouse,
and transmits their
actions to the X client
Nothing to do with the
appearance of the
window and the
desktop; this is the task
of the window
manager
X WINDOW: X APPLICATIONS 73
(X CLIENTS)
• Since the user’s machine
handles user input and
output, the X server
always runs in the client
machine (or user’s
machine)
• All application in Linux
desktops are X clients
running in the same
machine as the X server.
WINDOW MANAGER 74
A window manager (WM) is system software that controls the placement and
appearance of windows within a windowing system in a graphical user interface
(GUI). It can be part of a desktop environment (DE) or be used standalone.
Example of window managers: Compiz, Metacity,i3,Awesome WM,
Xmonad, Openbox, dwm, Gala, Kwin, Fluxbox, and etc.
Responsible of the look and feel of X Window
• E.g., its functions are drawing the application borders,
managing the position of the windows, themes and decorations
• Takes the basic windows and provides the program’s window
to move, close, open, etc.
• Switches focus between running applications
• Adds menus and application launchers
DESKTOP ENVIRONMENTS (DE) 75
• A desktop environment is a set of GUI tools designed to be
packaged together, including various types of programs.
• Window manager + tools
Basic tools like calculator, games, notepad
File manager
Workflow tools, such as shortcuts to launch applications or search the
computer
• Gnome and KDE are desktop environments, because beside a
window manager they package a login screen, panels and
systrays as well as certain tools to configure and tweak settings.
DESKTOP ENVIRONMENTS (DE)
Cont. 76
• A desktop environment features included icons, windows, toolbars,
folders, wallpapers and desktop widgets (see Elements of graphical
user interfaces and WIMP).
• A GUI might also provide drag and drop functionality and other
features that make the desktop look more complete.
• DE components included windows manager, panels, menu, system
tray, icons, widgets, launcher, dashboards, file manager, terminal
emulator, text editor, display manager, and configuration tools,
• The explanations of DE components can be found here:
https://www.lifewire.com/linux-desktop-environment-explained-4121640
77
DESKTOP
ENVIRONMENT
EXAMPLE :
GNOME 78
GNOME Desktop Environment
Graphical shell GNOME shell Terminal GNOME Terminal
emulator
Developer The GNOME Project Text editor gedit
Video player Totem
Website http://www.gnome.org Audio player Banshee, Rhythmbox
CD burners Brasero
Main objective Full desktop environment, CD ripper Sound Juicer
graphical, easy to use, targeted Image viewer Eye of GNOME
at everyone. Accent on Office suite GnomeOffice
productivity through Web (formerly called
simplification Web browser Epiphany)
Gitlab.gnome.org/GNOME
Programming Mainly C, as GTK+ is written in C Repository Wayland and X11
language but also in Python, Platform GPL-2.0-or-later
JavaScript,C++,HTML,CSS,C#,D, License
Vala
Window Mutter
manager
X display GDM
manager
File manager GNOME Files (formerly called
Nautilus)
KDE
79
KDE Desktop Environment
Developer KDE Terminal Konsole
emulator KWrite
Graphical shell KDE Plasma 4 Dragon Player
Text editor
Website http://www.kde.org JuK, Amarok
Video K3b
Main objective Full desktop environment, player K3b, KAudioCreator
graphical, easy to use, targeted Gwenview
at everyone. Accent on Audio Calligra Suite, KOffice
maximum reconfigurability player Konqueror
Programming Mainly C++, as Qt is written in CD burners
language C++
CD ripper
Window Kwin
manager Image
viewer
X display KDM
manager Office suite
File manager Dolphin Web
browser
80
DESKTOP
ENVIRONMENT
DEVELOPMENT IN LINUX
NO WINDOWING SYSTEM 81
$ Welcome to shell
$ Everything is text, no cursor
82
WINDOWING SYSTEM $ Welcome to shell
$ Everything is text, no cursor
X-Window is the base
graphical system
Provides window and basic
primitives
WINDOWING SYSTEM + WINDOW Window 83
MANAGER managers add
menus and $ Welcome to shell
window $ Everything is text,
management no cursor
(open, close,
hide, etc)
DESKTOP ENVIRONMENT Desktop 84
environments
provide $ Welcome to shell
window $ Everything is
managers and text, no cursor
tools
85
UBUNTU DESKTOP
UNITY (USER INTERFACE),
GNOME
This Photo by Unknown Author is licensed under CC
BY-NC-ND
UBUNTU DESKTOP 86
The current Ubuntu
desktop is known as
GNOME.
The desktop is
comprised of the
desktop background
and two bars; a
horizontal one located
at the top of your
desktop called menu
bar and a vertically-
oriented bar at the far
left called the Launcher
UBUNTU DESKTOP (VER. 17.10 & 87
ABOVE)
Unity is a graphical shell for the
GNOME desktop environment
originally developed by
Canonical Ltd. for its Ubuntu
operating system, and now
being developed by the Unity7
Maintainers.
Since Ubuntu 17.10, the
desktop environment
has reverted back to
GNOME Desktop.
UBUNTU 20.04.02 and 20.04.03 DESKTOP 88
GUI
Panel
L
a
u
n
c
h
e
r
Applications
Launcher
89
Linux GUIs (Graphical
User Interfaces) & CLI
(Command Line Interfaces)
90
COMMAND-LINE
INTERFACE
SHELLS, LINUX COMMANDS
SHELLS 91
Shell is a program that takes commands from
the keyboard (input) and gives them to OS to perform
Shell provides a user interface and interprets commands entered on
the command line.
Shell is an environment can run commands, programs, and shell
scripts.
Shell prompt ($) is called the command prompt (issued by the shell).
While the prompt is displayed, you can type a command and Shell reads
your input after you press Enter.
Example of date command :
SHELLS 92
Bear in mind : to interact with shell you need a
program called terminal emulator (terminal)
On most of Linux systems use a program called bash (Bourne Again
Shell) which is acts as default shell program.
Bash is an enhanced version of the original Unix shell program sh
(POSIX shell) written by Steve Bourne.
SHELLS 93
Shell interface in Linux:
Virtual terminal – shell with log in prompt
Terminal emulator – inside a graphical user interface is often
called a terminal window e.g. GNOME Terminal (GNOME), KDE
Konsole
To find all available shells in your system type following command:
cat /etc/shells
To find your current shell type following command:
echo $SHELL
SHELL TYPES 94
Shell types:
sh (Bourne shell)
bash (Bourne-Again shell)
rbash
dash
csh (C shell), ksh (Korn shell), tcsh (TENEX C shell), zsh (Z
shell)
Refer http://en.wikipedia.org/wiki/Unix_shell for more about
shell categories
SHELL ENVIRONMENT 95
In a shell session, there are many pieces of information the shell compiles to
determine its behavior and access to resources. Some settings are contained
within configuration settings and others are determined by user input.
One way that the shell keeps track of all of these settings and details is through
an area called the environment. The environment is an area that the shell builds
every time that it starts a session.
The environment is implemented as strings that represent key-value pairs. Each
pair generally will look something like this:
KEY=value1:value2:...
If the value contains significant white-space, quotations are used:
KEY="value with spaces"
SHELL ENVIRONMENT (CONT.) 96
To see a list of all environmental variables, use the env or printenv commands.
With printenv, you can requests the values of individual variables:
printenv SHELL
env let's you modify the environment that programs run in by passing a set of
variable definitions, i.e.:
env VAR1="blahblah" command_to_run command_options
To display the value of any shell or environmental variable, type in echo
$<variable_name>:
echo $TEST_VAR
echo $PWD
USER-DEFINED SHELL VARIABLES 97
When creating new variables, variable name/identifiers:
Can contain alphanumeric characters (0–9, A–Z, a–z), the dash (-) character, or
the underscore (_) character
Must not start with a number
CAPITALIZED (follow convention)
To create a variable and assign a value:
MYVAR = "Hello there: “
To display the value of a variable:
echo $MYVAR
Example of create and display a variable
ENVIRONMENT VARIABLES EXAMPLES 98
Environment variables are dynamic values which affect the processes
or programs on a computer. Environment variables can be created,
edited, saved, and deleted and give information about the system
behaviour.
Variables Descriptions
ENV The location of the BASH run-time configuration file (usually ~/.bashrc)
EUID The effective UID (User ID) of the current user
HISTFILE The file name used to store previously entered commands in the BASH
shell (usually ~/.bash_history)
HISTFILESIZE The number of previously entered commands that can be stored in the
HISTFILE upon logout for use during the next log in; it is typically 1,000
commands
HISTSIZE The number of previously entered commands that will be stored in
memory during the current log in session; it is typically 1,000 commands
HOME The absolute path name of the current user’s home directory
HOSTNAME The host name of the Linux system
ENVIRONMENT VARIABLES EXAMPLES 99
(CONT.)
Variables Descriptions
PATH This variable contains a colon (:)-separated list of directories in
USER
EDITOR which your system looks for executable files.
UID The effective UID (User ID) of the currenThe usernamet user
TERM Path to the program which edits the content of files
User's unique ID
Default terminal emulator
SHELL Shell being used by the user
Example of Accessing Variable values :
BASH SHELL ENVIRONMENT 100
Environment files – the file where variables are placed in and are executed each
time a user logs in and starts a BASH shell
Common BASH shell environment files and the order in which they are executed:
/etc/profile
/etc/bashrc
~/.bashrc
~/.bash_profile
~/.bash_login
~/.profile
The ~/.bashrc (BASH run-time configuration) file is typically used to set aliases and
variables that must be present in each BASH shell