Documente Academic
Documente Profesional
Documente Cultură
Vendor-Neutral
program
by
the
Linux
Professional
Ins0tute
It
is
the
First
stop
cer0ca0on
course
before
the
Professional
certs
by
LPI
It
is
an
outstanding
course
for
new
users
to
Linux
TOPIC 3:
TOPIC 4:
TOPIC
5:
Wikipedia.org
says
that
Opera0ng
systems
based
on
the
Linux
kernel
are
used
in
embedded
systems
such
as
consumer
electronics
(
such
set-top
boxes,
smart
TVs,
in-vehicle
infotainment
(IVI),
networking
equipment
(such
as
wireless
routers),
machine
control,
industrial
automa0on,
naviga0on
equipment,
spacecrac
ight
socware,
and
medical
instruments
in
general).
You
c
an
use
our
Linux
Essen0als
Lab
server
available
to
you
for
this
course!
This
is
setup
especially
for
this
course.
It
is
accessible
both
via
SSH
You
can
even
use
X
Windows
on
this
server
via
VNC!
GNOME
KDE
LXDE
UNITY
XFCE
Server Applica2ons
OpenSSH
telnetd
PostFix,
Sendmail
BIND
Apache
or
NGINX
Apache
or
NGINX
NGINX
MySQL
MONO
CUPS
POSTFIX
Package
tool
socware
keeps
a
database
of
informa0on
about
the
installed
applica0ons
including
the
loca0on
of
the
les
that
were
placed
on
the
Linux
le
system
during
that
package
installa0on.
There
are
two
Common
package
systems
usually
used
today
RPM
Debian
Linux
Distribu0ons
typically
have
there
own
package
types.
Therefore
you
can
not
install
say
an
RPM
based
package
on
say
a
debian
distort.
Package
Managers
used
to
rely
on
locally,
you
had
to
download
the
package
le
and
then
install
it.
Modern
Distribu0ons
now
oer
network
based
tools
that
use
socware
repositories.
So;ware
is
a
type
of
Intellectual
Property
Open
Source
beginnings
can
thank
there
begging
to
these
organiza2ons:
Free
So;ware
Founda2on
(FSF)
Open
Source
Ini2a2ve
(OSI)
Crea2ve
Commons
Commercial
So;ware
is
a
socware
that
is
developed
with
the
intent
to
sell
that
socware
as
a
prot.
Shareware
socware
is
is
similar
to
commercial
socware
except
at
its
copyright
and
legal
perspec0ve.
Freeware
is
like
shareware
but
the
socware
is
always
free
and
there
is
no
cost
involved.
The
license
used
by
the
Linux
Kernel
Free
So;ware
Founda2on
(FSF)
Founded
by
Richard
Stallman
1985
Driving
force
behind
the
Gnus
Not
Unix
(GNU)
project
Free
as
in
Speech,
Not
Free
as
in
Beer
GNOME
Another
very
popular
desktop
environment
that
is
the
default
for
Linux
distribu2ons
like
red
hat,
CENTOS
and
more.
LXDE
The
Lightweight
X11
Desktop
Environment
is,
as
its
full
name
suggests,
intended
to
consume
few
resources
and
therefore
work
well
on
older
or
modest
computer
hardware.
UNITY
Canonical,
the
publisher
of
the
Ubuntu
Linux
Distribu2on,
created
its
own
desktop
environment
known
as
Unity.
XFCE
This
desktop
environment
was
originally
modeled
on
a
commercial
desktop
environment
and
provides
more
customiza2on
than
that
of
GNOME
or
KDE.
XFCE
This
desktop
environment
was
originally
modeled
on
a
commercial
desktop
environment
and
provides
more
customiza2on
than
that
of
GNOME
or
KDE.
Launching
Programs
Most
desktop
environments
provide
several
ways
to
launch
programs.
Desktop
Menus
Many
desktop
environment
provide
menus
along
a
top,
bolom,
or
side
edge
of
the
screen.
Panels
Some
desktop
environments
enable
you
to
place
icons
in
the
ain
area
of
the
desktop.
Context
Menus
You
can
some2mes
right-click
in
an
unused
part
of
the
screen
to
obtain
a
context
menu
with
a
variety
of
op2ons.
Terminals
You
can
launch
a
program
called
a
terminal,
which
provides
a
text-mode
user
interface
inside
a
window.
SHELL
A
shell
is
just
a
command
line
interpreter
that
allows
us
to
type
commands
at
our
keyboard
and
those
commands
are
actually
sent
to
the
opera2ng
system
kernel.
Tilde
key
(
~
)
its
the
key
to
the
le;
of
your
number
1
and
below
esc
on
most
keys.
Globbing
Globbing
$
ls
*.txt
$
ls
test*
$
ls
?.txt
$
ls
????.txt
$
ls
[f-i]*.txt
$
ls
[t-v]*.txt
#
list
all
text
les
The
*
symbol
means
zero
or
more
characters
#
list
text
les
with
1
character
names
#
list
text
les
with
4
character
names
#list
text
les
that
could
be
between
the
lepers
f
through
i
#list
text
les
that
could
be
between
the
lepers
t
through
v
Quo2ng
Double
quote
Subs0tutes
the
value
of
variables
and
commands
Ex:
echo
Username
is
$USER
The
above
will
print
what
your
current
username
is.
Single
quote
This
preserves
the
literal
meaning
of
each
character
of
a
given
string
This
will
turn
o
the
(special)
meanings
of
all
characters
Ex:
echo
Username
is
$USER
The
above
example
will
print/echo
the
literal
Username
is
$USER
Quo2ng
Backslash
This
takes
away,
or
removes
the
(special)
meaning
from
a
single
character
Can
be
used
an
escape
character
If
we
did
NOT
have
the
\
character
before
$5.00
here
it
would
try
and
interpret
the
following
command
as
a
variable:
$
echo
The
cheeseburger
is
going
to
cost
you
$5.00
The
cheeseburger
is
going
to
cost
you
.00
But
if
we
used
the
\we
can
negate
our
special
character:
$
echo
The
cheeseburger
is
going
to
cost
you
\$5.00
The
cheeseburger
is
going
to
cost
you
$5.00
[stephen@linuxacademy1 ~]# ls
op0ons
- How to do it?
locate
passwd
whereis
passwd
man,
info,
less
gunzip,
bunzip2
then
less
less
and
ANY
text
ed0or
vi,
vim
Any
Web
Browser
LibreOce,
OpenOce.org,
any
other
word
app
xpdf,
Adobe
Reader
Gimp
Google
for
endless
amounts
of
tutorials,
Web
Forums,
User
groups
like
here
at
the
linux
academy
we
have
an
awesome
community!
shell scripts
shell scripts
Variables
$ANYNAME
Arguments:
$1
First
Argument
$2
Second
Argument
$?
Exit
Code/Status
(variable
that
stores
0
or
non
0
numbers
depending
on
if
the
previous
statement
was
successful
or
not.
#!
/bin/bash
Variables
Arguments
echo
for
if
Exit
(shebang)
shell scripts
shells scripts
&&
=
AND
||
=
OR
Syntax
using
&&:
command1
&&
command2
Syntax
using
||:
command1
||
command2
Syntax
using
both
&&,
||:
command1
&&
comand2
||
command3
#
rm
le1.txt
&&
echo
File
was
deleted
||
echo
File
was
NOT
deleted
#
File
was
deleted
shells scripts
If/then:
if
condi2on
then
command
else
command
shells scripts
shell scripts
Looping
Structures
while
loop
un2l
loop
for
loop
while
loops,
execute
over
and
over
un0l
a
specied
condi0on
is
No
longer
true.
Structure:
while
condi2on
d
o
script
command
done
shell scripts
un2l
loop,
it
runs
over
and
over
as
long
as
the
condi0on
is
false.
as
soon
as
its
condi0on
is
true
it
will
stop.
Structure:
un0l
condi0on
do
script
command
done
shell scripts
shell scripts
Archiving Files
Tar
A
Linux
u2lity
that
archives
things.
It
does
not
compress
or
compact
les.
It
just
s2cks
all
your
les
together
in
to
ONE
le.
Tradi2onally
Tar
was
actually
used
to
create
Tape
Archives.
We
used
it
to
archive
data
on
to
old
tape
backups.
Tar
actually
stand
for
Tape
Archive.
Compression Tools
Gzip
gzip
gunzip
Bzip2
Zip
bzip2
bunzip
zip
unzip
tar
tar
-cf
(creates
le)
tar
-xf
(extracts
le)
le.tar
le.tar
10 yrs
1 year
7 yrs
18 Months
Debian
Ubuntu
Debian
Ubuntu
2 yrs
6 mth.
3-4 yrs
5 yrs
For
example:
A
load
average
of
0
is
a
system
that
no
programs
are
demanding
CPU
2me.
A
load
average
of
1
is
a
system
with
one
program
running
a
CPU
intensive
task.
A
system
in
which
it
has
higher
load
averages
on
a
single
CPU
system
reects
programs
compe2ng
for
available
CPU
2me.
A
system
that
has
mul2ple
Processors
or
CPU
cores,
load
averages
can
reach
the
number
of
CPUs
or
cores
before
compe2ng
for
CPU
2me
even
begins.
A
load
average
for
example
of
4.0
on
a
system
with
a
quad
core
processor
reects
processes
demanding
exactly
as
much
CPU
2me
as
the
computer
has
available.
/etc
contains
text-based
congura0on
les
used
by
the
system
as
well
as
services
on
the
system.
We
can
edit
these
les
with
a
text
editor
and
then
running
customize
how
Linux
behaves
in
dierent
manners.
/etc/aliases
Contains
a
table
used
to
redirect
all
to
local
users
/etc/exports
Congured
le
systems
to
be
exported
to
remove
NFS
clients
/etc/fstab
lists
the
par00ons
and
le
systems
that
will
be
automa0cally
mounted
when
we
boot
our
Linux
system
/etc/;pusers
Controls
users
access
to
FTP
service
running
on
a
Linux
system
/etc/group
Contains
local
group
deni0ons
/etc/grub.conf
Contains
congura0on
parameters
for
the
init
process
/etc/hosts
this
contains
a
list
of
hostname
to
IP
address
mappings
that
we
can
use
to
resolve
certain
hostnames
Permissions,
USER,
Group,
Other
drwxrwxr-x.
2
user
user
-rwxrwxr-x.
2
user
user
d
=
directory
-
=
le
r=read
w=write
x=execute
Octal
Nota2ons:
rwx
rwx
rwx
421
421
421
7
7
7
R=4
W=2
X=1
Total=7
Octal
Nota2on
Adding:
-rw-r--r--
420
4
4
6
4
4
=
644
-rw-r--r--
420
4
4
6
4
4
=
644
using
the
Octal
Nota2on:
Sepng
permissions
chmod
555
lename
or
chmod
ugo+w
(this
adds
write
permissions
to
the
user,
group,
and
other)
Octal
Nota2on
Adding:
Removing
permissions:
chmod
o-r
lename.txt
chmod
g-w
lename.txt
chmod
u-r
lename.txt
Adding
permissions:
chmod
o+r
lename.txt
chmod
g+w
lename.txt
chmod
u+r
lename.txt
Adding
permissions
with
octals:
chmod
644
lename.txt
R=4
W=2
X=1
Special
Directories
and
Files
Previous
lessons
we
learned
about
directories
like
/etc,
/lib,
and
/usr/lib
Special
Directories
and
Files
/var
Contains
such
les
that
change
ocen
such
as
mail,
logs,
etc
/var/tmp
Contains
temporary
les
les
that
do
NOT
get
deletes
on
reboot
/tmp
Contains
temporary
les
that
DO
get
deleted
on
reboot
S2cky
Bit
to
the
rescue!
We
can
add
a
s0cky
bit
to
a
folder
in
which
makes
users
can
only
delete
there
OWN
folder
within
a
directory
but
can
not
delete
anything
that
another
user
has
created
within
a
folder,
even
if
the
folder
has
777
(rwx
rwx
rwx).
Domain
Controller
Database
Server
DHCP
Server
Web
Server
E-mail
Server
File
and
Print
Server
Packet-ltering,
stateful,
or
even
applica2on-level
rewall
Proxy
Server
Content
Filter
Server
Router
PC1
7Applica2on
6Presenta2on
5Session
4Transport
3Network
2Data
link
1Physical
PC2
7Applica2on
6Presenta2on
5Session
4Transport
3Network
2Data
link
1Physical
TCP/IP
TCP
ensures
data
exchanged
between
two
network
hosts
is
exchanged
reliably
Typical
upper-layer
applica2ons
that
use
TCP
are:
Web
Servers
E-MAIL
Servers
FTP
Servers
ICMP -
PORTS
TCP
and
UDP
both
provide
ports
for
upper
layer
protocols.
Port
numbers
range
from
0
up
to
65536
for
each
individual
IP
address
20
and
21
23
25
80
110
137,
138,
139
443
FTP
Telnet
SMTP
HTTP
POP3
NetBIOS
HTTPS
Registered
PORTS
range
1024-49151
Organiza2ons
can
program
their
own
network
service
and
then
apply
for
a
registered
port
number
to
be
assigned
to
it.
Dynamic
PORTS
range
49152-65535
dynamic
ports
and
are
available
for
use
by
any
network
service.
Decimal
Binary
00000001 = 1 = 1
Conversion
Tool
Bits
1
=
128
Bits
2
=
64
Bits
3
=
32
Bits
4
=
16
Bits
5
=
8
Bits
6
=
4
Bits
7
=
2
Bit
8
=
1
Conversion
Tool
Bits
1
=
128
Bits
2
=
64
Bits
3
=
32
Bits
4
=
16
Bits
5
=
8
Bits
6
=
4
Bits
7
=
2
Bit
8
=
1
Subnet
Mask
(NETWORK
192.168.1).
(1
NODE)
(NETWORK
11000000.10101000.00000001)
.
(00000000
NODE)
192.168.1.1
(NETWORK
11111111.11111111.11111111)
.
(00000000
NODE)
255.255.255.0
192.168.1.1
255.255.255.0
Par2al
Subnepng:
You
do
not
have
to
use
the
default
subnet
mask.
Example
a
Class
A
address
COULD
use
only
part
of
an
octet
for
the
address
such
as
255.255.0.0.
Or
for
Class
B
you
COULD
do
a
255.255.252.0
subnet
mask.
PC1
192.168.1.1
255.255.255.0
PC2
192.168.1.2
255.255.255.0
PC3
192.168.1.3
255.255.252.0
Sending
PC1
192.168.1.2
Network
192.168.1.0
Receiving
PC2
10.10.30.2
Network
10.10.30.0
In
this
example
we
have
a
router
that
is
able
to
direct
sending
trac
from
the
192.168.1.0
network
segment
to
the
10.10.30.0
network
segment.