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"

Comments

1 Comment

Leave a Reply to Naveen Cancel reply

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