How to Check Concurrent user using Netstat Command on Linux Web Server

In this post, I will explain to you how to check concurrent users on a linux server. It was assumed that the web server is running on the default port 80. Netstat will print information about the Linux networking subsystem and express services listening on port Linux server along with details of any connection IP addresses is now made to them by using the port 80 .

List IP addresses connected to port 80 :

# netstat -tn 2>/dev/null | grep ':80 ' | awk '{print $5}' |sed -e 's/::ffff://' | cut -f1 -d: | sort | uniq -c | sort -rn | head

Calculate how many concurrent user that connected to port 80 :

# netstat -tn 2>/dev/null | grep ':80 ' | awk '{print $5}' |sed -e 's/::ffff://' | cut -f1 -d: | sort | uniq -c | sort -rn | head | wc -l

To get number of concurrent user and update every two seconds, type this command :

# watch "netstat -tn 2>/dev/null | grep ':80 ' | awk '{print $5}' |sed -e 's/::ffff://' | cut -f1 -d: | sort | uniq -c | sort -rn | head | wc -l"

One comment on “How to Check Concurrent user using Netstat Command on Linux Web Server

  • Naveen

    are command is correct ?? becuase google analytics shows as 100 and command shows them as 1000

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>