Ubuntu
Ubuntu
Ubuntu Fundamentals
Course Materials
OSD 3
What is FOSS?
• Free/Open Source Software (FOSS) provides many
freedoms, including the ability to:
– View the source code used to compile programs
– Make modifications
– Distribute these modifications.
• Where is the benefit ?
– Customers are usually willing to pay for training,
support and consultation
• Most FOSS is covered under a public license. The
most common public license is the GNU General
Public License (GPL).
OSD 4
FOSS Licenses
• An open-source license is a type of license for
computer software and other products that
allows the source code, blueprint or design to
be used, modified and/or shared under defined
terms and conditions.
• Examples:
– GPL, LGPL, Apache, Mozilla Public License and BSD.
OSD 5
FOSS Licenses Comparison
OSD 6
Linux History
• Unix first version created in Bell Labs in 1969
• Unix flavors
– IBM->AIX, Hewlett-Packard->HP/UX, Sun-> Solaris and
Silicon Graphics->IRIX
• Operate in a same manner
• Offer the same standard utilities and commands
• Linus Torvalds
• Finished his college in 1991
• Created Linux kernel
OSD 7
Linux History (cont’d)
• Linux Flavors
– Debian GNU/Linux – Yellow Dog Linux
– Gentoo Linux – TurboLinux
– Mandriva – ASPLinux
– ScrudgeWare
– MkLinux
– Xandros
– Red Hat Enterprise Linux
– KNOPPIX
– Rock Linux
– Fedora
– Slackware Liunx – Symphony OS
– SUSE Linux – Ubuntu Linux
OSD 8
Ubuntu History
• Ubuntu based on Debian GNU/Linux distribution
and distributed as free and open source software.
• It is named after the Southern African philosophy
of Ubuntu ("humanity towards others").
• Ubuntu is designed primarily for desktop usage,
Web statistics suggest that Ubuntu's share of Linux
desktop usage is about 50 percent, and upward
trending usage as a web server.
OSD 9
Ubuntu Releases
• The Ubuntu team broke new ground in
committing to a program of scheduled releases
on a predictable six-month basis. It was
decided that every fourth release, issued on a
two-year basis, would receive long-term
support (LTS). LTS releases are typically used for
large-scale deployments.
OSD 10
Why Linux?
• Linux is growing in the home users sector and
the dominant of the professional and servers
sector.
• Internet service providers (ISPs), e-commerce
sites, and other commercial applications all use
Linux today and continue to increase their
commitment to Linux.
OSD 11
Installation
• Ubuntu Desktop Edition
– 700 MHz processor (about Intel Celeron or better)
– 512 MiB RAM (system memory)
– 5 GB of hard-drive space (or USB stick, memory
card or external drive but see LiveCD for an
alternative approach)
– VGA capable of 1024x768 screen resolution
– Either a CD/DVD drive or a USB port for the installer
media
OSD 12
Installation
• Ubuntu Server (CLI) Installation
– 300 MHz x86 processor
– 192 MiB of system memory (RAM)
– 1 GB of disk space
– Graphics card and monitor capable of 640x480
– CD drive
OSD 13
Types of Installation
• Kickstart Mode
– Permits automated installation
• Graphical Installation
• Text Based Installation
OSD 14
Linux Components
• Kernel
– Is the core of the operating system.
– Contains components like device drivers.
– It loads into RAM when the machine boots and stays
resident in RAM until the machine powers off.
• Shell
– Provides an interface by which the user can communicate
with the kernel.
– “bash” is the most commonly used shell on Linux.
– The shell parses commands entered by the user and
translates them into logical segments to be executed by the
kernel or other utilities.
OSD 15
Linux Components
• Terminal
– Gives the shell a place to accept typed commands
and to display their results
OSD 16
Command-Line Shells
• There are lot of shells as : Bourn Shell (sh), Korn
Shell (ksh), C Shell (csh) and Bourn Again Shell
(bash). They have different features that will be
discussed later.
OSD 17
Command-Line Shells
OSD 18
Running commands
• Commands have the following syntax:
command [options] [arguments]
• Each item is separated by a space.
• Options modify the command's behavior.
• Arguments are files name or other information
needed by the command.
• Separate commands with semicolon (;).
OSD 19
Examples
uname
Linux
uname –n
host1
uname –a
Linux host1 ………………
OSD 20
Examples
cal
September 2010
S M Tu W Th F S
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
OSD 21
Examples
cal 5 2004
May 2004
S M Tu W Th F S
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
cal ;uname
cal 5 2002; date; uname
OSD 22
Interrupting command execution
OSD 23
Linux Documentation
Manual page consists of:
• Name
– The name of the command and a one-line description
• Synopsis
– The syntax of the command
• Description
– Explanation how the command works and what it does
• Files
– The file used by the command
• Bugs
– Known bugs and errors
• See also
– Other commands related to this one
OSD 24
Linux Documentation
man –k keyword
Shows the commands that have manual pages that
contains any of the given keywords.
man –s keyword
whatis command
Shows the commands one line description
OSD 25
Linux Documentation
--help Option
• Another way to get help about a command.
• help is built in the command itself (if
supported).
OSD 26
Linux Documentation
HOWTO Documents
• Documents which describe in details a certain
aspect of configuring or using Linux.
• They are text files in /usr/share/doc/HOWTO
• Need to be installed manually
OSD 27
Introduction to Directories
• Think of
– File system as a building
– Directory is a room
– File is a desk
• The current working directory is the room you
are.
• To find out where you are at any time
pwd
/home/guest
OSD 28
How Directories Work ?
OSD 29
How Directories Work ?
• Pathnames
– Absolute pathname
– Relative pathname
OSD 30
Changing Directories
• To move from directory to directory on the
system
cd /home/user1/work
cd ..
cd ~
cd -
OSD 31
Listing Directory Contents
ls
dir1 dir2 file1
dir3 file2 file3
ls /home/user1/dir1
f1 f2
pwd
/home/user1
ls dir1
f1 f2
OSD 32
Listing Directory Contents
ls –a dir1
. .f1 f1
.. .f2 f2
ls –l dir1
total 2
-rw-r--r-- 1 islam islam 20 2 May 21 16:11 f1
-rw-r--r-- 1 islam islam 20 0 May 21 16:11 f2
ls –F
dir1/ dir2/ file1
dir3/ file2* file3@
OSD 33
Listing Directory Contents
ls –ld dir1
drwxr-xr-x 2 sbahader ssdp20 512 May 21
16:06 dir1
ls –R
.:
dir1 dir2 file1
dir3 file2 file3
./dir1:
f1 f2
./dir2:
./dir3:
OSD 34
Checking Free Space
• The df command displays number of free disk
blocks and files.
df [-h] [block_device| directory|file]
• Example
df –h /
Filesystem size used avail capacity Mounted on
/dev/hda0 15G 976M 14G 6% /
OSD 35
Checking Free Space
• The du command display the total sum of
space allocated to all files hierarchy rooted in
the directory specified.
du [-sh] [dir…]
• Example
du –sh
14K
OSD 36
File Naming
• File names may be up to 255 characters.
• There are no extensions in Linux
• Avoid special characters as >< ? * # '
• File names are case sensitive
OSD 37
Viewing File Content
cat fname
more fname
• Scrolling keys for the more command
– Spacebar: moves forward on screen
– Return: scroll one line at a time
– b: move back one screen
– /string: search forward for pattern
– n: find the next occurrence
– q: quit and return to the shell prompt
head –n fname
tail [-n|+n] fname
OSD 38
File Globing
• When typing commands, it is often necessary
to issue the same command on more than one
file at a time.
• The use of wildcards, or “metacharacters”,
allows one pattern to expand to multiple
filenames
OSD 39
Metacharacters
• Asterisk(*): represents 0 or more character, except
leading (.)
Example:
ls f*
file.1 file.2 file.3 file4
file1 file2 file3 fruit
ls *3
file.3 file3
dir3:
moon planets space sun
OSD 40
Metacharacters
• Question mark(?) character represents any single character except
the leading (.)
Examples
ls file?
file4 file1 file2
ls z?
z?: No such file or directory
• Square bracket([]): represent a range of characters for a single
character position.
Example
ls [a-f]*
ls [pf]*
OSD 41
Metacharacters
ls -a
. .. .profile abm bam bat battle project
ls -l b*
-rw-r----- 1 sgs 16 Feb 12 11:04 bam
-rw-r----- 1 sgs 12 Feb 12 11:05 bat
-rw-r----- 1 sgs 19 Feb 12 11:06 battle
ls *
abm bam bat battle project
ls .*
. .. .profile
ls *m
abm bam
ls *a*
abm bam bat battle
OSD 42
Metacharacters
ls ???
abm bam bat
ls ?a?
bam bat
ls ?a*
bam bat battle
ls [ab]*
abm bam bat battle
ls -l [ab]m
ls: "[ab]m: No such file or directory
ls [a-zA-Z]*
abm bam bat battle project
OSD 43
File and Directory Manipulation
OSD 44
File and Directory Manipulation
OSD 45
File and Directory Manipulation
• To create files
touch file(s)_name
• To create directories
mkdir [-p] dir(s)_name
OSD 46
File and Directory Manipulation
• To remove files
rm [-i] file(s)_name
• To remove directories
rmdir dir(s)_name
rm [-r] dir(s)_name
OSD 47