Thursday, 26 October 2017

RHEL7 Sed Command Examples

Sed Command in Unix and Linux Examples

                                   

 

Sed is a Stream Editor used for modifying the files in unix (or linux). Whenever you want to make changes to the file automatically, sed comes in handy to do this. Most people never learn its power; they just simply use sed to replace text. You can do many things apart from replacing text with sed. Here I will describe the features of sed with examples.

 

Linux Sed Commands

Linux Sed Command Description

sed 's/Nick/John/g' report.txt

Replace every occurrence of Nick with John in report.txt

sed 's/Nick|nick/John/g' report.txt

Replace every occurrence of Nick or nick with John

sed 's/Nick/John/2' report.txt

Command Replaces the second occurrence of the word "Nick" with "John" in a line.

sed 's/Nick/John/3g' report.txt

Replacing from nth occurrence to all occurrences in a line,In This example 3rd ,4rth,5th …..

sed '3 s/unix/linux/' file.txt

Replacing string on a specific line number.

sed '/unix/ a "Add a new line"' file.txt

The sed command can add a new line after a pattern match is found. The "a" command to sed tells it to add a new line after a match is found

sed '/unix/ i "Add a new line"' file.txt

The sed command can add a new line before a pattern match is found. The "i" command to sed tells it to add a new line before a match is found.

sed '/unix/ c "Change line"' file.txt

The sed command can be used to replace an entire line with a new line. The "c" command to sed tells it to change the line.

sed 's/^/ /' file.txt >file_new.txt

Add 8 spaces to the left of a text for pretty printing

sed -n '/Of course/,/attention you \ pay/p' myfile.

 

Display only one paragraph, starting with "Of course"

and ending in "attention you pay"

 

sed -n 12,18p file.txt

Show only lines 12-18 of file.txt

sed 12,18d file.txt

Show all of file.txt except for lines from 12 to 18

sed -n -e '5,7p' -e '10,13p' myfile.txt

 

Display lines 5-7 and 10-13 from myfile.txt:

sed -f script.sed file.txt

Write all commands in script.sed and execute them

sed '$d' file.txt

Delete the last line

sed '/[0-9]\{3\}/p' file.txt

Print only lines with three consecutive digits

sed '17,/disk/d' file.txt

Delete all lines from line 17 to 'disk'

sed 's/^[ ^t]*//' file.txt

Delete all spaces in front of every line of file.txt

sed 's/[ ^t]*$//' file.txt

Delete all spaces at the end of every line of file.txt

sed 's/^[ ^t]*//;s/[ ^]*$//' file.txt

Delete all spaces in front and at the end of every line

of file.txt

 

ip route show | sed 's/  */ /g'

To replace multiple blank spaces with a single space, we will use the output of ip route show and a pipeline

sed 's/foo/bar/' file.txt

Replace foo with bar only for the first instance in a line

sed 's/foo/bar/4' file.txt

Replace foo with bar only for the 4th instance in a line.

 

sed 's/foo/bar/g' file.txt

Replace foo with bar for all instances in a line.

 

sed '30,40 s/version/story/g' myfile.txt

Replacing words only within a line range (30 through 40, for example)

sed '/baz/s/foo/bar/g' file.txt

Only if line contains baz, substitute foo with bar

sed -n '/^Jul  1/ p' /var/log/secure

Viewing the authorization and authentication activities that took place on July 2, as per the /var/log/secure log in a CentOS 7 server

sed '/^#\|^$\| *#/d' httpd.conf

To remove empty lines or those beginning with # from the Apache configuration file,

sed '/./,/^$/!d' file.txt

Delete all consecutive blank lines except for EOF

sed '/^$/N;/\n$/D' file.txt

Delete all consecutive blank lines, but allows only top blank line

sed '/./,$!d' file.txt

Delete all leading blank lines

sed -e :a -e '/^\n*$/{$d;N;};/\n$/ba' \ file.txt

 

Delete all trailing blank lines

sed '1,20 s/Johnson/White/g' file.txt

Do replacement of Johnson with White only on lines between 1 and 20

sed '1,20 !s/Johnson/White/g' file.txt

Do replacement of Johnson with White (match all except lines 1-20)

sed -i'.orig' 's/this/that/gi' myfile.txt

suffix following the -i option (inside single quotes) to be used to rename the original file.

 

Replace all instances of this or This (ignoring case) with that in myfile.txt, and we will save the original file as myfile.txt.orig.

 

sed -i 's/that/this/gi;s/line/verse/gi' myfile.txt

Performing two or more substitutions at once

sed 's/unix/linux/p' file.txt

The /p print flag prints the replaced line twice on the terminal. If a line does not have the search pattern and is not replaced, then the /p prints that line only once.

sed -n 's/unix/linux/p' file.txt

Use the -n option along with the /p print flag to display only the replaced lines. Here the -n option suppresses the duplicate rows generated by the /p flag and prints the replaced lines only one time

sed '/./{H;$!d;};x;/regex/!d' file.txt

Print paragraphs only if they contain regex

sed -e '/./{H;$!d;}' -e 'x;/RE1/!d;\

/RE2/!d;/RE3/!d' file.txt

 

Print paragraphs only if they contain RE1, RE2 and RE3

 

sed 's/\(.*\)foo/bar/' file.txt

Replace only the last match of foo with bar

 

sed '/regexp/!d' file.txt

grep equivalent

sed -n '/regexp/{g;1!p;};h' file.txt

Print the line before the one matching regexp, but not the one containing the regexp

sed -n '/regexp/{n;p;}' file.txt

Print the line after the one matching the regexp, but

not the one containing the regexp

sed '/pattern/d' file.txt

Delete lines matching pattern

sed '/./!d' file.txt

Delete all blank lines from a file

sed '/^$/N;/\n$/N;//D' file.txt

Delete all consecutive blank lines except for the first two

sed -n '/^$/{p;h;};/./{x;/./p;}'\ file.txt

Delete the last line of each paragraph

sed 's@/usr/bin@&/local@g' path.txt

Replace /usr/bin with /usr/bin/local in path.txt

sed -e '/^#/d' /etc/services | more

View the services file without the commented lines

sed '/regex/{x;p;x;G;}' file.txt

Insert blank line above and below

sed 's/^[ ^t]*//' file.txt

Delete all spaces in front of every line of file.txt

sed 's/[ ^t]*$//' file.txt

Delete all spaces at the end of every line of file.txt

sed 's/^[ ^t]*//;s/[ ^]*$//' file.txt

Delete all spaces in front and at the end of every line of file.txt

sed 's/unix/linux/' file.txt| sed 's/os/system/'

Sed provides -e option to run multiple sed commands in a single sed command. The above output can be achieved in a single sed command as shown below.

sed -e 's/#.*//;/^$/d'  thegeekstuff.txt

Eliminate Comments and Empty Lines Using sed

sed -i '1d' /tmp/passwd

Editing the Source file by using ‘-i’ option. Above command will delete the first line of source file /tmp/passwd

 

 

root@nextstep4it:~# sed -i.bak '1d' /tmp/passwd

root@nextstep4it:~# ls -l /tmp/passwd*

-rw-r--r-- 1 root root 2229 Nov 24 22:36 /tmp/passwd

-rw-r--r-- 1 root root 2261 Nov 24 22:35 /tmp/passwd.bak

 

In the above sed command , 1st line of file /tmp/passwd will be deleted but before that sed command takes the backup of /tmp/passwd as /tmp/passwd.bak

 

 

 

$ sed -n 's/Linux/Linux-Unix/gpw output' thegeekstuff.txt

1. Linux-Unix Sysadmin, Linux-Unix Scripting etc.

4. Storage in Linux-Unix

$ cat output

1. Linux-Unix Sysadmin, Linux-Unix Scripting etc.

4. Storage in Linux-Unix

 

Write Changes to a File and Print the Changes Using sed s//gpw

ip route show |sed -n '/src/p' | sed -e 's/  *//g'| cut -d ' '-f9

Combining sed and other commands

 

extract our IP address from the output of the ip route command.

We will begin by printing only the line where the word src is. Then we will convert multiple spaces into a single one. Finally, we will cut the 9th field (considering a single space as field separator), which is where the IP address is:

 

 

Rhel 7 Grep Command

 GREP Command in Unix and Linux Examples

                          

About Grep :

grep is a command-line utility for searching plain-text data sets for lines that match a regular expression

 

Grep Linux Command

Grep Linux Command Description

grep book /etc/passwd

command to search book in a file

grep -i "book" /etc/passwd

To ignore word case i.e match book, Book, BOOK and all other combination with the -i option:

 

grep -R "192.168.1.5" /etc/

You can search recursively i.e. read all files under each directory for a string “192.168.1.5”

grep -w "book" file

The grep command to select only those lines containing matches that form whole words i.e. match only book word:

 

egrep -w 'word1|word2' /path/to/file

Use grep to search 2 different words

grep -c 'word' /path/to/file

The grep can report the number of times that the pattern has been matched for each file using -c (count) option

grep -n 'root' /etc/passwd

Pass the -n option to precede each line of output with the number of the line in the text file from which it was obtained

grep -v mars /path/to/file

You can use -v option to print inverts the match;

To print all line that do not contain the word mars:

 

dmesg | egrep '(s|h)d[a-z]'

show the name of the hard disk devices:

 

grep -i 'Model' /proc/cpuinfo

        or

Display cpu model name:

$ grep --color vivek /etc/passwd

 

force grep to display output in colors, enter:

 

$ grep -v -c this demo_file

 

how many lines that does not match the pattern

 

 

Grep Command

Grep command Description

grep -o -b "string" file.txt

 

Displaying the position of the matched string in the line

The -b option allows the grep command to display the character position of the matched string in a file.

 

grep -B 2 "Error" file.txt

 

Displaying the lines before the match.

In log file it will tell lines around the error lines to know the cause of the error.

This will prints the matched lines along with the two lines before the matched lines.

 

grep -A 3 "Error" file.txt

 

Displaying the lines after the match.

This will display the matched lines along with the three lines after the matched lines.

grep -C 5 "Error" file.txt

 

Displaying the lines around the match

This will display the matched lines and also five lines before and after the matched lines

$ export GREP_OPTIONS='--color=auto' GREP_COLOR='100;8

 

It will set the color for Matched Line and pattern found will be color

 

Wednesday, 25 October 2017

RHEL7 Mail Server(Postfix)

Mail Server(Postfix)

                 

 

 

Postfix is a powerful but easy-to-configure mail server

 

Postfix is a free and open-source mail transfer agent(MTA)that routes and deliver electronic mail

Postfix implements a high-performance parallelized mail-delivery

engine

Postfix implements a limited number of features in the MTA,and relies on third-party extensions for the rest

 

                Server Configuration

 

To install postfix Mail Server

 

 

[root@server ~]# yum install -y postfix

Loaded plugins: fastestmirror, langpacks

base                                                     | 2.9 kB     00:00

Loading mirror speeds from cached hostfile

Package 2:postfix-2.10.1-6.el7.x86_64 already installed and latest version

Nothing to do

[root@server ~]#

 

 

To Add a smtp service to the firewall:

 

 

[root@server ~]# firewall-cmd --permanent --add-service=smtp

success

[root@server ~]# firewall-cmd --zone=public --permanent --add-port=25/tcp

success

 

 

To Reload the firewall configuration

 

 

[root@server ~]# firewall-cmd --reload

success

 

 

To Activate the postfix service at boot:

 

[root@server ~]# systemctl enable postfix

 

 

 

 

To Start the postfix mail server

 

 

[root@server ~]# systemctl start postfix

 

 

 

To check the status of postfix mail server

 

 

[root@server ~]# systemctl status postfix

? postfix.service - Postfix Mail Transport Agent

  Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)

  Active: active (running) since Mon 2017-10-23 16:47:05 IST; 3min 34s ago

Main PID: 1439 (master)

  CGroup: /system.slice/postfix.service

          ??1439 /usr/libexec/postfix/master -w

          ??1449 pickup -l -t unix -u

          ??1450 qmgr -l -t unix -u

 

Oct 23 16:46:53 server systemd[1]: Starting Postfix Mail Transport Agent...

Oct 23 16:47:05 server postfix/master[1439]: daemon started -- version 2.10.1, configuration /etc/postfix

Oct 23 16:47:05 server systemd[1]: Started Postfix Mail Transport Agent.

 

      

               

Configure a central mail server

               

 

Edit the /etc/postfix/main.cf file and change the following directives:

 

 

[root@server ~]# vi /etc/postfix/main.cf

[root@server ~]#

myhostname = server.agoutam.com

mydomain = agoutam.com

myorigin = $mydomain

inet_interfaces = all

mydestination = $myhostname,localhost.$mydomain,localhost,$mydomain

mynetworks = 192.168.56.0/24,127.0.0.0/8

 

 

 

 

 

To Check the syntax of postfix main configuration file

 

 

[root@server ~]# postfix check

 

 

To Check the non-default configuration :

 

 

[root@server ~]# postconf -n

alias_database = hash:/etc/aliases

alias_maps = hash:/etc/aliases

command_directory = /usr/sbin

config_directory = /etc/postfix

daemon_directory = /usr/libexec/postfix

data_directory = /var/lib/postfix

debug_peer_level = 2

debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_                                                          directory/$process_name $process_id & sleep 5

html_directory = no

inet_interfaces = all

inet_protocols = all

mail_owner = postfix

mailq_path = /usr/bin/mailq.postfix

manpage_directory = /usr/share/man

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomainmydomain = agoutam.com

myhostname = server.agoutam.com

mynetworks = 192.168.56.0/24, 127.0.0.0/8

myorigin = $mydomain

newaliases_path = /usr/bin/newaliases.postfix

queue_directory = /var/spool/postfix

readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES

sample_directory = /usr/share/doc/postfix-2.10.1/samples

sendmail_path = /usr/sbin/sendmail.postfix

setgid_group = postdrop

unknown_local_recipient_reject_code = 550

 

 

                             

 

To Set the SELinux boolean to "on":

 

 

[root@server mail]# setsebool -P allow_postfix_local_write_mail_spool on

 

 

To create User to use for mail Service

 

 

[root@server mail]# adduser msgoutam

 [root@server mail]# passwd msgoutam

Changing password for user msgoutam.

New password:

BAD PASSWORD: The password contains the user name in some form

Retype new password:

passwd: all authentication tokens updated successfully.

 

 

To Send mail to user msgoutam

 

 

[root@server mail]# echo testmail |mail -s "Test Mail to Agoutam" msgoutam@agoutam.com

 

 

 

 

To Check Mail account of  user msgoutam

 

 

[root@server mail]# su - msgoutam

[msgoutam@server ~]$ mail

Heirloom Mail version 12.5 7/5/10.  Type ? for help.

"/var/spool/mail/msgoutam": 1 message 1 new

>N  1 root                  Mon Oct 23 17:11  18/591   "Test Mail to Agoutam"

& 1

Message  1:

From root@agoutam.com  Mon Oct 23 17:11:14 2017

Return-Path: <root@agoutam.com>

X-Original-To: msgoutam@agoutam.com

Delivered-To: msgoutam@agoutam.com

Date: Mon, 23 Oct 2017 17:11:14 +0530

To: msgoutam@agoutam.com

Subject: Test Mail to Agoutam

User-Agent: Heirloom mailx 12.5 7/5/10

Content-Type: text/plain; charset=us-ascii

From: root@agoutam.com (root)

Status: R

 

testmail

 

 

 

 

 

 

Type r to Reply to the mail

 

 

& r

To: msgoutam@agoutam.com root@agoutam.com

Subject: Re: Test Mail to Agoutam

 

root@agoutam.com (root) wrote:

 

> testmail

Got mail ,Thanks

 

 

 

Type q to quit from Mail Service

 

& q

New mail has arrived.

Held 1 message in /var/spool/mail/msgoutam

You have mail in /var/spool/mail/msgoutam

[msgoutam@server ~]$ su root

 

 

Configure a Client to forward all email to a central mail server

 

                     Null-client configuration

 

To Install postfix Mail Server in Client machine

 

[root@client ~]# yum install -y postfix

Loaded plugins: fastestmirror, langpacks

base                                                     | 2.9 kB     00:00

Loading mirror speeds from cached hostfile

Package 2:postfix-2.10.1-6.el7.x86_64 already installed and latest version

Nothing to do

[root@client ~]#

 

 

To Add service smtp in firewall

 

 

[root@client ~]# firewall-cmd --permanent --add-service=smtp

success

[root@client ~]# firewall-cmd --zone=public --permanent --add-port=25/tcp

success

 

 

 

To Reload firewall configuration

 

 

[root@client ~]# firewall-cmd --reload

success

 

 

To enable Postfix Mail Server during Boot Time.

 

[root@client ~]# systemctl enable postfix

 

 

To Restart postfix Mail server

 

 

[root@client ~]# systemctl restart postfix

 

 

Edit the /etc/postfix/main.cf file:

 

 

[root@client ~]# vi /etc/postfix/main.cf

myhostname = client.agoutam.com

mydomain = agoutam.com

myorigin = $mydomain

inet_interfaces = loopback-only

relayhost = 192.168.56.101

 

 

To Check the Postfix syntax of main.cf configuration file

 

[root@client ~]# postfix check

 

 

To Check the non-default configuration:

 

 

[root@client ~]# postconf -n

html_directory = no

inet_interfaces = all

inet_protocols = all

mail_owner = postfix

mailq_path = /usr/bin/mailq.postfix

manpage_directory = /usr/share/man

mydestination = $myhostname, localhost.$mydomain, localhost

mydomain = agoutam.com

myhostname = client.agoutam.com

myorigin = $mydomain

 

 

 

To Restart postfix Mail Server

 

[root@client ~]# systemctl restart postfix

[root@client ~]# systemctl enable postfix

 

 

To Send mail to user msgoutam ,user presents in Server Machine

 

[root@client ~]# echo "testmail" | mail -s "Testing relayhost " msgoutam@agoutam.com

 

 

To Check Maillog for mail msgoutam@agoutam.com

 

 

[root@client ~]# tail -10 /var/log/maillog

Oct 23 17:32:44 client postfix/smtp[2306]: 7B6C33098B13: to=<msgoutam@agoutam.com>, relay=192.168.56.101[192.168.56.101]:25, delay=0.17, delays=0.09/0.01/0.01/0.07, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as C86AC199FA1B)

 

 

 

To Check Mail for user msgoutam login as msgoutam

 

[root@server home]# su - msgoutam

Last login: Mon Oct 23 17:12:00 IST 2017 on pts/0

 

 

To check mail for user msgoutam ,using command mail:

 

 

[msgoutam@server ~]$ mail

Heirloom Mail version 12.5 7/5/10.  Type ? for help.

"/var/spool/mail/msgoutam": 3 messages 2 new

 A  1 root                  Mon Oct 23 17:11  20/614   "Test Mail to Agoutam"

>N  2 msgoutam@agoutam.com  Mon Oct 23 17:13  24/796   "Re: Test Mail to Agou"

 N  3 root                  Mon Oct 23 17:32  21/788   "Testing relayhost"

 

 

 

 

 

 

 

 

 

 

Type 3 to check Third mail from mail service .

 

& 3

Message  3:

From root@agoutam.com  Mon Oct 23 17:32:44 2017

Return-Path: <root@agoutam.com>

X-Original-To: msgoutam@agoutam.com

Delivered-To: msgoutam@agoutam.com

Date: Mon, 23 Oct 2017 17:32:44 +0530

To: msgoutam@agoutam.com

Subject: Testing relayhost

User-Agent: Heirloom mailx 12.5 7/5/10

Content-Type: text/plain; charset=us-ascii

From: root@agoutam.com (root)

Status: R

 

testmail

                   

 

 

Configure a system to forward all email to a central mail server

                Mail gateway configuration

 

Edit the /etc/postfix/main.cf file:

 

 

[root@client ~]# vi /etc/postfix/main.cf

myhostname = client.agoutam.com

mydomain = agoutam.com

myorigin = $mydomain

inet_interfaces = all

mydestination = $myhostname,localhost.$mydomain,localhost,$mydomain

mynetworks = 192.168.56.0/24,127.0.0.0/8

relayhost = 192.168.56.101

 

 

 

To Check the syntax of main configuration file main.cf

 

[root@client ~]# postfix check

 

 

 

To Check the non-default configuration:

 

 

[root@client ~]# postconf -n

alias_database = hash:/etc/aliases

alias_maps = hash:/etc/aliases

command_directory = /usr/sbin

config_directory = /etc/postfix

daemon_directory = /usr/libexec/postfix

data_directory = /var/lib/postfix

debug_peer_level = 2

debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_                                                           directory/$process_name $process_id & sleep 5

html_directory = no

inet_interfaces = all

inet_protocols = all

mail_owner = postfix

mailq_path = /usr/bin/mailq.postfix

manpage_directory = /usr/share/man

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

mydomain = agoutam.com

myhostname = client.agoutam.com

mynetworks = 192.168.56.0/24, 127.0.0.0/8

myorigin = $mydomain

newaliases_path = /usr/bin/newaliases.postfix

queue_directory = /var/spool/postfix

readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES

relayhost = 192.168.56.101

sample_directory = /usr/share/doc/postfix-2.10.1/samples

sendmail_path = /usr/sbin/sendmail.postfix

setgid_group = postdrop

unknown_local_recipient_reject_code = 550

 

 

                           

 

 To send Mail to user agoutam@agoutam.com

 

[root@client ~]# echo "test Gateway Configuration" | mail -s "Testing Gateway Configurationrelayhost " agoutam@agoutam.com

 

 

To Verify Mail sent by viewing Mail log

 

 

[root@client ~]# tail -10 /var/log/maillog

Oct 23 18:10:25 client postfix/cleanup[3151]: 54BBE3098B13: message-id=<20171023124025.54BBE3098B13@client.agoutam.com>

Oct 23 18:10:25 client postfix/qmgr[3136]: 54BBE3098B13: from=<root@agoutam.com>, size=488, nrcpt=1 (queue active)

Oct 23 18:10:25 client postfix/local[3153]: 54BBE3098B13: to=<agoutam@agoutam.com>, relay=local, delay=0.09, delays=0.07/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to mailbox)

Oct 23 18:10:25 client postfix/qmgr[3136]: 54BBE3098B13: removed

 

 

 

To check Mail login as agoutam

 

 

[root@client ~]# su - agoutam

Last login: Mon Oct 23 07:52:49 IST 2017 on pts/0

 

 

To Check mail type command mail logging as agoutam

 

 

[agoutam@client ~]$ mail

Heirloom Mail version 12.5 7/5/10.  Type ? for help.

"/var/spool/mail/agoutam": 2 messages 2 new

>N  1 root                  Mon Oct 23 17:47  18/625   "Testing Gateway Configuration relayhost"

 N  2 root                  Mon Oct 23 18:10  18/625   "Testing Gateway Configuration relayhost"

& q

Held 2 messages in /var/spool/mail/agoutam

[agoutam@client ~]$

 

 

To Install NMAP Tool for Verifying  Services.

 

 

 

[root@server ~]# yum install -y nmap

Loaded plugins: fastestmirror, langpacks

Loading mirror speeds from cached hostfile

Resolving Dependencies

--> Running transaction check

---> Package nmap.x86_64 2:6.40-7.el7 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

================================================================== Package                              Arch                               Version                                         Repository              Size

=================================================================Installing:

 nmap                                 x86_64                            2:6.40-7.el7                                    base                    4.0 M

 

Transaction Summary

===================================================================

Install  1 Package

 

Total download size: 4.0 M

Installed size: 16 M

Downloading packages:

nmap-6.40-7.el7.x86_64.rpm                                              | 4.0 MB  00:00:00

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Installing : 2:nmap-6.40-7.el7.x86_64                                   Verifying  : 2:nmap-6.40-7.el7.x86_64                                

Installed:

  nmap.x86_64 2:6.40-7.el7

 

Complete!

[root@server ~]#

 

 

                                                                                                                                                                                                        

                                                                                            

 

 

 

 

To Verify SMTP Service and Port is running using NMAP tool

 

 

[root@server ~]# nmap server.agoutam.com

 

Starting Nmap 6.40 ( http://nmap.org ) at 2017-10-23 18:15 IST

Nmap scan report for server.agoutam.com (192.168.56.101)

Host is up (0.000023s latency).

Not shown: 987 closed ports

PORT     STATE SERVICE

21/tcp   open  ftp

22/tcp   open  ssh

25/tcp   open  smtp

53/tcp   open  domain

80/tcp   open  http

88/tcp   open  kerberos-sec

111/tcp  open  rpcbind

2049/tcp open  nfs

 

Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds

[root@server ~]#

 

 

 

What is iSCSI and How Does it Work?