Techno Explore
  • Softwares
  • Design
  • Web Hosting
  • Tech
  • Ebooks
  • Laptops
0

Netstat Command in Linux

12 September, 2010 - Linux and Unix

netstat command and shell pipe feature can be used to dig out more information about particular IP address connection. You can find out total established connections, closing connection, SYN and FIN bits and much more. You can also display summary statistics for each protocol using netstat.

This is useful to find out if your server is under attack or not. You can also list abusive IP address using this method.
# netstat -nat | awk '{print $6}' | sort | uniq -c | sort -n

Dig out more information about a specific ip address:
# netstat -nat |grep {IP-address} | awk '{print $6}' | sort | uniq -c | sort -n

      2 LAST_ACK
      2 LISTEN
      4 FIN_WAIT1
     14 ESTABLISHED
     91 TIME_WAIT
    130 FIN_WAIT2

Busy server can give out more information:
# netstat -nat |grep 202.54.1.10 | awk '{print $6}' | sort | uniq -c | sort -n

Get List Of All Unique IP Address

To print list of all unique IP address connected to server, enter:
# netstat -nat | awk '{ print $5}' | cut -d: -f1 | sed -e '/^$/d' | uniq
To print total of all unique IP address, enter:
# netstat -nat | awk '{ print $5}' | cut -d: -f1 | sed -e '/^$/d' | uniq | wc -l

Find Out If Box is Under DoS Attack or Not

If you think your Linux box is under attack, print out a list of open connections on your box and sorts them by according to IP address, enter:
# netstat -atun | awk '{print $5}' | cut -d: -f1 | sed -e '/^$/d' |sort | uniq -c | sort -n

Display Summary Statistics for Each Protocol

Simply use netstat -s:
# netstat -s | less
# netstat -t -s | less
# netstat -u -s | less
# netstat -w -s | less
# netstat -s

Display Interface Table

You can easily display dropped and total transmitted packets with netstat for eth0:
# netstat --interfaces eth0

More From sriramraj

  • How to change file modification date in linux
  • Linux command reference
  • Unix Command Reference

sriramraj Recommends

  • jobs in isro  (StudentsTips)
  • jobs in indian railways  (StudentsTips)
  • free wordpress themes in internet  (StudentsTips)
  • Get indexed in google fast  (rossjoyner)
  • Command Line In Windows  (phil67)
  • Food Gems in Phoenix  (scrollinondubs)
Blog Margeting Related Posts Plugin For sriramrajAsk sriramraj To Recommend Your Posts Blog Marketing Related Posts Plugin Counter

Share

Related posts:

  1. SS Command in Linux
  2. Linux command reference
  3. scp command in unix

No comments yet.

Add a comment

Top
Click here to cancel reply.
(it will not be shared)

Subscribe to Latest News

Enter your email address:

Delivered by FeedBurner

TechnoExplore Popular

  • BlackBerry History and Advantages
  • Mobile Web Apps you can’t Live Without
  • 10 music Iphone Applications
  • WhatFontis Font Recognition Technology
  • Trending Icons from Icons-Land
  • Top Android Apps for free
  • Top Laptops 2011
  • Word to PDF Converter
  • Top Mozilla Shortcuts
  • 10 Music Iphone Applications

TechnoExplore on Facebook

TechnoExplore Recent

  • Media Temple Coupons and Deals
  • Listen to Favorite songs with Windows Down Playlist
  • Innovate your Workspace with Pimp My Cube Contest
  • BlackBerry History and Advantages
  • Upgrade your cubicle with Pimp my cube contest