Top community members
All Wiki Articles Create Wiki Article

In the past we had a dream,
to have place where we could share IT knowledge,
to ask questions without fear that someone will judge us.

Now we are a group of people who make this dream come true. ❤ 💻

If you think sharing knowledge and helping other is valuable.

join our community - Click here

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

0 contributions
1 points

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

 

0 contributions

Suggested wiki articles:

Suggested findings

Let's do the work and have some fun
  • Dirask is online IT community for professionals and hobbyist to share their knowledge and help each other in extraordinary easy way. ❤ 💻 🙂
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    we will help you. 👍 ✔ 🦄
Read more