Languages
[Edit]
EN

Linux - list all clients connected to my http server over 80 port

1 points
Created by:
Pearl-Hurley
559

In this article, we're going to have a look at how to print all people/users/client connected to my http server (over 80 port) by tcp/tcp6 protocol and their IP adresses with netstat command under Bash in Linux.

Type in terminal:

netstat -tn 2>/dev/null | grep -E '\s[0-9.]+:80\s' | awk '{print $5}' | cut -d : -f 1 | sort | uniq -c | sort -nr

Where:

netstat -tn 2>/dev/nullreturns informations all tcp/tcp6 connections
grep -E '\s[0-9.]+:80\s'filters rows that contains ip addres with 80 port using regular expressions
awk '{print $5}'prints only column 5th that is described as "Foreign Address" that contains connected client ip address with his remote port
cut -d : -f 1extracts only ip address for connected client
sortsorts rows to let them to be counted with next command (uniq command)
uniq -ccounts (-c) neighbouring rows and print them as: number_of_rows row_text
sort -nrmakes numeric sort (-n) and reverse result (-r)

Console print:

      6 172.68.11.24
      4 172.69.54.62
      4 172.68.244.83
      2 162.158.94.163
      2 162.158.158.200
      2 162.158.154.66
      1 198.41.230.75
      1 172.69.71.73
      1 172.69.55.171
      1 172.69.54.224
      1 172.69.35.58
      1 172.69.159.137
      1 172.69.134.86
      1 172.68.63.106
      1 172.68.62.45
      1 172.68.62.39
      1 172.68.246.67
      1 172.68.246.43
      1 172.68.245.66
      1 172.68.245.150

 

Alternative titles

  1. Linux - how to list all people/users/clients connected to my http server over 80 port?
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Linux

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join