FILE SYSTEM TYPES (CONT.) 251
iso9660 (ISO 9660 filesystem)
A filesystem that used to access data stored on CDs and
DVDs.
ntfs (New Technology File System)
A Microsoft proprietary filesystem developed for its
Windows operating systems.
vfat
DOS FAT filesystem with long filename support.
zfs (Zettabyte File System)
A very high-performance filesystem and volume manager
originally created by Sun Microsystems that protects
against data corruption and has features that support
very large distributed storage systems.
FILE SYSTEM TYPES (CONT.) 252
BtrFS (b-tree file system)
Comes with advanced features such as automatic Defrag and
transparent compression.
XFS
Support for delayed allocation, dynamic inode allocated and
improved algorithms for read-ahead helps to achieve superior
performance, especially in large storage pools of size up to
hundreds of terabytes.
F2FS (Flash-Friendly File System)
Purpose by Samsung F2FS splits the carrier into smaller parts,
which in turn divide into even smaller parts
JFS (Journaling File System)
From IBM was one of the first file systems that support
journaling, which led to the reduction of the probability of data
loss.
JOURNALING FILE SYSTEMS 253
A journaling is a file system that keeps track of changes not yet
committed to the actual storage area.
Example: You are intent to delete a file. During deletion process,
the system crashes. Journal is used to retrieve the task (delete)
and finalized deletion from the disk.
Journaling capabilities provides for fast and effective recovery in
case of disk crashes
System just reads it journal files to restore the filesystem
Example: ext3, ext4, reiserfs, …
FILE SYSTEM INFORMATION 254
All devices are represented as special files on /dev directory
These partitions (device name) start with the name of the
hard disk and append a number indicating the partition on
that hard disk, example: /dev/sda1, /dev/sda2
The logical drives/partitions (MBR-style) starting with
number 5. example /dev/sda5
To report filesystem disk space usage, but show only
mounted partitions & their filesystems, use the df command
To show file space usage, use the du command
255
FILE
SYSTEM
MANAGE
PARTITIONING USING
CLI
PARTITIONING HARD DISKS 256
Divide a hard disk into smaller sections called partitions
The default graphical tool in Ubuntu is Disks
To determine the path that your system has assigned to the new hard
drive:
sudo lshw -C disk
To manage disk partitions (needs the root privilege), use the fdisk
command.
fdisk -l [devicename] command; list partition tables.
To create partitions on the second hard disk:
sudo fdisk /dev/sdb
257
MBR-STYLE PARTITION Master boot record (MBR) disks use the standard BIOS
partition table
Partitioning and boot data is stored in one place, a special
boot sector located at the beginning of a drive. This
information includes where partitions start and begin, so
your operating system knows which sectors belong to each
partition and which partition is bootable
MBR’s Limitations:
Cannot handle disks with more than 2 TB of space
MBR also only supports up to four primary partitions
Beyond four primary partitions, you have to make one of
the primary partition an “extended partition” and create
logical partitions inside it
MBR had no way of knowing if its data was corrupted
GPT-STYLE PARTITION 258
GUID partition table (GPT) disks use unified extensible
firmware interface (UEFI) .
GPT allows more than four partitions on each disk.
GPT supports for disks larger than 2 TB.
It is more robust and can recover if the data is corrupted.
It recover the damaged data from another location on the
disk.
259
FILE
SYSTEM
FORMATTING FILE
SYSTEM
FORMATTING FILESYSTEMS 260
To create filesystem (need root privilege), use the mkfs
command
To format the new partition as ext4 filesystem:
sudo mkfs -t ext4 /dev/sdb1
or
sudo mkfs.ext4 /dev/sdb1
To check and repair a filesystem (need root privilege), use
the fsck command. The partition must be unmounted before
executing fsck.
261
FILE
SYSTEM
MOUNTING
MOUNTING FILESYSTEMS 262
Attach a filesystem on a partition to the main directory tree
Make the data (on that filesystem) available
Mount point is an empty directory where the filesystem is
attached
List of mounted filesystems:
cat /etc/mtab
or
mount
MANUALLY MOUNTS THE FILESYSTEMS 263
For manual mounting:
sudo mount [device_name] [mountpoint]
Example: sudo mount /dev/sdb1 /backup
To unmount the filesystem from the main directory tree:
sudo umount [device_name]
Example: sudo umount /dev/sdb1
To unmount the filesystem from the mount points:
sudo umount [mountpoint]
Example: sudo umount /backup
LINUX FILE HIERARCHY & MOUNTED 264
PARTITIONS
boot /dev/sda2
root directory boot Desktop home /dev/sda5
of entire usr Documents
filesystem home Downloads
etc
dev {username}
proc
/ / sbin
backup
/dev/sda1
mount points backu /dev/sdb1
p
AUTOMATIC MOUNT FILESYSTEMS AT 265
BOOT
Using a text editor to edit /etc/fstab:
gksu gedit /etc/fstab
or, sudo nano /etc/fstab
Add the following line to the end:
/dev/sdb1 /backup ext4 defaults 0 2
Finally, save and quit from the text editor.
To have the changes take effect:
sudo mount -a
or, reboot the computer
266
This Photo by Unknown Author is This Photo by Unknown
licensed under CC BY-NC Author is licensed
under CC BY-NC
MANAGE PRINTER
267
MANAGE PRINTERS
268
CUPS
LINUX PRINTING SERVICE
PRINTERS ON UBUNTU 269
Ubuntu supports printer sharing over networks.
You can print from your Ubuntu machine, to another Ubuntu or
Windows machine that has a printer attached.
Ubuntu uses the Common UNIX Printing System (CUPS) to
handle printing.
CUPS uses the Internet Printing Protocol (IPP) as the basis for
managing print jobs and queues.
Other protocol also supported (some with reduced
functionality):
• LPD, SMB, AppSocket, and etc.
PRINTERS ON UBUNTU 270
(cont)
Ubuntu Printer administration tool: Printer Admin
You can print a file from the command line, use:
lp [filename]
or, lpr [filename]
PRINTING COMMANDS 271
BSD/LPD (Free BSD, Open BSD, Net BSD, Original Sun OS,
Mac OS X)
lpr (print)
lpq (display queue)
lprm (remove jobs)
System V (Solaris, SCO, HP-UX)
lp (print)
lpstat (display queue)
cancel (remove jobs)
272
This Photo by Unknown Author is licensed under CC BY
MANAGE NETWORK
INTERFACE
273
TCP/IP
TCP/IP PROTOCOLS 274
Internet Protocol (IP) is a connectionless protocol which deals with
network packet routing using the IP Datagram as the basic unit of
networking information. The IP Datagram consists of a header
followed by a message.
Transmission Control Protocol (TCP) enables network hosts to
establish connections which may be used to exchange data stream.
TCP guarantees that the data between connections is delivered and
that is arrives at one network host in the same order as sent from
another network host.
275
TCP/IP
COMMAND-LINE UTILITIES
FINDING YOUR NETWORK INTERFACE 276
To know the network interface cards on your computer:
ls /sys/class/net
or
ip addr
or
ifconfig
sudo apt install net-tools
277
FINDING YOUR NETWORK INTERFACE
BRING UP/DOWN THE NETWORK 278
INTERFACE
To bring down (deactivated) the ethernet:
sudo ifconfig enp0s3 down
or, sudo ip link set enp0s3 down
( this your device)
To bring up (activated) the ethernet:
sudo ifconfig enp0s3 up
or, sudo ip link set enp0s3 up
You may need to disable the Network Manager service
(if applicable):
sudo /etc/init.d/NetworkManager stop
TEMPORARY IP ADDRESS ASSIGNMENT 279
To temporarily configure an IP address:
sudo ifconfig enp0s3 10.0.2.50 netmask 255.255.255.0
or
sudo ip addr add 10.0.2.50/24 dev enp0s3
To configure a default gateway:
sudo route add default gw 10.0.2.1 enp0s3 or
sudo ip route add default via 10.0.2.1
AUTOMATIC IP ADDRESS 280
To bring your enp0s3 up by using DHCP (DHCP server is
available):
sudo ifconfig enp0s3 down
sudo dhclient enp0s3
or
sudo ifconfig enp0s3 down
sudo ifconfig enp0s3 up
or
sudo ip link set dev enp0s3 down
sudo ip link set dev enp0s3 up
STATIC IP ADDRESS 281
Edit the /etc/network/interfaces file using nano text editor:
sudo vi /etc/network/interfaces
Changes/appends the following statements:
auto enp0s3
iface enp0s3 inet static
address 10.0.2.220
netmask 255.255.255.0
network 10.0.2.0
broadcast 10.0.2.255
gateway 10.0.2.2
dns-nameservers 10.0.2.1 8.8.8.8
STATIC IP ADDRESS (CONT.) 282
Save the changes and quit from the text editor
To take effect you need to restart your networking
services:
sudo /etc/init.d/networking restart
or, reboot your machine
CHANGING HOSTNAME 283
Edit/change the /etc/hostname file using nano
text editor:
sudo nano /etc/hostname
Save the changes and quit from the text editor,
then reboot your machine
STATIC LOOKUP 284
To resolve a hostname with IP address (static lookup)
Edit/change the /etc/hosts file using nano text editor:
sudo nano /etc/hosts
Add IP address and hostname or FQDN (Fully Qualified
Domain Name)
10.0.2.3 ftpserver
Save the changes and quit from the text editor, then
reboot your machine
SETTING UP DNS 285
To cause your machine to consult with a particular server for
name lookups you simply add their addresses to /etc/resolv.conf
To set a machine which should perform lookups from the DNS
server at IP address 10.0.2.3:
sudo nano /etc/resolv.conf
Add the following details:
nameserver 10.0.2.3
Save the changes and quit from the text editor, then reboot your
machine
286
TCP/IP
GRAPHICAL UTILITIES
NETWORK INTERFACE SETTINGS 287
NETWORK INTERFACE SETTINGS
288
289
REMOTE
ACCESS
SSH, VNC AND OTHERS
REMOTE SERVICES 290
Secure Shell (SSH), also known as Secure Socket Shell, is a
network protocol that provides administrators with a secure way
to access a remote computer.
OpenSSH is a freely available version of the SSH
Telnet is a network protocol that allows a user on one computer
to log onto another computer
Virtual Network Computing (VNC) is a graphical desktop sharing
system that uses the Remote Frame Buffer protocol (RFB) to
remotely control another computer
INSTALL AND USE SSH 291
To install the OpenSSH client, use this command at a terminal
prompt:
sudo apt install openssh-client
To install the OpenSSH server, use this command at a terminal
prompt:
sudo apt install openssh-server
To remote login to another machine on your network:
ssh [username]@[ip_address]
USING VNC 292
Remmina is an example of remote desktop client that
supports multiple protocols. RDP, VNC, SPICE, NX, XDMCP,
SSH and EXEC are supported. Remmina is free and open-
source software.
Run Remmina Remote Desktop Client
Using VNC (cont.)
293
294
This Photo by Unknown Author is licensed under CC BY-SA-NC
TRIES SOFTWARE
MANAGEMENT IN LINUX
SYSTEM ENVIRONMENT
295
SOFTWARE
MANAGEMENT IN
LINUX SYSTEM
ENVIRONMENT
PACKAGE MANAGER
PACKAGE MANAGER 296
Package Manager is a software system that install, remove,
upgrade, configure and manage software on operating system.
The package manager can be a graphical application software
center or a command line tool like apt-get or pacman.
PACKAGE MANAGER 297
The most widely supported package manager:
Debian Package Management System (dpkg)
Red Hat Package Manager (rpm)
Pacman Package Manager - Arch Linux
Zypper Package Manager - openSUSE
Portage Package Manager -Gentoo
USING DEBIAN PACKAGE MANAGEMENT 298
SYSTEM
Dpkg is base package management system for the Debian
Linux family and used by default on Linux distributions that
are based on the Debian Linux distribution.
such as Ubuntu, Mint, etc.
Dpkg packages use the .deb extension and are installed and
maintained.
Useful command line package for dpkg package:
APT (Advance Packaging Tool)
Aptitude Package Manager
Synaptic Package Manager
RED HAT PACKAGE MANAGER 299
RPM is the most widely used on many Linux distributions,
• e.g. RHEL, Fedora, SUSE, openSUSE, etc.
RPM packages use the .rpm extension and are installed and
maintained by the rpm command
Useful command line package for rpm package:
YUM (Yellowdog Updtaer, Modified)
DNF – Dandified Yum
300
RPM vs. dpkg
RPM vs. dpkg Installing/ updating
RPM DPKG DESCRIPTION
rpm -i [file.rpm] dpkg -i [file.deb]
rpm -U [file.rpm] dpkg -i [file.deb] Install package from a
file
Update package from
a file
Remove
RPM DPKG DESCRIPTION
rpm -e [package]
dpkg -r [package] Remove an installed
package