SlideShare a Scribd company logo
1 of 70
1
Introduction
2
Just like Windows, iOS, and Mac OS, Linux is an
operating system.
An operating system manages the communication
between the user and the hardware.
Linux is everywhere. It is used on used on desktop
and laptop computers, web servers, mobile devices
(Android), public cloud technology (i.e., Google,
Amazon, etc) and networking (i.e., Cisco Networks).
Course Curriculum
• What is Linux?
• Operating System – Kernel, Shell and Terminal
• Advantages of Linux.
• Distributions in Linux.
• Careers in Linux.
• Command Structure and Basic Commands
• File System and Directory Structure in Linux
• File Permissions
• Ownership and Groups in Linux
• Copying and Moving Files and Directories.
• Administrative access
• Networking Tools
• Processes
• Package Management
• User Management
3
What is an
Operating
System?
• Operating System is the system software that manages the
computer’s hardware and provides a convenient and safe
environment for running programs.
• Role of an OS:
1. OS Allocates memory for the program
2. User Interface
3. Program Execution
4. I/O Operation
5. File System Manipulation
6. Error Detection
7. Resource Allocation
4
Parts of an Operating System
Kernel
The Kernel is the main component of an Operating System (OS) and is
the core interface between a computer’s hardware and its processes.
What the Kernel does
Memory management
Process management
Device drivers
System calls and security
6
WHAT IS A SHELL?
7
The shell is a program that takes keyboard commands and passes them to the operating
system to carry out. Almost all Linux distributions supply a shell program from the GNU
Project called bash.
There are different types of shells:
• C Shell (csh)
• Bourne Shell (sh)
• Bourne-Again Shell (bash)
• Korn Shell (ksh)
• friendly interactive shell (fish)
• Z shell (zsh)
The UNIX Operating
System
• Like Windows and DOS, there is another
major operating system called UNIX. It
arrived earlier than the other two. UNIX is
a very powerful OS.
• UNIX is very customizable.
• We interact with a UNIX System through a
command interpreter called the shell.
• UNIX is a paid OS.
• Linux is based on UNIX Kernel.
• Linux is a Kernel.
8
WHAT IS TERMINAL?
howtogeek@ubuntu:~$
User_name PC name
Working directory
9
WHAT IS TERMINAL?
When using a graphical user interface, we need another program called a
terminal emulator to interact with the shell. If we look through our desktop
menus, we will probably find one. KDE uses Konsole and GNOME uses gnome-
terminal, though it's likely called simply “terminal” on our menu.
10
Why Linux?
 As Linux is an open source. So, its source code is
easily available for everyone. Anyone capable of
coding can contribute, modify, enhance and distribute
the code to anyone and for any purpose.
 Linux is more secure in comparison to other operating
systems such as Windows.
 Linux gives us complete freedom. We can customize
themes, feature, add or delete any feature according to
our need as it is an open-source operating system.
11
Why Linux?
LINUX IS FREELY AVAILABLE.
WE CAN JUST DOWNLOAD IT
FROM WEB AND USE IT.
LINUX HAS A LARGE
COMMUNITY. SO, IF WE FACE
ANY PROBLEMS, WE CAN GET
ITS SOLUTION ON WEB.
LINUX GIVES US HIGH
PERFORMANCE AND
STABILITY.
LINUX HELPS US TO SET UP
CLIENT AND SERVER
SYSTEMS ON YOUR
COMPUTER SYSTEMS EASILY.
LINUX IS COMPATIBLE
WITH A LARGE NUMBER
OF FILE FORMATS.
LINUX IS A MULTI-TASKING
OS. IT CAN EFFECTIVELY RUN
SEVERAL PROGRAMS
SIMULTANEOUSLY.
12
13
Choosing a distribution?
Linux Distributions
• There are three major distributions of Linux:-
Debian
 Ubuntu, Kali, Zorin OS, etc.
Slackware
 Open SUSE, KateOS, etc.
RedHat
 RHEL, Oracle Enterprise, CentOS, Fedora, etc.
14
CAREERS IN LINUX
DevOps
Engineer
Software
Engineer
Systems
Administrator
Systems
Engineer
Senior
Software
Engineer
Network
Engineer
Software
Developer
Linux
Engineering
Admin
Software
Developer
Linux Engineer
Senior Java
Developer
Build release
management
Engineer
15
Let’s start
learning Command
line interface !
16
First Keystrokes
17
Let’s add some random text In the terminal,
Since this command makes no sense, the shell will tell us
so and give us another chance:
NOTE:
If we press the up-arrow key, we will see that the previous
command “kaekfjaeifj” reappears after the prompt.
For copy-paste don’t use Ctrl+c or Ctrl+v instead use
Ctrl+Shift+c and Ctrl+Shift+v.
bash: abcde: command not found
aspiring@ubuntu:~$
aspiring@ubuntu:~$abcde
Let’s Try Some Simple Commands
This command displays the current time and date.
This command displays a calendar of the current month.
This command will clear the terminal.
This command will close the terminal.
This command will show the manual of a command.
aspiring@ubuntu:~$date
aspiring@ubuntu:~$cal
aspiring@ubuntu:~$exit
aspiring@ubuntu:~$clear
aspiring@ubuntu:~$man
18
Basic Commands
• Logging in with Username and Password
• Date Command:-
Format:-
• date +“ ”
Options:- %A, %a, %B, %b
• date –d “ yesterday”
• Cal Command:-
cal
19
• Who are the users?
• who
• whoami
20
Structure of a command
21
Options can be used to alter the
behavior of a command.
Example: cal -3
An argument can be used to specify
something for the command to act
upon.
Example: cal 5 2020
command [options…] [arguments]
Navigation
22
In this topic we will introduce the following commands:
pwd - Print name of current working directory
cd - Change directory
ls - List directory contents
Directory Structure In Linux
23
Before we begin with the command, lets
take a look at the directory structure of
Linux.
Changing The Current Working
Directory
Example:
cd Documents
cd /usr/bin
cd /home/aspiring/Desktop
24
cd [arguments…]
Absolute Pathnames
25
An absolute pathname begins with the
mount point(/) and follows the tree
branch by branch until the path to the
desired directory or file is completed.
•cd /home/aspiring/Documents
For example, if we want to go to the
Documents directory then,
This means there is a directory home
inside mount point (/), inside the home
there is “aspiring” directory, inside it
there is “Documents” directory.
Relative Pathnames
26
Where an absolute pathname starts
from the mount point (/) and leads to
its destination, a relative pathname
starts from the working directory.
•cd Documents
For example, if we are in our home
directory and we need to go in
documents directory then,
This means there is a directory
named “Documents” inside our
current working directory.
Some Helpful Shortcuts
27
cd ..
Change your current working
directory to the parent directory
of working directory.
cd ~
Change your current working
directory to the home directory.
cd –
Change your current working
directory to the previous
working directory.
cd ~user_name
Change you current working
directory to the home directory
of user_name.
Listing directories
28
• ls Documents, ls /usr/bin, ls –al /etc
Example:
• -a --all List all files, even those with names that begin with a
period, which are normally not listed (i.e., hidden).
• -l Display results in long format.
• -r --reverse Display the results in reverse order. Normally,
ls displays its results in ascending alphabetical order.
• -S Sort results by file size.
• -t Sort by modification date.
Common
used options:
ls [options…] [arguments…]
Lets take a look at long format.
Field Meaning
-rw-r--r-- Access rights to the file. The first character
indicates the type of file. Among the different
types, a leading dash means a regular file, while a
“d” indicates a directory. The next three characters
are the access rights for the file's owner, the next
three are for members of the file's group, and the
final three are for everyone else.
1 File's number of hard links.
root The username of the file's owner.
root The name of the group which owns the file.
32059 Size of the file in bytes.
2007-04-03 11:05 Date and time of the file's last modification.
oo-cd-cover.odf Name of the file.
29
File Access Modes
Read
Grants the capability to read, i.e., view the contents of the file.
Write
Grants the capability to modify, or remove the content of the file.
Execute
User with execute permissions can run a file as a program.
30
File permission
indicators
31
The first three characters (2-4)
represent the permissions for the file's
owner.
The second group of three characters
(5-7) consists of the permissions for the
group to which the file belongs.
The last group of three characters (8-10)
represents the permissions for
everyone else.
Changing Permissions
32
To change the file or the directory permissions, we use the chmod (change
mode) command.
There are two ways to use chmod :
symbolic mode
absolute mode
Using chmod in
Symbolic mode
33
The easiest way for a beginner to modify file or directory permissions is to use the
symbolic mode. With symbolic permissions you can add, delete, or specify the
permission set you want by using the operators in the following table.
Example:
chmod o+wx testfile adds write and executable
permissions to others.
chmod u-x testfile remove executable
permission from user.
chmod g=rx testfile set read and exec permission
for group.
Using chmod with Absolute Permissions
34
The second way to modify permissions with the chmod
command is to use a number to specify each set of permissions
for the file.
Example:
chmod 755 testfile
• This will give rwx permission to user, r-x permission to group and r-x
permission to others.
chmod 664 test file
• This will give rw- permission to user, rw- permission to group and r–
permission to others.
Changing Owners and Groups
35
chown − The chown command
stands for "change owner" and
is used to change the owner of a
file.
• Syntax: chown user file_name
• Example:
• chown test testfile
• This will
change the user of file
to “test”.
chgrp − The chgrp command
stands for "change group" and
is used to change the group of a
file.
• Syntax: chgrp group file_name
• Example:
• chgrp special testfile
This will change
group of the file to
“special”.
Determining A File's Type With file
36
As we explore the system it will be useful to know
what files contain. To do this we will use the file
command to determine a file's type. Filenames in
Linux are not required to reflect a file's contents.
While a filename like “picture.jpg” would normally
be expected to contain a JPEG compressed image, it
is not required to in Linux.
Syntax: file filename
aspiring@ubuntu:~$file picture.jpg
picture.jpg: JPEG image data, JFIF standard 1.01
Viewing File Contents With less
37
The less command is a program to
view text files. Throughout our
Linux system, there are many files
that contain human-readable text.
The less program provides a
convenient way to examine them.
Syntax: less file_name
Example:
less /etc/passwd
Once the less program starts, we
can view the contents of the file. If
the file is longer than one page, we
can scroll up and down. To exit less,
press the “q” key.
Manipulating Files And Directories
In this topic
we will
introduce the
following
commands:
cp – Copy files
and
directories
mv –
Move/rename
files and
directories
mkdir –
Create
directories
rm – Remove
files and
directories
38
Create Directories
39
The mkdir command is used to create directories.
• mkdir [dir_name…]
Syntax
• mkdir test would create a single directory
named “test”
• mkdir test1 test2 test3 would create three directories
named test1, test2, test3.
Example:
Copy Files And Directories
40
The cp command copies files or directories.
•cp [dir_name] [path]
Syntax:
•cp example.txt test
•cp example.txt /usr/bin/
•cp *.txt /home/aspiring/Documents
Example:
Move And Rename
Files
41
The mv command performs both file moving
and file renaming, depending on how it is used.
In either case, the original filename no longer
exists after the operation.
Syntax:
mv [file_or_dir]
[file_or_dir]
Example
mv item1 item2
mv item1 item2
/home/aspiring/Documen
ts/
Remove Files And
Directories
42
The rm command is used to
remove (delete) files and
directories.
Syntax: rm [file_or_dir]
Example:
rm test.txt
rm
Documents/test
dd command
43
The dd command is a utility for
copying files or entire
partitions at the bit level.
This command has several
useful features, including:
It can be used to clone or
delete (wipe) entire disks or
partitions.
It can be used to copy raw data
to removable devices, such as
USB drives and CDROMs.
It can backup and restore the
MBR (Master Boot Record).
It can be used to create a file of
a specific size that is filled with
binary zeros, which can then
be used as a swap file (v irtual
memory)
The dd command uses special
arguments to specify how it
will work. The following
illustrates some of the more
commonly used arguments:
Administrative Access
44
There are many Linux commands which deal
with sensitive information like passwords,
system hardware, or otherwise operate und er
other exceptional circumstances.
Preventing regular users from executing these
commands helps to protect the system.
Logging in as the root user provides
administrative access, allowing for the execution
of some of the privileged commands.
The su Command
45
Syntax: su [OPTIONS] [USERNAME]
The su command allows you to
temporarily act as a different user. It does
this by creating a new shell.
Note: By default, if a user account is not specified, the su
command will open a new shell as the root user, which
provides administrative privileges.
The sudo Command
46
The sudo command allows a user to execute a command as another user without
creating a new shell.
Instead, to execute a command with administrative privileges, use it as an
argument to the sudo command. Like the su command, the sudo command
assumes by default the root user account should be used to execute commands.
Consider This:
The sudo command can be used to switch to other user accounts as well. To
specify a different user account use the -u option.
Once the command has completed, notice the prompt has not changed, you are
still logged in as sysadmin.
•The sudo command only provides administrative access for the execution of the specified command.
•This is an advantage as it reduces the risk that a user accidentally executes a command as root.
•The intention to execute a command is clear; the command is executed as root if prefixed with the
sudo command. Otherwise, the command is executed as a regular user.
Shutting Down
47
Requires root privileges.
The shutdown command arranges for the system to be brought down in a safe way.
All logged-in users are notified that the system is going down and within the last five
minutes leading up to the shutdown, new logins are prevented.
Formats of this time argument can be the word now, a time of day in the format hh:mm or
the number of minutes to delay in the format +minutes.
The shutdown command also has an optional message argument, indicating a message that
will appear in the terminals of all users.
What is networking?
Network-A computer network is a group of computers that use a set of
common communication protocols over digital interconnections for the
purpose of sharing resources located on or provided by the network
nodes.
48
What is IP address?
• An IP address is a unique address that identifies a
device on the internet or a local network. IP stands
for "Internet Protocol," which is the set of rules
governing the format of data sent via the internet
or local network.
• 2 types-IPV4 and IPV6
• IPV4 -
• 32-bit
• Each ranging from 0 to 255, separated by dots.
• Example-172.16.254.1
• IPV6 –
• 128-bit
• Example-2001:0db8:85a3:0000:0000:8a2e:0370:7334
Why there is need to shift to
IPV6?
• The primary function of IPv6 is to allow
for more unique TCP/IP address identifiers
to be created
• Now that we’ve run out of the 4.3 billion
created with IPv4.
• This is one of the main reasons why IPv6
is such an important innovation for the
Internet of Things (IoT). Internet-
connected products are becoming
increasingly popular, and while IPv4
addresses couldn’t meet the demand for
IoT products, IPv6 gives IoT products a
platform to operate on for a very long
time.
49
How IP address works?
50
The use of IP addresses typically happens behind the scenes. The process works like this:
Your device indirectly connects to the internet by connecting at first to a network connected to the internet, which
then grants your device access to the internet.
When you are at home, that network will probably be your Internet Service Provider (ISP). At work, it will be your
company network.
Your IP address is assigned to your device by your ISP.
Your internet activity goes through the ISP, and they route it back to you, using your IP address. Since they are giving
you access to the internet, it is their role to assign an IP address to your device.
However, your IP address can change. For example, turning your modem or router on or off can change it. Or you can
contact your ISP, and they can change it for you.
What is DNS Server?
• The Domain Name System (DNS) is the phonebook of the
Internet. When users type domain names such as ‘google.com’
or ‘nytimes.com’ into web browsers, DNS is responsible for
finding the correct IP address for those sites.
51
How do DNS servers resolve a DNS
query?
• In a typical DNS query without any caching, there are four servers
that work together to deliver an IP address to the client: recursive
resolvers, root nameservers, TLD nameservers, and authoritative
nameservers.
• The DNS recursor (also referred to as the DNS resolver) is a server
that receives the query from the DNS client, and then interacts with
other DNS servers to hunt down the correct IP. Once the resolver
receives the request from the client, the resolver then actually
behaves as a client itself, querying the other three types of DNS
servers in search of the right IP.
• First the resolver queries the root nameserver. The root server is
the first step in translating (resolving) human-readable domain
names into IP addresses. The root server then responds to the
resolver with the address of a Top Level Domain (TLD) DNS server
(such as .com or .net) that stores the information for its domains.
• Next the resolver queries the TLD server. The TLD server responds
with the IP address of the domain’s authoritative nameserver. The
recursor then queries the authoritative nameserver, which will
respond with the IP address of the origin server.
• The resolver will finally pass the origin server IP address back to
the client. Using this IP address, the client can then initiate a query
directly to the origin server, and the origin server will respond by
sending website data that can be interpreted and displayed by the 52
What is DNS Caching?
• recursive resolvers can also resolve DNS queries using cached
data. After retrieving the correct IP address for a given website,
the resolver will then store that information in its cache for a
limited amount of time. During this time period, if any other
clients send requests for that domain name, the resolver can
skip the typical DNS lookup process and simply respond to the
client with the IP address saved in the cache.
53
Why there is a time limit in cache memory?
• Once the caching time limit expires, the resolver must retrieve
the IP address again, creating a new entry in its cache. This
time limit, referred to as the time-to-live (TTL) is set explicitly in
the DNS records for each site. Typically the TTL is in the 24-48
hour range. A TTL is necessary because web servers
occasionally change their IP addresses, so resolvers can’t
serve the same IP from the cache indefinitely.
54
Network Configuration
The ifconfig command stands for "interface configuration" and is used to display
network configuration information.
ifconfig [OPTIONS]
Consider This
•The lo device is referred to as the loopback device. It is a special network device
used by the system when sending network-based data to itself.
•The ifconfig command can also be used to temporarily modify network settings.
•Typically these changes should be permanent, so using the ifconfig command to
make such changes is fairly rare.
55
Ping command
56
The ping command is used to verify connectivity between two computers. It does
this by sending packets to another machine on a network. If the sender receives a
response it should be possible to connect to that machine.
Information is sent using “packets”; the encapsulated unit of data sent over a
network. In order for the packets to find the other computer, they will need an
address.
The ping command uses IP addresses to identify a computer on the network that it
wants to connect to.
By default, the ping command will continue sending packets until the break
command (CTL + C) is entered at the console.
To limit how many pings are sent, use the -c option followed by the number of
pings to be sent. The example below shows ping being limited to 4 iterations with -
c 4.
If the ping command fails, you will receive a message stating, Destination Host
Unreachable:
if that ping command is successful, there is proper name resolution AND the IP
address is functioning properly as well.
The ping command may fail even though the remote machine is connecting. This is
because some administrators configure their machines, or even entire networks,
not to respond to ping requests as a security measure.
57
What is Traceroute &
What is it For?
Traceroute is a network
diagnostic tool used to
track in real-time the
pathway taken by a
packet on an IP network
from source to
destination, reporting
the IP addresses of all
the routers it pinged in
between. Traceroute
also records the time
taken for each hop the
packet makes during its
route to the destination.
What is Traceroute
Used For?
Traceroute is a useful
tool for determining the
response delays and
routing loops present in
a network pathway
across packet switched
nodes. It also helps to
locate any points of
failure encountered
while en route to a
certain destination.
NSLOOKUP
• Nslookup (stands for “Name Server Lookup”) is a useful
command for getting information from DNS server. It is a
network administration tool for querying the Domain Name
System (DNS) to obtain domain name or IP address mapping or
any other specific DNS record. It is also used to troubleshoot
DNS related problems.
58
DIG
• Dig Syntax
• The dig command is used as
follows:
• dig [server] [name] [type]
• [server] – The hostname or IP
address the query is directed to
[name] – The DNS (Domain Name
Server) of the server to query
[type] – The type of DNS record to
retrieve. By default (or if left
blank), dig uses the A record type
59
The dig command in Linux is used to
gather DNS information.
It stands for Domain Information
Groper, and it collects data about
Domain Name Servers.
The dig command is helpful for
diagnosing DNS problems, but is also
used to display DNS information.
60
Host
• Host command in Linux system is used for DNS (Domain Name
System) lookup operations. In simple words, this command is used to
find the IP address of a particular domain name or if you want to find
out the domain name of a particular IP address the host command
becomes handy.
61
Viewing Processes
62
Running a command results in something called a process.
In the Linux operating system, processes are executed with the privileges of the user who executes the
command. This allows for processes to be limited to certain capabilities based upon the user identity.
Users who have administrative privileges, like the root account, can control any user processes, including
stopping any user process.
The ps command can be used to list processes.
• ps [OPTIONS]
Result of ps command
63
The ps command will display the processes that are running in the current terminal by default.
•PID: The process identifier, which is unique to the process.
This information is useful for controlling the process by its ID number.
•TTY: The name of the terminal where the process is running.
•This information is useful for distinguishing between different processes that have the same name.
•TIME: The total amount of processor time used by the process.
•CMD: The command that started the process.
Instead of viewing just the processes running in the current terminal, users may want to view every
process running on the system.
•The -e option will display every process:
•the -f option is also used as it provides more detail in the output of the command
Package Management
65
Package management is a system by which software can be installed, updated, queried or removed from a
filesystem. In Linux, there are many different software package management systems, but the two most
popular are those from Debian and Red Hat.
At the lowest level of the Debian package management system is the dpkg command-->This command can be
tricky for novice Linux users.
So, the Advanced Package Tool, apt-get, a front-end program to the dpkg tool, makes management of packages
even easier.
Note
A front-end program is a program that users can see and interact with.
Many of the package management commands require administrative access, so they will be
prefaced with the sudo command.
Installing Packages
66
Package files are commonly installed by downloading them directly from repositories located on Internet
servers.
The Debian repositories contain more than 65,000 different packages of software.
Before installing a package, it is good practice to use the refresh the list of available packages using the apt-get
update command.
• sudo apt-get update
To search for keywords within these packages, you can use the apt-cache search command.
apt-cache search [keyword]
you can install it with the apt-get install command:
sudo apt-get install [package]
Updating Packages
67
The apt-get install command can also update a package, if that package is
installed and a newer version is available. If the package is not already on
the system, it would be installed; if it is on the system, it would be updated.
Updating all packages of the system should be done in two steps.
• update the cache of all packages available with apt-get update.
• execute the apt-get upgrade command and all packages and dependencies will be updated.
• apt-get update
• apt-get upgrade
Removing Packages
68
The apt-get command is able to either remove or purge a package.
The difference between the two is that purging deletes all package files, while
removing deletes all but the configuration files for the package.
An administrator can execute the apt-get remove command to remove a package
or the apt-get purge command to purge a package completely from the system.
• apt-get remove [package]
• apt-get purge [package]
Updating User Passwords
69
The passwd command is used to update
a user’s password. Users can only
change their own passwords, whereas
the root user can update the password
for any user.
• passwd [OPTIONS] [USER]
If the user wants to
view status information about their
password, they can use the -S option
The output fields are explained below:
Field Example Meaning
User Name sysadmin The name of the user.
Password
Status
P P indicates a usable password.
L indicates a locked password.
NP indicates no password.
Change Date 03/01/2015 The date when the password was last changed.
Minimum 0 The minimum number of days that must pass before the current password can be
changed by the user.
Maximum 99999 The maximum number of days remaining for the password to expire.
Warn 7 The number of days prior to password expiry that the user is warned.
Inactive -1 The number of days after password expiry that the user account remains active.
70
The root user can change the password of any user.--> only execute passwd username [ only after you logged in
as root in the CIL ]

More Related Content

Similar to Linux Basics.pptx

INTRODUCTION TO LINUX
INTRODUCTION TO LINUXINTRODUCTION TO LINUX
INTRODUCTION TO LINUXhafees4
 
Chapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix ConceptsChapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix ConceptsMeenalJabde
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell ScriptUnix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Scriptsbmguys
 
linux-lecture4.ppt
linux-lecture4.pptlinux-lecture4.ppt
linux-lecture4.pptLuigysToro
 
Linux commands and file structure
Linux commands and file structureLinux commands and file structure
Linux commands and file structureSreenatha Reddy K R
 
Introduction, Features, Basic Commands and Distribution of LINUX
Introduction, Features, Basic Commands and Distribution of LINUXIntroduction, Features, Basic Commands and Distribution of LINUX
Introduction, Features, Basic Commands and Distribution of LINUXDeeksha Verma
 
Linux Administration
Linux AdministrationLinux Administration
Linux AdministrationHarish1983
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administrationharirxg
 
2018-Summer-Tutorial-Intro-to-Linux.pdf
2018-Summer-Tutorial-Intro-to-Linux.pdf2018-Summer-Tutorial-Intro-to-Linux.pdf
2018-Summer-Tutorial-Intro-to-Linux.pdfsanjeevkuraganti
 
LINUX
LINUXLINUX
LINUXARJUN
 
PowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programmingPowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programmingPriyadarshini648418
 
Linux for beginners
Linux for beginnersLinux for beginners
Linux for beginnersNitesh Nayal
 

Similar to Linux Basics.pptx (20)

Group13
Group13Group13
Group13
 
UNIX/Linux training
UNIX/Linux trainingUNIX/Linux training
UNIX/Linux training
 
Linux
LinuxLinux
Linux
 
INTRODUCTION TO LINUX
INTRODUCTION TO LINUXINTRODUCTION TO LINUX
INTRODUCTION TO LINUX
 
Linux
LinuxLinux
Linux
 
Chapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix ConceptsChapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix Concepts
 
Unix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell ScriptUnix/Linux Basic Commands and Shell Script
Unix/Linux Basic Commands and Shell Script
 
linux-lecture4.ppt
linux-lecture4.pptlinux-lecture4.ppt
linux-lecture4.ppt
 
Linux commands and file structure
Linux commands and file structureLinux commands and file structure
Linux commands and file structure
 
Introduction, Features, Basic Commands and Distribution of LINUX
Introduction, Features, Basic Commands and Distribution of LINUXIntroduction, Features, Basic Commands and Distribution of LINUX
Introduction, Features, Basic Commands and Distribution of LINUX
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administration
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administration
 
2018-Summer-Tutorial-Intro-to-Linux.pdf
2018-Summer-Tutorial-Intro-to-Linux.pdf2018-Summer-Tutorial-Intro-to-Linux.pdf
2018-Summer-Tutorial-Intro-to-Linux.pdf
 
LINUX
LINUXLINUX
LINUX
 
Unix environment [autosaved]
Unix environment [autosaved]Unix environment [autosaved]
Unix environment [autosaved]
 
3. intro
3. intro3. intro
3. intro
 
PowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programmingPowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programming
 
cisco
ciscocisco
cisco
 
Linuxs1
Linuxs1Linuxs1
Linuxs1
 
Linux for beginners
Linux for beginnersLinux for beginners
Linux for beginners
 

Recently uploaded

Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacingjaychoudhary37
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 

Recently uploaded (20)

Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacing
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 

Linux Basics.pptx

  • 1. 1
  • 2. Introduction 2 Just like Windows, iOS, and Mac OS, Linux is an operating system. An operating system manages the communication between the user and the hardware. Linux is everywhere. It is used on used on desktop and laptop computers, web servers, mobile devices (Android), public cloud technology (i.e., Google, Amazon, etc) and networking (i.e., Cisco Networks).
  • 3. Course Curriculum • What is Linux? • Operating System – Kernel, Shell and Terminal • Advantages of Linux. • Distributions in Linux. • Careers in Linux. • Command Structure and Basic Commands • File System and Directory Structure in Linux • File Permissions • Ownership and Groups in Linux • Copying and Moving Files and Directories. • Administrative access • Networking Tools • Processes • Package Management • User Management 3
  • 4. What is an Operating System? • Operating System is the system software that manages the computer’s hardware and provides a convenient and safe environment for running programs. • Role of an OS: 1. OS Allocates memory for the program 2. User Interface 3. Program Execution 4. I/O Operation 5. File System Manipulation 6. Error Detection 7. Resource Allocation 4
  • 5. Parts of an Operating System
  • 6. Kernel The Kernel is the main component of an Operating System (OS) and is the core interface between a computer’s hardware and its processes. What the Kernel does Memory management Process management Device drivers System calls and security 6
  • 7. WHAT IS A SHELL? 7 The shell is a program that takes keyboard commands and passes them to the operating system to carry out. Almost all Linux distributions supply a shell program from the GNU Project called bash. There are different types of shells: • C Shell (csh) • Bourne Shell (sh) • Bourne-Again Shell (bash) • Korn Shell (ksh) • friendly interactive shell (fish) • Z shell (zsh)
  • 8. The UNIX Operating System • Like Windows and DOS, there is another major operating system called UNIX. It arrived earlier than the other two. UNIX is a very powerful OS. • UNIX is very customizable. • We interact with a UNIX System through a command interpreter called the shell. • UNIX is a paid OS. • Linux is based on UNIX Kernel. • Linux is a Kernel. 8
  • 10. WHAT IS TERMINAL? When using a graphical user interface, we need another program called a terminal emulator to interact with the shell. If we look through our desktop menus, we will probably find one. KDE uses Konsole and GNOME uses gnome- terminal, though it's likely called simply “terminal” on our menu. 10
  • 11. Why Linux?  As Linux is an open source. So, its source code is easily available for everyone. Anyone capable of coding can contribute, modify, enhance and distribute the code to anyone and for any purpose.  Linux is more secure in comparison to other operating systems such as Windows.  Linux gives us complete freedom. We can customize themes, feature, add or delete any feature according to our need as it is an open-source operating system. 11
  • 12. Why Linux? LINUX IS FREELY AVAILABLE. WE CAN JUST DOWNLOAD IT FROM WEB AND USE IT. LINUX HAS A LARGE COMMUNITY. SO, IF WE FACE ANY PROBLEMS, WE CAN GET ITS SOLUTION ON WEB. LINUX GIVES US HIGH PERFORMANCE AND STABILITY. LINUX HELPS US TO SET UP CLIENT AND SERVER SYSTEMS ON YOUR COMPUTER SYSTEMS EASILY. LINUX IS COMPATIBLE WITH A LARGE NUMBER OF FILE FORMATS. LINUX IS A MULTI-TASKING OS. IT CAN EFFECTIVELY RUN SEVERAL PROGRAMS SIMULTANEOUSLY. 12
  • 14. Linux Distributions • There are three major distributions of Linux:- Debian  Ubuntu, Kali, Zorin OS, etc. Slackware  Open SUSE, KateOS, etc. RedHat  RHEL, Oracle Enterprise, CentOS, Fedora, etc. 14
  • 17. First Keystrokes 17 Let’s add some random text In the terminal, Since this command makes no sense, the shell will tell us so and give us another chance: NOTE: If we press the up-arrow key, we will see that the previous command “kaekfjaeifj” reappears after the prompt. For copy-paste don’t use Ctrl+c or Ctrl+v instead use Ctrl+Shift+c and Ctrl+Shift+v. bash: abcde: command not found aspiring@ubuntu:~$ aspiring@ubuntu:~$abcde
  • 18. Let’s Try Some Simple Commands This command displays the current time and date. This command displays a calendar of the current month. This command will clear the terminal. This command will close the terminal. This command will show the manual of a command. aspiring@ubuntu:~$date aspiring@ubuntu:~$cal aspiring@ubuntu:~$exit aspiring@ubuntu:~$clear aspiring@ubuntu:~$man 18
  • 19. Basic Commands • Logging in with Username and Password • Date Command:- Format:- • date +“ ” Options:- %A, %a, %B, %b • date –d “ yesterday” • Cal Command:- cal 19
  • 20. • Who are the users? • who • whoami 20
  • 21. Structure of a command 21 Options can be used to alter the behavior of a command. Example: cal -3 An argument can be used to specify something for the command to act upon. Example: cal 5 2020 command [options…] [arguments]
  • 22. Navigation 22 In this topic we will introduce the following commands: pwd - Print name of current working directory cd - Change directory ls - List directory contents
  • 23. Directory Structure In Linux 23 Before we begin with the command, lets take a look at the directory structure of Linux.
  • 24. Changing The Current Working Directory Example: cd Documents cd /usr/bin cd /home/aspiring/Desktop 24 cd [arguments…]
  • 25. Absolute Pathnames 25 An absolute pathname begins with the mount point(/) and follows the tree branch by branch until the path to the desired directory or file is completed. •cd /home/aspiring/Documents For example, if we want to go to the Documents directory then, This means there is a directory home inside mount point (/), inside the home there is “aspiring” directory, inside it there is “Documents” directory.
  • 26. Relative Pathnames 26 Where an absolute pathname starts from the mount point (/) and leads to its destination, a relative pathname starts from the working directory. •cd Documents For example, if we are in our home directory and we need to go in documents directory then, This means there is a directory named “Documents” inside our current working directory.
  • 27. Some Helpful Shortcuts 27 cd .. Change your current working directory to the parent directory of working directory. cd ~ Change your current working directory to the home directory. cd – Change your current working directory to the previous working directory. cd ~user_name Change you current working directory to the home directory of user_name.
  • 28. Listing directories 28 • ls Documents, ls /usr/bin, ls –al /etc Example: • -a --all List all files, even those with names that begin with a period, which are normally not listed (i.e., hidden). • -l Display results in long format. • -r --reverse Display the results in reverse order. Normally, ls displays its results in ascending alphabetical order. • -S Sort results by file size. • -t Sort by modification date. Common used options: ls [options…] [arguments…]
  • 29. Lets take a look at long format. Field Meaning -rw-r--r-- Access rights to the file. The first character indicates the type of file. Among the different types, a leading dash means a regular file, while a “d” indicates a directory. The next three characters are the access rights for the file's owner, the next three are for members of the file's group, and the final three are for everyone else. 1 File's number of hard links. root The username of the file's owner. root The name of the group which owns the file. 32059 Size of the file in bytes. 2007-04-03 11:05 Date and time of the file's last modification. oo-cd-cover.odf Name of the file. 29
  • 30. File Access Modes Read Grants the capability to read, i.e., view the contents of the file. Write Grants the capability to modify, or remove the content of the file. Execute User with execute permissions can run a file as a program. 30
  • 31. File permission indicators 31 The first three characters (2-4) represent the permissions for the file's owner. The second group of three characters (5-7) consists of the permissions for the group to which the file belongs. The last group of three characters (8-10) represents the permissions for everyone else.
  • 32. Changing Permissions 32 To change the file or the directory permissions, we use the chmod (change mode) command. There are two ways to use chmod : symbolic mode absolute mode
  • 33. Using chmod in Symbolic mode 33 The easiest way for a beginner to modify file or directory permissions is to use the symbolic mode. With symbolic permissions you can add, delete, or specify the permission set you want by using the operators in the following table. Example: chmod o+wx testfile adds write and executable permissions to others. chmod u-x testfile remove executable permission from user. chmod g=rx testfile set read and exec permission for group.
  • 34. Using chmod with Absolute Permissions 34 The second way to modify permissions with the chmod command is to use a number to specify each set of permissions for the file. Example: chmod 755 testfile • This will give rwx permission to user, r-x permission to group and r-x permission to others. chmod 664 test file • This will give rw- permission to user, rw- permission to group and r– permission to others.
  • 35. Changing Owners and Groups 35 chown − The chown command stands for "change owner" and is used to change the owner of a file. • Syntax: chown user file_name • Example: • chown test testfile • This will change the user of file to “test”. chgrp − The chgrp command stands for "change group" and is used to change the group of a file. • Syntax: chgrp group file_name • Example: • chgrp special testfile This will change group of the file to “special”.
  • 36. Determining A File's Type With file 36 As we explore the system it will be useful to know what files contain. To do this we will use the file command to determine a file's type. Filenames in Linux are not required to reflect a file's contents. While a filename like “picture.jpg” would normally be expected to contain a JPEG compressed image, it is not required to in Linux. Syntax: file filename aspiring@ubuntu:~$file picture.jpg picture.jpg: JPEG image data, JFIF standard 1.01
  • 37. Viewing File Contents With less 37 The less command is a program to view text files. Throughout our Linux system, there are many files that contain human-readable text. The less program provides a convenient way to examine them. Syntax: less file_name Example: less /etc/passwd Once the less program starts, we can view the contents of the file. If the file is longer than one page, we can scroll up and down. To exit less, press the “q” key.
  • 38. Manipulating Files And Directories In this topic we will introduce the following commands: cp – Copy files and directories mv – Move/rename files and directories mkdir – Create directories rm – Remove files and directories 38
  • 39. Create Directories 39 The mkdir command is used to create directories. • mkdir [dir_name…] Syntax • mkdir test would create a single directory named “test” • mkdir test1 test2 test3 would create three directories named test1, test2, test3. Example:
  • 40. Copy Files And Directories 40 The cp command copies files or directories. •cp [dir_name] [path] Syntax: •cp example.txt test •cp example.txt /usr/bin/ •cp *.txt /home/aspiring/Documents Example:
  • 41. Move And Rename Files 41 The mv command performs both file moving and file renaming, depending on how it is used. In either case, the original filename no longer exists after the operation. Syntax: mv [file_or_dir] [file_or_dir] Example mv item1 item2 mv item1 item2 /home/aspiring/Documen ts/
  • 42. Remove Files And Directories 42 The rm command is used to remove (delete) files and directories. Syntax: rm [file_or_dir] Example: rm test.txt rm Documents/test
  • 43. dd command 43 The dd command is a utility for copying files or entire partitions at the bit level. This command has several useful features, including: It can be used to clone or delete (wipe) entire disks or partitions. It can be used to copy raw data to removable devices, such as USB drives and CDROMs. It can backup and restore the MBR (Master Boot Record). It can be used to create a file of a specific size that is filled with binary zeros, which can then be used as a swap file (v irtual memory) The dd command uses special arguments to specify how it will work. The following illustrates some of the more commonly used arguments:
  • 44. Administrative Access 44 There are many Linux commands which deal with sensitive information like passwords, system hardware, or otherwise operate und er other exceptional circumstances. Preventing regular users from executing these commands helps to protect the system. Logging in as the root user provides administrative access, allowing for the execution of some of the privileged commands.
  • 45. The su Command 45 Syntax: su [OPTIONS] [USERNAME] The su command allows you to temporarily act as a different user. It does this by creating a new shell. Note: By default, if a user account is not specified, the su command will open a new shell as the root user, which provides administrative privileges.
  • 46. The sudo Command 46 The sudo command allows a user to execute a command as another user without creating a new shell. Instead, to execute a command with administrative privileges, use it as an argument to the sudo command. Like the su command, the sudo command assumes by default the root user account should be used to execute commands. Consider This: The sudo command can be used to switch to other user accounts as well. To specify a different user account use the -u option. Once the command has completed, notice the prompt has not changed, you are still logged in as sysadmin. •The sudo command only provides administrative access for the execution of the specified command. •This is an advantage as it reduces the risk that a user accidentally executes a command as root. •The intention to execute a command is clear; the command is executed as root if prefixed with the sudo command. Otherwise, the command is executed as a regular user.
  • 47. Shutting Down 47 Requires root privileges. The shutdown command arranges for the system to be brought down in a safe way. All logged-in users are notified that the system is going down and within the last five minutes leading up to the shutdown, new logins are prevented. Formats of this time argument can be the word now, a time of day in the format hh:mm or the number of minutes to delay in the format +minutes. The shutdown command also has an optional message argument, indicating a message that will appear in the terminals of all users.
  • 48. What is networking? Network-A computer network is a group of computers that use a set of common communication protocols over digital interconnections for the purpose of sharing resources located on or provided by the network nodes. 48
  • 49. What is IP address? • An IP address is a unique address that identifies a device on the internet or a local network. IP stands for "Internet Protocol," which is the set of rules governing the format of data sent via the internet or local network. • 2 types-IPV4 and IPV6 • IPV4 - • 32-bit • Each ranging from 0 to 255, separated by dots. • Example-172.16.254.1 • IPV6 – • 128-bit • Example-2001:0db8:85a3:0000:0000:8a2e:0370:7334 Why there is need to shift to IPV6? • The primary function of IPv6 is to allow for more unique TCP/IP address identifiers to be created • Now that we’ve run out of the 4.3 billion created with IPv4. • This is one of the main reasons why IPv6 is such an important innovation for the Internet of Things (IoT). Internet- connected products are becoming increasingly popular, and while IPv4 addresses couldn’t meet the demand for IoT products, IPv6 gives IoT products a platform to operate on for a very long time. 49
  • 50. How IP address works? 50 The use of IP addresses typically happens behind the scenes. The process works like this: Your device indirectly connects to the internet by connecting at first to a network connected to the internet, which then grants your device access to the internet. When you are at home, that network will probably be your Internet Service Provider (ISP). At work, it will be your company network. Your IP address is assigned to your device by your ISP. Your internet activity goes through the ISP, and they route it back to you, using your IP address. Since they are giving you access to the internet, it is their role to assign an IP address to your device. However, your IP address can change. For example, turning your modem or router on or off can change it. Or you can contact your ISP, and they can change it for you.
  • 51. What is DNS Server? • The Domain Name System (DNS) is the phonebook of the Internet. When users type domain names such as ‘google.com’ or ‘nytimes.com’ into web browsers, DNS is responsible for finding the correct IP address for those sites. 51
  • 52. How do DNS servers resolve a DNS query? • In a typical DNS query without any caching, there are four servers that work together to deliver an IP address to the client: recursive resolvers, root nameservers, TLD nameservers, and authoritative nameservers. • The DNS recursor (also referred to as the DNS resolver) is a server that receives the query from the DNS client, and then interacts with other DNS servers to hunt down the correct IP. Once the resolver receives the request from the client, the resolver then actually behaves as a client itself, querying the other three types of DNS servers in search of the right IP. • First the resolver queries the root nameserver. The root server is the first step in translating (resolving) human-readable domain names into IP addresses. The root server then responds to the resolver with the address of a Top Level Domain (TLD) DNS server (such as .com or .net) that stores the information for its domains. • Next the resolver queries the TLD server. The TLD server responds with the IP address of the domain’s authoritative nameserver. The recursor then queries the authoritative nameserver, which will respond with the IP address of the origin server. • The resolver will finally pass the origin server IP address back to the client. Using this IP address, the client can then initiate a query directly to the origin server, and the origin server will respond by sending website data that can be interpreted and displayed by the 52
  • 53. What is DNS Caching? • recursive resolvers can also resolve DNS queries using cached data. After retrieving the correct IP address for a given website, the resolver will then store that information in its cache for a limited amount of time. During this time period, if any other clients send requests for that domain name, the resolver can skip the typical DNS lookup process and simply respond to the client with the IP address saved in the cache. 53
  • 54. Why there is a time limit in cache memory? • Once the caching time limit expires, the resolver must retrieve the IP address again, creating a new entry in its cache. This time limit, referred to as the time-to-live (TTL) is set explicitly in the DNS records for each site. Typically the TTL is in the 24-48 hour range. A TTL is necessary because web servers occasionally change their IP addresses, so resolvers can’t serve the same IP from the cache indefinitely. 54
  • 55. Network Configuration The ifconfig command stands for "interface configuration" and is used to display network configuration information. ifconfig [OPTIONS] Consider This •The lo device is referred to as the loopback device. It is a special network device used by the system when sending network-based data to itself. •The ifconfig command can also be used to temporarily modify network settings. •Typically these changes should be permanent, so using the ifconfig command to make such changes is fairly rare. 55
  • 56. Ping command 56 The ping command is used to verify connectivity between two computers. It does this by sending packets to another machine on a network. If the sender receives a response it should be possible to connect to that machine. Information is sent using “packets”; the encapsulated unit of data sent over a network. In order for the packets to find the other computer, they will need an address. The ping command uses IP addresses to identify a computer on the network that it wants to connect to. By default, the ping command will continue sending packets until the break command (CTL + C) is entered at the console. To limit how many pings are sent, use the -c option followed by the number of pings to be sent. The example below shows ping being limited to 4 iterations with - c 4. If the ping command fails, you will receive a message stating, Destination Host Unreachable: if that ping command is successful, there is proper name resolution AND the IP address is functioning properly as well. The ping command may fail even though the remote machine is connecting. This is because some administrators configure their machines, or even entire networks, not to respond to ping requests as a security measure.
  • 57. 57 What is Traceroute & What is it For? Traceroute is a network diagnostic tool used to track in real-time the pathway taken by a packet on an IP network from source to destination, reporting the IP addresses of all the routers it pinged in between. Traceroute also records the time taken for each hop the packet makes during its route to the destination. What is Traceroute Used For? Traceroute is a useful tool for determining the response delays and routing loops present in a network pathway across packet switched nodes. It also helps to locate any points of failure encountered while en route to a certain destination.
  • 58. NSLOOKUP • Nslookup (stands for “Name Server Lookup”) is a useful command for getting information from DNS server. It is a network administration tool for querying the Domain Name System (DNS) to obtain domain name or IP address mapping or any other specific DNS record. It is also used to troubleshoot DNS related problems. 58
  • 59. DIG • Dig Syntax • The dig command is used as follows: • dig [server] [name] [type] • [server] – The hostname or IP address the query is directed to [name] – The DNS (Domain Name Server) of the server to query [type] – The type of DNS record to retrieve. By default (or if left blank), dig uses the A record type 59 The dig command in Linux is used to gather DNS information. It stands for Domain Information Groper, and it collects data about Domain Name Servers. The dig command is helpful for diagnosing DNS problems, but is also used to display DNS information.
  • 60. 60
  • 61. Host • Host command in Linux system is used for DNS (Domain Name System) lookup operations. In simple words, this command is used to find the IP address of a particular domain name or if you want to find out the domain name of a particular IP address the host command becomes handy. 61
  • 62. Viewing Processes 62 Running a command results in something called a process. In the Linux operating system, processes are executed with the privileges of the user who executes the command. This allows for processes to be limited to certain capabilities based upon the user identity. Users who have administrative privileges, like the root account, can control any user processes, including stopping any user process. The ps command can be used to list processes. • ps [OPTIONS]
  • 63. Result of ps command 63 The ps command will display the processes that are running in the current terminal by default. •PID: The process identifier, which is unique to the process. This information is useful for controlling the process by its ID number. •TTY: The name of the terminal where the process is running. •This information is useful for distinguishing between different processes that have the same name. •TIME: The total amount of processor time used by the process. •CMD: The command that started the process. Instead of viewing just the processes running in the current terminal, users may want to view every process running on the system. •The -e option will display every process: •the -f option is also used as it provides more detail in the output of the command
  • 64.
  • 65. Package Management 65 Package management is a system by which software can be installed, updated, queried or removed from a filesystem. In Linux, there are many different software package management systems, but the two most popular are those from Debian and Red Hat. At the lowest level of the Debian package management system is the dpkg command-->This command can be tricky for novice Linux users. So, the Advanced Package Tool, apt-get, a front-end program to the dpkg tool, makes management of packages even easier. Note A front-end program is a program that users can see and interact with. Many of the package management commands require administrative access, so they will be prefaced with the sudo command.
  • 66. Installing Packages 66 Package files are commonly installed by downloading them directly from repositories located on Internet servers. The Debian repositories contain more than 65,000 different packages of software. Before installing a package, it is good practice to use the refresh the list of available packages using the apt-get update command. • sudo apt-get update To search for keywords within these packages, you can use the apt-cache search command. apt-cache search [keyword] you can install it with the apt-get install command: sudo apt-get install [package]
  • 67. Updating Packages 67 The apt-get install command can also update a package, if that package is installed and a newer version is available. If the package is not already on the system, it would be installed; if it is on the system, it would be updated. Updating all packages of the system should be done in two steps. • update the cache of all packages available with apt-get update. • execute the apt-get upgrade command and all packages and dependencies will be updated. • apt-get update • apt-get upgrade
  • 68. Removing Packages 68 The apt-get command is able to either remove or purge a package. The difference between the two is that purging deletes all package files, while removing deletes all but the configuration files for the package. An administrator can execute the apt-get remove command to remove a package or the apt-get purge command to purge a package completely from the system. • apt-get remove [package] • apt-get purge [package]
  • 69. Updating User Passwords 69 The passwd command is used to update a user’s password. Users can only change their own passwords, whereas the root user can update the password for any user. • passwd [OPTIONS] [USER] If the user wants to view status information about their password, they can use the -S option
  • 70. The output fields are explained below: Field Example Meaning User Name sysadmin The name of the user. Password Status P P indicates a usable password. L indicates a locked password. NP indicates no password. Change Date 03/01/2015 The date when the password was last changed. Minimum 0 The minimum number of days that must pass before the current password can be changed by the user. Maximum 99999 The maximum number of days remaining for the password to expire. Warn 7 The number of days prior to password expiry that the user is warned. Inactive -1 The number of days after password expiry that the user account remains active. 70 The root user can change the password of any user.--> only execute passwd username [ only after you logged in as root in the CIL ]