Shell Scripts





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Free Shell Scripts
List All
Rename File
Rename Multiple Files
Remove Files From Folder
Fun Dancing Script
Dancing Move
FTP Login Report
Netstats

 





outsourced web hosting support

Netstats / Network Statistics Script


About
Netstats is a simple script for checking network and Internet connections. The Netstats script is used to display the total request, connection to port 80, ESTABLISHED status, TIME_WAIT status, FIN_WAIT1 status, LAST_ACK status, SYN_RECV status, LISTEN status and CLOSE_WAIT status.


Features
a) Used to find out the netstats.
b) Just copy the code and use it in your command line.
c) Server side script to check network statistics.

Code
<!--    Script by hscripts.com    -->
<!--    Copywrite of HIOXINDIA    -->
<!--    More scripts @www.hscripts.com   -->

nreq=$(netstat -apnut | grep ':80' | grep -v '127.0.0.1' | wc -l)
nest=$(netstat -apnut | grep 'ESTABLISHED' | grep -v '127.0.0.1' | wc -l)
ntmt=$(netstat -apnut | grep 'TIME_WAIT' | grep -v '127.0.0.1' | wc -l)
nfnwt=$(netstat -apnut | grep 'FIN_WAIT1' | grep -v '127.0.0.1' | wc -l)
nlst=$(netstat -apnut | grep 'LAST_ACK' | grep -v '127.0.0.1' | wc -l)
nsyn=$(netstat -apnut | grep 'SYN_RECV' | grep -v '127.0.0.1' | wc -l)
nlist=$(netstat -apnut | grep 'LISTEN' | grep -v '127.0.0.1' | wc -l)
ncls=$(netstat -apnut | grep 'CLOSE_WAIT' | grep -v '127.0.0.1' | wc -l)

echo "Total request on"  `date +" %d-%m-%y-%R"` >> test.txt
echo "Connection to port 80 " $nreq >> test.txt
echo "ESTABLISHED status" $nest >> test.txt
echo "TIME_WAIT status" $ntmt >> test.txt
echo "FIN_WAIT1 status" $nfnwt >> test.txt
echo "LAST_ACK status" $nlst >> test.txt
echo "SYN_RECV status" $nsys >> test.txt
echo "LISTEN status" $nlist >> test.txt
echo "CLOSE_WAIT status" $ncls >> test.txt
echo "==================================================" >> test.txt

#------------ Script by hscripts.com -------------------------#

Release Date - 06-04-2010
Get free version without ©copyright link for just 5 price

For customization of this script or any script development, contact us at support@hscripts.com




Usage
a) Copy the above code and save it with .sh extension
b) This script is used to find the netstats / network statistics.
c) Execute the netstats shell script as sh filename.sh.
d) All the information are stored in test.txt file. Get the details just open test.txt file and read it.


License
- The Unix Shell Scripts and examples is given under GPL License
- i.e. Free use for those who use it as it is.
- Free, if your modification does not remove our copyright information and links.
- For Detailed License information Click here
- If your requirements does not meet GPL License terms, you can purchase the script with us.
Other Links

web hosting