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

Share this Article :

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 Response

  1. Naveen

Leave a Reply