VI Editor

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 32

vi Editor

There are many ways to edit files in Unix. Editing files using the screen-oriented text
editor vi is one of the best ways. This editor enables you to edit lines in context with
other lines in the file.
An improved version of the vi editor which is called the VIM has also been made
available now. Here, VIM stands for Vi IM proved. Some of the other ones are Elvis, Nvi,
Nano, and Vile. It is wise to learn vi because it is feature-rich and offers endless possibilities to edit
a file.
vi is generally considered the de facto standard in Unix editors because −
 It's usually available on all the flavors of Unix system.
 Its implementations are very similar across the board. It works the same across
different platforms and Distributions
 It requires very few resources.
 It is more user-friendly than other editors such as the ed or the ex.
You can use the vi editor to edit an existing file or to create a new file from scratch.
You can also use this editor to just read a text file.

Starting the vi Editor


The following table lists out the basic commands to use the vi editor −

Sr.No. Command & Description

1 vi filename
Creates a new file if it already does not exist, otherwise opens an existing file.

2 vi -R filename
Opens an existing file in the read-only mode.

3 view filename
Opens an existing file in the read-only mode.
Following is an example to create a new file testfile if it already does not exist in the
current working directory −
$vi testfile
The above command will generate the following output −
|
~
~
~
~
~
~
~
~
~
~
~
~
"testfile" [New File]
You will notice a tilde (~) on each line following the cursor. A tilde represents an
unused line. If a line does not begin with a tilde and appears to be blank, there is a
space, tab, newline, or some other non-viewable character present.
You now have one open file to start working on. Before proceeding further, let us
understand a few important concepts.

Operation Modes
While working with the vi editor, we usually come across the following two modes −

 Command mode − This mode enables you to perform administrative tasks such
as saving the files, executing the commands, moving the cursor, cutting
(yanking) and pasting the lines or words, as well as finding and replacing. In this
mode, whatever you type is interpreted as a command. The vi editor opens in this
mode, and it only understands commandsIn this mode, you can, move the cursor and cut, copy,
paste the textThis mode also saves the changes you have made to the file Commands are case
sensitive. You should use the right letter case.

 Insert mode − This mode enables you to insert text into the file. Everything that's
typed in this mode is interpreted as input and placed in the file. You can switch to
the Insert mode from the command mode by pressing ‘i’ on the keyboard, Once you are in
Insert mode, any key would be taken as an input for the file on which you are currently
working.To return to the command mode and save the changes you have made you need to
press the Esc key

vi always starts in the command mode. To enter text, you must be in the insert mode
for which simply type i. To come out of the insert mode, press the Esc key, which will
take you back to the command mode.
Hint − If you are not sure which mode you are in, press the Esc key twice; this will take
you to the command mode. You open a file using the vi editor. Start by typing some
characters and then come to the command mode to understand the difference.

Getting Out of vi
The command to quit out of vi is :q. Once in the command mode, type colon, and 'q',
followed by return. If your file has been modified in any way, the editor will warn you of
this, and not let you quit. To ignore this message, the command to quit out of vi without
saving is :q!. This lets you exit vi without saving any of the changes.
The command to save the contents of the editor is :w. You can combine the above
command with the quit command, or use :wq and return.
The easiest way to save your changes and exit vi is with the ZZ command. When
you are in the command mode, type ZZ. The ZZ command works the same way as
the :wq command.
If you want to specify/state any particular name for the file, you can do so by specifying
it after the :w. For example, if you wanted to save the file you were working on as
another filename called filename2, you would type :w filename2 and return.

Moving within a File


To move around within a file without affecting your text, you must be in the command
mode (press Esc twice). The following table lists out a few commands you can use to
move around one character at a time −

Sr.No. Command & Description

1 k
Moves the cursor up one line
2 j
Moves the cursor down one line

3 h
Moves the cursor to the left one character position

4 l
Moves the cursor to the right one character position

The following points need to be considered to move within a file −


 vi is case-sensitive. You need to pay attention to capitalization when using the
commands.
 Most commands in vi can be prefaced by the number of times you want the
action to occur. For example, 2j moves the cursor two lines down the cursor
location.
There are many other ways to move within a file in vi. Remember that you must be in
the command mode (press Esc twice). The following table lists out a few commands
to move around the file −

Editing Files
To edit the file, you need to be in the insert mode. There are many ways to enter the
insert mode from the command mode −
O-Creates a new line for text entry above the cursor location
o-Creates a new line for text entry below the cursor location
A-Inserts text at the end of the current line
a-Inserts text after the current cursor location
I-Inserts text at the beginning of the current line
i-Inserts text before the current cursor location
 I — Insert at cursor (goes into insert mode)

a — Write after cursor (goes into insert mode)


A — Write at the end of line (goes into insert mode)

ESC — Terminate insert mode

U — Undo last change

o — Open a new line (goes into insert mode)

dd & 3dd –Delete line and Delete 3 lines.

D — Delete contents of line after the cursor

C — Delete contents of line after the cursor and insert new text. Press esc key to end insertion.

dw & 4dw — Delete word and Delete 4 words

cw — Change word

x — Delete character at cursor

r — Replace character

R — Overwrite characters from cursor onward

S — Substitute one character under cursor continue to insert

S — Substitute entire line and begin to insert at beginning of the line

~  — Change case of individual character

Control Commands

The following are useful commands which you can use along with Control Key.

CTRL+d — Move forward 1/2 screen

CTRL+f — Move forward one full screen

CTRL+u — Move backward 1/2 screen

CTRL+b — Move backward one full screen

CTRL+e — Moves screen up one line

CTRL+y — Moves screen down one line

CTRL+u — Moves screen up 1/2 page


CTRL+d — Moves screen down 1/2 page

CTRL+b — Moves screen up one page

CTRL+f — Moves screen down one page

CTRL+I — Redraws screen

Deleting Characters
Here is a list of important commands, which can be used to delete characters and lines
in an open file −

Sr.No. Command & Description

1 X
Deletes the character under the cursor location

2 X
Deletes the character before the cursor location

3 Dw
Deletes from the current cursor location to the next word

4 d^
Deletes from the current cursor position to the beginning of the line

5 d$
Deletes from the current cursor position to the end of the line

6 D
Deletes from the cursor position to the end of the current line

7 Dd
Deletes the line the cursor is on

As mentioned above, most commands in vi can be prefaced by the number of times


you want the action to occur. For example, 2x deletes two characters under the cursor
location and 2dd deletes two lines the cursor is on.
It is recommended that the commands are practiced before we proceed further.

Change Commands
You also have the capability to change characters, words, or lines in vi without deleting
them. Here are the relevant commands −

Sr.No Command & Description


.

1 Cc
Removes the contents of the line, leaving you in insert mode.

2 Cw
Changes the word the cursor is on from the cursor to the lowercase w end of the
word.

3 R
Replaces the character under the cursor. vi returns to the command mode after
the replacement is entered.

4 R
Overwrites multiple characters beginning with the character currently under the
cursor. You must use Esc to stop the overwriting.

5 S
Replaces the current character with the character you type. Afterward, you are
left in the insert mode.

6 S
Deletes the line the cursor is on and replaces it with the new text. After the new
text is entered, vi remains in the insert mode.

Copy and Paste Commands


Copying text in Vim is also referred to as yanking. Use the y key on the keyboard when performing this operation.
You can copy lines or words from one place and then you can paste them at another
place using the following commands −

Sr.No Command & Description


.

1 Yy
Copies the current line.

2 Yw
Copies the current word from the character the lowercase w cursor is on, until the
end of the word.

3 P
Puts the copied text after the cursor.

4 P
Puts the yanked text before the cursor.

Advanced Commands
There are some advanced commands that simplify day-to-day editing and allow for
more efficient use of vi −
Given below is the list advanced commands.

Word and Character Searching


The vi editor has two kinds of searches: string and character. For a string search,
the / and ? commands are used. When you start these commands, the command just
typed will be shown on the last line of the screen, where you type the particular string
to look for.
These two commands differ only in the direction where the search takes place −
 The / command searches forwards (downwards) in the file.
 The ? command searches backwards (upwards) in the file.
The n and N commands repeat the previous search command in the same or the
opposite direction, respectively. Some characters have special meanings. These
characters must be preceded by a backslash (\) to be included as part of the search
expression.

Sr.No Character &Description


.

1 ^
Searches at the beginning of the line (Use at the beginning of a search
expression).

2 .
Matches a single character.
3 *
Matches zero or more of the previous character.

4 $
End of the line (Use at the end of the search expression).

5 [
Starts a set of matching or non-matching expressions.

6 <
This is put in an expression escaped with the backslash to find the ending or the
beginning of a word.

7 >
This helps see the '<' character description above.

The character search searches within one line to find a character entered after the
command. The f and F commands search for a character on the current line
only. f searches forwards and F searches backwards and the cursor moves to the
position of the found character.
The t and T commands search for a character on the current line only, but for t, the
cursor moves to the position before the character, and T searches the line backwards
to the position after the character.

Set Commands
You can change the look and feel of your vi screen using the following :set commands.
Once you are in the command mode, type :set followed by any of the following
commands.
Sr.No Command & Description
.

1 :set ic
Ignores the case when searching

2 :set ai
Sets autoindent

3 :set noai
Unsets autoindent

4 :set nu
Displays lines with line numbers on the left side

5 :set sw
Sets the width of a software tabstop. For example, you would set a shift width of
4 with this command — :set sw = 4

6 :set ws
If wrapscan is set, and the word is not found at the bottom of the file, it will try
searching for it at the beginning

7 :set wm
If this option has a value greater than zero, the editor will automatically "word
wrap". For example, to set the wrap margin to two characters, you would type
this: :set wm = 2

8 :set ro
Changes file type to "read only"

9 :set term
Prints terminal type

10 :set bf
Discards control characters from input

Running Commands
The vi has the capability to run commands from within the editor. To run a command,
you only need to go to the command mode and type :! command.
For example, if you want to check whether a file exists before you try to save your file
with that filename, you can type :! ls and you will see the output of ls on the screen.
You can press any key (or the command's escape sequence) to return to your vi
session.

Replacing Text
The substitution command (:s/) enables you to quickly replace words or groups of
words within your files. Following is the syntax to replace text −
:s/search/replace/g
The g stands for globally. The result of this command is that all occurrences on the
cursor's line are changed.

Important Points to Note


The following points will add to your success with vi −
 You must be in command mode to use the commands. (Press Esc twice at any
time to ensure that you are in command mode.)
 You must be careful with the commands. These are case-sensitive.
 You must be in insert mode to enter text.
How to use vi editor
To launch the VI Editor -Open the Terminal (CLI) and type

vi <filename_NEW> or <filename_EXISTING>
And if you specify an existing file, then the editor would open it for you to edit. Else, you can create a
new file.
Saving and Closing the file
 Shift+zz – Save the file and quit
 :w – Save the file but keep it open
 :q – Quit without saving
 :wq – Save the file and quit
 :q! Quit discarding changes made
 :w! Save (and write to non-writable file)
 :w fname Save as fname

You should be in the command mode to exit the editor and save changes to the file.

vim undo (how to undo a change in vi/vim)

You “undo” changes in vi and vim with the undo command, which is the u key


when you are in vim command mode. For instance, if you start with this text
in your editor:

aaa

bbb

ccc

Then delete the second line with the vi dd command, you can then undo this
change by typing the letter u while still in command mode. This undo
command works with other changes as well, including inserts, deletes, search
and replace functions, etc.

vim redo (how to redo something you just un-did)

Update: As noted in the Comments section below, the best way to redo a vim
command is to use the [Ctrl][r] keystroke.
Another approach to redo a command in vi/vim is to enter the “redo”
command in last-line mode, like this:

:redo

For instance, if you wanted to again delete that second line, you could type this
command to re-do that change. But again, since learning about it, the [Ctrl]
[r] keystroke is a much faster way to undo a change in vim.

Joe Editor
• JOE is a full featured terminal-based screen editor which is distributed under the GNU
General Public License (GPL)
• JOE is written in C and its only dependency is libc
Features
• Line number mode displays line number of each line.
• Auto-indent mode.
• Block move/copy/delete/filter
• STARTING JOE: Joe can be started from the menu. Alternatively, from the Unix shell,
type joe <filenames>
• MOVING: Movement by a single line or character is accomplished by pressing the arrow
keys. Hitting `^U' will scroll upwards one screen, and hitting `^V' will scroll downwards
one screen. Hitting `^K L' will allow you to jump to a specific line number within the file.
• SEARCHING: To search for a certain text string, type `^K F'. You will first be prompted
for the string for which to search, and then any other search options (such as case
insensitivity, search direction, etc.). To repeat the most recent search, type `^L'.
• BLOCK OPERATIONS: To delete a single character, type <Backspace> or <Del>. To
delete an entire line, type `^Y'. Joe also supports block editing. To mark the beginning of a
block, type `^K B'. To mark the end, type `^K K'. To delete a selected block, type `^K Y'.
To move the block to the current cursor location, type `^K M'. To copy the block to the
current cursor location, leaving the original block where it is, type `^K C'.
• UNDO / REDO: Joe remembers all changes made to the file and allows you to undo or redo
any changes you make. To undo the most recent change, type `<Ctrl>-<Shift>-_' (control-
underline). To redo an undone change, type `<Ctrl>-<Shift>-^' (control-caret).
• EXITING JOE: To exit joe and save changes to the current file, type `^K X'. To exit joe
without saving any changes, type `^C'. If any changes were made, you will be asked if
you're sure you want to quit before joe actually exits.
Package Management
• Package management is a method of installing and maintaining software on the system.
• Today, most people can satisfy all of their software needs by installing packages from
their Linux distributor.
• This contrasts with the early days of Linux, when one had to download and compile
source code in order to install software.
• Not that there is anything wrong with compiling source code; in fact, having access to
source code is the great wonder of Linux. It gives us (and everybody else) the ability to
examine and improve the system.
• It's just that having a pre-compiled package is faster and easier to deal with.
Packaging Systems
• Different distributions use different packaging systems and as a general rule, a package
proposed for one distribution is not compatible with another distribution.
• Most distributions fall into one of two camps of packaging technologies: the Debian
“.deb” camp and the Red Hat “.rpm” camp. There are some important exceptions such as
• Gentoo, Slackware, and Foresight, but most others use one of these two basic systems.

Packaging System Distributions (Partial Listing)


Debian Style (.deb) Debian, Ubuntu, Xandros, Linspire
Red Hat Style Fedora, CentOS, Red Hat Enterprise Linux,
(.rpm) OpenSUSE,
Mandriva, PCLinuxOS
How A Package System Works
• The method of software distribution found in the proprietary software industry usually
entails buying a piece of installation media such as an “install disk” and then running an
“installation wizard” to install a new application on the system.
• Linux doesn't work that way. Virtually all software for a Linux system will be found on
the Internet. Most of it will be provided by the distribution vendor in the form of package
files and the rest will be available in source code form that can be installed manually.
Package Files
• The basic unit of software in a packaging system is the package file. A package file is a
compressed collection of files that include the software package.
• Package files are created by a person known as a package maintainer, often (but not
always) an employee of the distribution vendor.
Repositories or warehouses
• While some software projects choose to perform their own packaging and distribution,
most packages today are created by the distribution vendors and interested third parties.
• Packages are made available to the users of a distribution in central repositories
that may contain many thousands of packages, each specially built and maintained for
the distribution.
Dependencies
• Programs seldom “standalone;” rather they rely on the presence of other software
components to get their work.
High And Low-level Package Tools
• Package management systems usually consist of two types of tools:
• low-level tools which handle tasks such as installing and removing package files
• high-level tools that perform metadata searching and dependency resolution.
High And Low-level Package Tools

Distributions Low-Level Tools High-Level Tools


Debian-Style dpkg apt-get, aptitude
Fedora, Red Hat rpm yum
Enterprise Linux,
CentOS
Common Package Management Tasks
There are many operations that can be performed with the command line package management
tools. We will look at the most common:
Installing A Package From A Repository
High-level tools permit a package to be downloaded from a repository and installed with full
dependency resolution.

Style Command(s)
Debian apt-get update
apt-get install package_name
Red Hat yum install package_name
Installing A Package From A Package File
If a package file has been downloaded from a source other than a repository, it can be installed
directly (though without dependency resolution) using a low-level tool.

Style Command(s)
Debian dpkg --install package_file
Red Hat rpm -i package_file
Installing A Package From A Package File
Example: If the emacs-22.1-7.fc7-i386.rpm package file had been downloaded from a non-
repository site, it would be installed this way:
rpm -i emacs-22.1-7.fc7-i386.rpm
Removing A Package
Packages can be uninstalled using either the high-level or low-tools. The high-level tools are
shown below.

Style Command(s)
Debian apt-get remove package_name
Red Hat yum erase package_name
Example: To uninstall the emacs package from a Debian-style system:
apt-get remove emacs
Updating Packages From A Repository
The most common package management task is keeping the system up-to-date with the latest
packages. The high-level tools can perform this vital task in one single step.

Style Command(s)
Debian apt-get update; apt-get upgrade
Red Hat yum update
Example: To apply any available updates to the installed packages on a Debian-style
system:
apt-get update; apt-get upgrade
Upgrading A Package From A Package File
If an updated version of a package has been downloaded from a non-repository source, it can be
installed, replacing the previous version:
Style Command(s)
Debian dpkg --install package_file
Red Hat rpm -U package_file
Example: Updating an existing installation of emacs to the version contained in the
package file emacs-22.1-7.fc7-i386.rpm on a Red Hat system:
rpm -U emacs-22.1-7.fc7-i386.rpm
Listing Installed Packages
These commands can be used to display a list of all the packages installed on the system:

Style Command(s)

Debian dpkg --list


Red Hat rpm -qa
Determining If A Package Is Installed
These low-level tools can be used to display whether a specified package is installed:

Style Command(s)
Debian dpkg --status package_name
Red Hat rpm -q package_name
Example: To determine if the emacs package is installed on a Debian style system:
dpkg --status emacs
Displaying Info About An Installed Package
If the name of an installed package is known, the following commands can be used to display a
description of the package:
Style Command(s)
Debian apt-cache show package_name

Red Hat yum info package_name


Example: To see a description of the emacs package on a Debian-style system:
apt-cache show emacs
Finding Which Package Installed A File
To determine what package is responsible for the installation of a particular file, the following
commands can be used:

Style Command(s)
Debian dpkg --search file_name
Red Hat rpm -qf file_name
Example: To see what package installed the /usr/bin/vim file on a Red Hat system:
rpm -qf /usr/bin/vim
Finding A Package In A Repository
Using the high-level tools to search repository metadata, a package can be located based on its
name or description.

Style Command(s)
Debian apt-get update
apt-cache search search_string
Red Hat yum search search_string
What is a package manager in Linux?

In simpler words, a package manager is a tool that allows users to install, remove,
upgrade, configure and manage software packages on an operating system. The
package manager can be a graphical application like a software center or a command
line tool like apt-get or pacman.

Package management is a method of installing and maintaining software on the system.Today,


most people can satisfy all of their software needs by installing packages from their Linux
distributor.
Common Package Managers in Linux include:
o dpkg (Debian Package Manager)
o APT (Advanced Package Tool)
o rpm (RedHat Package Manager)
o yum (Yellowdog Update Modified)
o dnf (Dandified Yum)
o zypper
o flatpak
o pacman
o snap
o synaptic
Let's see the list of Linux package manager -
rpm
This the package management system used by Linux Standard Base (LSB)-compliant
distributions for the low-level handling of packages. Just like dpkg, it can query, install, verify,
upgrade, and remove packages, and is more frequently used by Fedora-based distributions, such
as RHEL and CentOS.
dpkg
It is a low-level package manager for Debian-based systems. It can install, remove, provide
information about and build *.deb packages but it can’t automatically download and install their
corresponding dependencies.
apt-get
It's a high-level package manager for Debian and derivatives and provides a simple way to
retrieve and install packages, including dependency resolution, from multiple sources using the
command line. Unlike dpkg, apt-get does not work directly with *.deb files, but with the package
proper name.
yum
It adds the functionality of automatic updates and packages management with dependency
management to RPM-based systems. As a high-level tool, like apt-get or aptitude, yum works
with repositories.
aptitude
It's another high-level package manager for Debian-based systems, and can be used to perform
management tasks (installing, upgrading, and removing packages, also handling dependency
resolution automatically) in a fast and easy way. It provides the same functionality as apt-get and
additional ones, such as offering access to several versions of a package.
dnf
DNF, short for Dandified Packaging Tool, is a more modernized and advanced version of the
YUM manager – incorporating the features of YUM while improving performance and resource
usage. For now, only Fedora has utilized this next-generation version of YUM, but hopefully, we
will see it spread to more operating systems in the future.
pacman
Pacman is the package manager found on Arch Linux. Pacman is the only package management
tool found on Arch, making it not a frontend. Arch Linux is a rolling release operating system,
with updates, added every day. There are only a few commands with Pacman, intended for
searching, installing, and removing packages. This package manager can connect to the internet
and acquire its packages from there, making it more user-friendly. However, Pacman is intended
for installing software from the Arch repository, rendering it unable to install from third-party
repositories.
portage
Portage is the package manager for Gentoo, a no-frills operating system that has to be compiled
from scratch when installing on any system. It is one of the most advanced package managers
currently available, with new features and improvements being added continuously.
up2date
up2date, also known as the Red Hat Update Agent, is a tool used by older versions of Red Hat
Enterprise Linux, CentOS, and Fedora Core that downloads and installs new software and
upgrades the operating system. It functions as a front-end to the RPM Package Manager and adds
advanced features such as automatic dependency resolution. The file /etc/sysconfig/rhn/sources
specify where up2date will search for packages.
abs
ABS, short for Arch Build System, is a system of tools intended for creating installable software
packages for Arch Linux out of source code. This consists of several tools functioning together
to create packages – these tools are all independent programs, such as makepkg, pacman, asp,
and so on. The package creation/installation method using ABS differs from a conventional
Linux distribution. Instead of installing pre-compiled packages, you need the PKGBUILD file to
be created from an Svn or Git branch by using the asp package.
urpmi
urpmi is a package management tool for installing, removing, updating and querying software
packages of local or remote (networked) media. It wraps around the RPM Package Manager
(RPM) package manager so that the user will not suffer the often-encountered[citation needed]
dependency hell. It works with official sources from Mandriva or unofficial sources such as
those from the Penguin Liberation Front. It has a graphical front-end: Rpmdrake.
ZYpp
ZYpp is another dependency resolver for the RPM package management system and is the
default package manager for OpenSUSE and SUSE Linux Enterprise. ZYpp utilizes .rpm
binaries, just like YUM, but is a bit faster due to being written in C++, where YUM is written in
Python. ZYpp is extremely easy to use, as it includes command shortcuts which can be used in
place of the full command.
Nix
Nix is a purely functional package management system. This means that the act of building a
package does not have side effects, such as destructively updating or deleting files that may be
used by other packages. Nix makes it easy for systems to use multiple versions of the same
package simultaneously, and ensure that updating or removing a package can't break other
packages. Furthermore, these actions are atomic, and so the system can't be left in an unstable
state. This all means that behavior with Nix is very predictable, which is particularly useful in
testing configurations and deploying across multiple systems.
Synaptic
Synaptic is a GTK+-based graphical user interface for APT (Debian). This package management
system used by Debian and its derivatives. Synaptic is usually used on systems based on deb
packages but can also be used on systems based on RPM packages. It can be used to install,
remove and upgrade software packages and to add repositories.
URPMI
URPMI is Mageia command line tool for managing packages and repositories (media). It’s a
powerful command-line tool which is used to automatically download and install new software
packages, upgrade existing software packages, update the package list index, and to upgrade the
entire Mageia system. urpmi handles dependencies automatically.
Flatpak
Flatpak is a software utility for software deployment, package management, and application
virtualization for Linux desktop computers. It provides a sandbox environment in which users
can run applications in isolation from the rest of the system. Applications using Flatpak need
permission from the user to control hardware devices or access the user's files.
Entropy
Entropy is the default package management system for Sabayon Linux, a Gentoo derivative.
What makes Entropy interesting is Sabayon utilizes binary files through Entropy, and also source
code through Gentoo package management system, Portage.
SNAP
Snap packages are secure, isolated from each other and the host system using technologies such
as AppArmor, It’s cross-platform, self-contained, allowing a developer to package the exact
software their application needs. This sandboxed isolation also improves security and allows
applications, and whole snap-based systems, to be rolled back should an issue occur. It has many
advantages over the more traditional package formats such as .deb, .rpm, and others. Snaps use a
special YAML formatted file named snapcraft.yaml. Snaps really are the future of Linux
application packaging.
Slackware
Packages in Slackware Linux are distributed as compressed tarballs, generally using gzip or lzma
compression. These tarballs can be recognized by their suffixes, .tgz or .txz. This format includes
a complete filesystem layout, as well as additional scripts to be run upon installation or removal
of the software. Slackware packages do not offer dependency resolution information; this is
generally viewed as allowing more flexibility and control. Packages can also be built using
SlackBuilds, shell scripts that compile source or repackage binary distribution packages for easy
installation and removal on Slackware.

What is Network Management?


Network management is the procedure of administering, managing and working a data network using a network
management system. Current network management systems use software and hardware to constantly collect and
analyse data and push out configuration changes for increasing performance, reliability, and security.

It involves configuring monitoring and possibly reconfiguring components in a network with the goal of providing
optimal performance, minimum downtime, proper security, accountability and flexibility.

Features

There are various features of network management which are as follows −

Network automation

One defining feature of a modern network management system is network automation. This is the procedure of
automating the configuring, handling, testing, deploying, and operating of physical and virtual devices inside a
network. Network service availability increases when everyday network tasks and functions are automated and
repetitive processes are controlled and managed automatically.

Network administration

Network administration encompasses tracking network resources, including switches, routers, and servers. It also
includes performance monitoring and software updates.

Network Operation

This contains smooth network functioning as created and intended, including close monitoring of activities to quickly
and effectively address and fix problems as they occur and preferably even before users are aware of the problem.

Network assurance

Network assurance features are often included in modern network management systems. These features help
improve network performance, customer experience, and security. Assurance systems help network analytics,
application analytics, and policy analytics, as well as AI and ML, to achieve full network assurance.

Network provisioning

Network provisioning involves network resource configuration for the purposes of supporting any given service, like
voice functions or accommodating additional users.

Network maintenance

Network maintenance covers upgrades and fixes to network resources. It also consists of proactive and remediation
activities executed by working with network administrators, such as replacing network gear like routers and switches.

Network analytics

Network analytics is a software tool that compares incoming information against preprogrammed operational models
and makes functional decisions for improving network performance.

Virtual hosting is a method for hosting multiple domain names (with separate handling of each
name) on a single server (or pool of servers).[1] This allows one server to share its resources, such as
memory and processor cycles, without requiring all services provided to use the same host name.
The term virtual hosting is usually used in reference to web servers but the principles do carry over
to other Internet services.
There are two main types of virtual hosting, name-based and IP-based. Name-based virtual hosting uses the host
name presented by the client.Port-based virtual hosting is also possible in principle but is rarely used in practice
because it is unfriendly to users.

Name-based

Name-based virtual hosts use multiple host names for the same IP address. Name-based virtual hosting uses the
host name presented by the client. This saves IP addresses and the associated administrative overhead but the
protocol being served must supply the host name at an appropriate point. In particular, there are significant difficulties
using name-based virtual hosting with SSL/TLS.

IP-based
When IP-based virtual hosting is used, each site (either a DNS host name or a group of DNS host names that act the
same) points to a unique IP address. The webserver is configured with multiple physical network interfaces, virtual
network interfaces on the same physical interface or multiple IP addresses on one interface. The web server can
either open separate listening sockets for each IP address, or it can listen on all interfaces with a single socket and
obtain the IP address the TCP connection was received on after accepting the connections. Either way, it can use the
IP address to determine which website to serve. The client is not involved in this process and therefore (unlike with
name-based virtual hosting) there are no compatibility issues.

Port-based[edit]

The default port number for HTTP is 80. However, most webservers can be configured to operate on almost any port number,
provided the port number is not in use by any other program on the server. There is the HTTP Secure special port 443 that needs
special configuration (see Server Name Indication). Port based web sites are explicitly bound to a unique port number and an IP
address. In this case the IP address is used for hosting multiple web sites. The unique port number used for a common IP address
distinguish an individual web site from other web sites bound to the same IP Address.

IIS Services

Internet Information Services is a general-purpose web server from Microsoft. It runs on a Windows
system and provides the user with the requested set of webpages or files. IIS protocols form the basics of
internet information services. The function of a web server is to approve requests from various client
computers to return the required response.  It enables web servers to deliver the transfer information
across an array of Local Area Networks (LANs) including corporate intranets. It has the ability to share
information with the user in numerous forms such as text documents, HTML webpages, and images.

How Does It Work?

It works using a wide range of protocols and languages. To create text buttons and image placements, HTML is
used extensively. The HTTP (Hyper Text Transfer Protocol) acts as the basic protocol in order to transfer
information from the web server to the user. On the other hand, the File Transfer Protocol (FTP) is used to
transfer files.

Further, the Secure Sockets Layer (SSL) Protocol, developed by Netscape in order to transfer documents
through the internet, has a cryptographic system that puts to use a couple of keys to undertake data
encryption.

There are two types of keys:

 A public key which is available to everyone


 A private key that is available only to the recipient of the message

IIS not only includes all the essential features for the website to be hosted, it also supports extensions that add
extra functionalities to the server. For instance, the WinCache allows the PHP script to run much faster by
caching the processes of the PHP. The URL Rewrite Model enables webmasters to publish pages having friendly
URLs. These pages make it easier for the user to type and remember these friendly URLs.
IIS is a go-to option for commercial websites as it offers several advanced features that are backed by
Microsoft. However, a commercial license is required for using it. Its price can witness a rise depending on the
number of users. Therefore, the open-source and free-for-all Apache HTTP Server remains the most widely-
used web server software.

The Applications Of IIS

 The IIS Manager is used for configuring the features of the IIS
 The File Transfer Protocol allows the user to upload and download files
 Webpage isolation is used to prevent one website from interfering with other websites on the user’s server
 It is also used to configure web applications that are developed using a wide range of programming languages
PHP, Python, and ASP.NET
 The Windows PowerShell can be used for undertaking a majority of administrative tasks for your web server

The Advantages Of IIS Are As Follows

 The cost of the deployment / user gets reduced with the use of IIS. The final users (end users) of an IIS
application can run it via a browser. A user doesn’t require to install a specialized software on his computer in
order to run the application
 IIS applications work with a multitude of browsers and Operating Systems (OS). It gives the user an opportunity
to reach a wide audience
 The framework of active server pages gives the user an object model which enables the user to manipulate
forming the core of the IIS. Furthermore, it allows the user to undertake data retrieval from a browser
 Once a web class has been created, it can easily be accessed in a separate web class
 Unlike scripting, your code isn’t embedded in the HTML document. The process of developing and designing the
application or website’s User Interface can be separated from writing and debugging its code
 The state  between a client and the server can be managed using a database or an object 

Install IIS 8.5 on Windows Server 2012 R2

IIS is one of the server roles on Windows Server 2012 R2, named Web Server (IIS). You
can use the following to install IIS:

 The Server Manager user interface in Windows Server 2012 R2


 A command-line installation using DISM (Deployment Image Servicing and Management)
 A command-line installation using PowerShell cmdlets

IIS can also be installed on Windows 8 through the Turn Windows features on or


off dialog box from the Programs and Features settings of the Control Panel.
Install IIS 8.5 using the Server Manager
Install IIS 8.5 for the first time in the Server Manager

When the Web Server (UI) role is chosen for the first time in the Add Roles and
Features Wizard in Server Manager, the basic components and services needed for IIS
are automatically selected. The following procedure will install Internet Information
Services on a running physical server when IIS has not already been installed. To change
an existing installation of IIS, perform the next procedure, Install additional role services
for IIS. These two procedures involve different steps.

1. Open Server Manager by clicking the Server Manager icon on the desktop.

2. In the Server Manager window, with the Dashboard and Quick Start selected,


click Add roles and features, or click the Manage menu, and then click Add Roles
and Features. The Add Roles and Features Wizard will start with a Before You
Begin page. The wizard asks for verification of the following:

o The administrator account has a strong password.


o The network settings, such as IP addresses, are configured.
o The most current security updates from Windows® Update are installed.

3. On the Before You Begin page, click Next.

4. On the Installation Type page, select Role-based or feature-based


installation to configure a single server. Click Next.

5. On the Server Selection page, select Select a server from the server pool, and


then select a server; or select Select a virtual hard disk server, select a server to
mount the VHD on, and then select a VHD file. Click Next.

6. On the Server Roles page, select Web Server (IIS).

7. In the Add Roles and Features wizard, click Add Features if you want to install


the IIS Management Console. If you do not want to install the Management
Console, uncheck Include management tools (if applicable), and then
click Continue.
8. On the Server Roles page, click Next.

9. On the Features page, select any features that you would like to install, and then
click Next. Note that you do not need to select any features on this page to install
IIS. IIS setup will select the features that are required.

10. On the Web Server Role (IIS) page, click Next.

11. On the Role Services page, select any additional role services that you want to
install.

You can also deselect role services that were selected by default when you
selected Web Server. However, at least one role service must be selected for Web
Server to be selected and installed.

12. If you selected a role service that requires other role services or features to be
installed, a page will be opened indicating the role services or features to be
installed. Leave Include management tools (if applicable) selected to select the
install management tools associated with the server role. You may not need the
management tools on the destination server if you plan to manage the role
remotely. Click Add Features to add the required role services or features.

13. After you have added the role services that you need on the Role Services page,
click Next.

14. On the Confirmation page, verify the role services and features that are selected.
Select Restart the destination server automatically if required to restart the
destination server if the settings need to take immediate effect. To save the
configuration information to an XML-based file that you can use for unattended
installations with Windows PowerShell, select Export configuration settings,
move to the appropriate path in the Save As dialog box, enter a file name, and
then click Save.

When you are ready to start the installation process on the Confirmation page,


click Install.
15. The Installation Progress page is displayed. You can close the wizard without
interrupting running tasks. You can view task progress or open the page again by
clicking Notifications in the notification area, and then clicking Task Details.

16. On the Results page, verify that the installation succeeds, and then click Close.

17. Confirm that the Web server works by opening a Web browser, and verifying that
the following default Web page is displayed when you use
the http://localhost address.

You might also like