Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Lecture #1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 35

Introduction to Linux

Lecturer: Mohammad kabir Rahimi

Lecture #1

Contact: kabir.rahimi2005@gmail.com
Objectives
• After reading this chapter you should be able to:
– Log in on a Linux system using the textual interface.
– Describe the advantages of the textual interface.
– Correct typing mistakes on the command line
– Use kill to abort program execution using the termination
– Signal
– Understand the need to be careful when working with root
privileges
– Use man and info to display information about utilities
Safety Advice

Source: https://xkcd.com/456/

3
Free vs. Open Source Software

What is Free Software:



The freedom to run the program as you wish, for any purpose (freedom 0).

The freedom to study how the program works, and change it so it does your computing as
you wish (freedom 1). Access to the source code is a precondition for this.

The freedom to redistribute copies so you can help your neighbor (freedom 2).

The freedom to distribute copies of your modified versions to others (freedom 3). By doing
this you can give the whole community a chance to benefit from your changes. Access to
the source code is a precondition for this.

What is Open Source Software?



The term “open source” software is used by some people to mean more or less the
same category as free software. It is not exactly the same class of software: they accept
some licenses that we consider too restrictive, and there are free software licenses they
have not accepted. However, the differences in extension of the category are small:
nearly all free software is open source, and nearly all open source software is free. (—
Free Software Foundation, https://www.gnu.org/philosophy/categories.html)

4
UNIX Introduction

The Unix operating system is a set of programs that act as a link between the computer
and the user.

UNIX is designed for use on any kind of computer

Feature:
– Multi-user and multi-tasking
– GUI
– Hierarchical file system
– Portability
– Text based configuration files
What is a Linux distribution?
A complete Linux system package is called a distribution.
Most distributions are customized for a specifi c user group, such
as business users, multimedia , software developers, or
average home users.
The different Linux distributions are often divided into three
categories:
– Full core Linux distributions
– Specialized distributions
– LiveCD test distributions
Linux Distribution

Types of UNIX:
many different version of unix, sharing common similarities
GNU/Linux
Sun Solaris
Mac OS
BSD
Considerations when choosing a
distribution:
• In general there are more similarities than differences between
distributions, but it's good asking yourself some question before
installing a specific distribution:
• Which hardware?
– Server vs. desktop?
– Which specific use case?
– Binary vs. source based?
– Which package manager?
– Which desktop environment?
– Commercial support vs. community support?

8
What is a file system?
In computing, a file system is used to control how data is stored and
retrieved. Without a file system, information placed in a storage area
would be one large body of data with no way to tell where one piece of
information stops and the next begins.

By separating the data into individual pieces, and giving each piece a
name, the information is easily separated and identified. Taking its name
from the way paper-based information systems are named, each group of
data is called a "file". The structure and logic rules used to manage the
groups of information and their names is called a "file system".

There are numerous different types of filesystems, such as ext2/3/4, btrfs,


ReiserFS (etc...) on Linux, Fat(16/32) and NTFS on Windows, HFS(+) on
Mac OS, or ISO9660 for CD-ROMs, etc...

9
How is the Linux file system organized?
• The Linux Filesystem Hierarchy Standard is a convention which most Linux
distributions follow and which governs the way data is saved and organized in
a tree-like structure.
• The top-most hierarchy level is called the root of the filesystem, or in short just
“/”. Below the root (“/”) level, there are more than a dozen directories, such
as /bin, /boot, /dev, /etc/, /home, /lib, /lost+found, /media, /mnt, /opt, /proc,
/root, /run, /sbin, /srv, /sys, /tmp, /usr and /var
• Some of these directories need to be located on the same partition as the root
(“/”) level, otherwise the system can not boot. E.g. /bin and /sbin need to be on
the same partition like the root level, because they contain important utilities,
such as the “mount” utility, which mounts other partitions into the filesystem
tree in the later stages of the system booting up.

10
Directory Hierarchy:
The Linux Filesystem Hierarchy Standard

• / → Primary hierarchy root and root directory of the entire filesystem hierarchy.
• /bin → Essential command binaries that need to be available in single user mode; for all users, e.g., cat, ls, cp.
• /boot → Boot loader files, e.g., kernels, initrd.
• /dev → Essential devices, e.g., /dev/null, /dev/sda.
• /etc → Host-specific system-wide configuration files, e.g., /etc/hosts
• /home → Users' home directories, containing saved files, personal settings, etc.
• /lib → Libraries essential for the binaries in /bin/ and /sbin/.
• /media → Mount points for removable media such as CD-ROMs (first appeared in FHS-2.3).
• /mnt → Temporarily mounted filesystems.
• /opt → Optional application software packages
• /proc → Virtual filesystem providing process and kernel information as files. In Linux, corresponds to a procfs
mount.
• /root → Home directory for the root user.
• /run → Run-time variable data: Information about the running system since last boot, e.g., currently logged-in users
• /sbin → Essential system binaries, e.g., fsck, init, route.
• /srv → Site-specific data which are served by the system.
• /tmp → Temporary files (see also /var/tmp). Often not preserved between system reboots, and may be severely
size restricted.
• /usr → Secondary hierarchy for read-only user data; contains the majority of (multi-)user utilities and applications
• /var → Variable files whose content is expected to continually change, such as logs, spool files, and temporary e-mail files.

12
CLI VS GUI

Before the introduction of the graphical user interface (GUI),
UNIX and then Linux provided only a textual interface
(also called a command-line interface or CLI).

Available when you log in from a terminal.

ssh or telnet to log in on a system.

CLI is powerful then GUI

GUI consume more resources then CLI

Some task is more easy in CLI then GUI

Eg like changing file permission
What is shell?
• A program that interprets commands
• Allows a user to execute commands by typing them manually at
a terminal, or automatically in programs called shell scripts
• The shell is the utility that processes your requests.
• When you type in a command at your terminal, the shell
interprets the command and calls the program that you want.
• The shell uses standard syntax for all commands. C Shell,
Bourne Shell and Korn Shell are the most famous shells.
What is bash

Bash is not only an excellent command line shell,


but a scripting language in itself
Shell scripting allows us to use the shell's abilities
and to automate a lot of tasks that would otherwise
require a lot of commands
It runs as a regular program, normally started
whenever a user logs in to a terminal
Ubuntu Installation
• Minimum System Requirement for Ubuntu
18.04 LTS (Desktop)
– 2 GB RAM
– Dual Core Processor (2 GH)
– 25 GB free Hard disk space
– Installer Media (DVD or USB)
– (optional) Internet Connectivity if you are
planning to download third party software and
updates during the installation
Step 1

• Create a Bootable Disk


• Once the ISO file is downloaded then next
step is to burn the downloaded ISO image
into the USB/DVD or flash drive to boot the
computer from that drive.
• Also make sure you change the boot
sequence so that system boots using the
bootable CD/DVD or flash drive.
Step 2
• Boot from USB/DVD or Flash Drive
• Once the system is booted using the bootable disk, you can see the following screen
presented before you with options including “Try Ubuntu” and “Install Ubuntu” as
shown in the image below,

• Even though when you click “Try Ubuntu” you can have a sneak peek into the ubuntu
without installing it in your system, our goal here is to install Ubuntu 18.04 LTS in your
system. So click “Install Ubuntu” to continue with the installation process.
Step3
• Choose your Keyboard layout
• Choose your favorite keyboard layout and click “Continue”. By
default English (US) keyboard is selected and if you want to
change, you can change here and click “Continue”,
Step 4
• Preparing to Install Ubuntu and other Software
• Type of Installation: Normal Installation or Minimal installation, If you want a
minimal installation then select second option otherwise go for the Normal
Installation. In my case I am doing Normal Installation
• Download Updates While Installing Ubuntu (select this option if your system
has internet connectivity during installation)
• Install third party software for graphics and Wi-Fi hardware, MP3 and
additional media formats Select this option if your system has internet
connectivity)
• click on “Continue”
• to proceed with installation
Step 5
• Select the appropriate Installation Type
• Next the installer presents you with the following installation options
including:
• Erase Disk and Install Ubuntu – Choose this option if your system is
going to have only Ubuntu and erasing anything other than that is not a
problem. This ensures a fresh copy of Ubuntu 18.04 LTS is installed in
your system.
• Encrypt the new Ubuntu installation for security – Choose this
option if you are looking for extended security for your disks as your
disks will be completely encrypted. If you are beginner, then it is better
not to worry about this option.
• Use LVM with the new Ubuntu installation – Choose this option if
you want to use LVM based file systems.
• Something Else – Choose this option if you are advanced user and
you want to manually create your own partitions and want to install
Ubuntu along with existing OS (May be Windows or other Linux Flavor)
Now, Choose “Something Else” and Click on
continue
Step 6
• In this article, we will be creating our custom partitions on a hard
disk of 40 GB and the following partitions are to be created:
• /boot 1 GB (ext4 files system)
• Swap 2 GB
• / 12 GB (ext4 file system)
• Now in order to create your own partitions, click on “New Partition
Table”
Cont……
• Create /boot partition of size 1GB, Select the free space and then
Click on the “+” symbol to create a new partition

Click OK
Cont…
• In the same way create / partition with Required size
Cont...
• Now create last partition as swap of size 2 GB,

Click OK
Cont…
• Once you are done with the partition creation task , then click on
“Install Now” option to proceed with the installation

Click
Continue
Step 7
• Select Your Time zone
• Choose your favorite time zone and then click on “Continue”
Step 8
• Provide your User Credentials
• In the next screen you will be prompted to provide your user
credentials. In this screen provide your name, computer
name, username and the password to login into Ubuntu 18.04
LTS
Getting Start
Which Shell Are You Running?
You can identify the shell you are running by using the ps utility

Deleting a Word

You can delete a word you entered by pressing CONTROL-
W . A word is any sequence of characters that does not
contain a SPACE or TAB .
Deleting Line
• The default line kill key is CONTROL-U .
Cont……
Aborting Execution

To terminate a program from a textual display, press the
interrupt key ( CONTROL-C or sometimes DELETE or
DEL ).

If this method does not terminate the program, try stopping
the program with the suspend key (typically CONTROL-Z ).

Use kill command to abort program

A running program cannot usually ignore a kill signal; it is
almost sure to abort the program

e.g kill process id
Cont….
Repeating/Editing Command Lines
To repeat a previous command under bash or tcsh , press the UP ARROW key.
Each time you press this key, the shell displays an earlier command line.
Curbing Your Power
UNIX and Linux systems have always had a privileged user named root. When you
are working as the root user (“working with root privileges”), you have
extraordinary systemwide powers.
you can use the su (substitute user) utility to execute a single command with root
privileges or to gain root privileges temporarily so you can execute several
commands. Or command sudo mean superuser do
Linux Documentation

Distributions of Linux do not typically come with hardcopy
reference manuals. However, its online documentation has
always been one of Linux’s strengths.

The man (or manual) and info pages have been available via the
man and info utilities since early releases of the operating
system.

Most GNU utilities provide a ––help option that displays
information about the utility.
• e.g $ su –help
• e.g $ man su
• e.g $ info su

You might also like