Languages
[Edit]
EN

Linux - list all connected tcp clients

2 points
Created by:
Mark-Rotteveel
537

In this article, we're going to have a look at how to print connected tcp/tcp6 clients and their ip adresses with netstat command under Bash in Linux.

1. Simple console print example

Edit

Type in terminal:

Where:

  • -t means tcp connections only,
  • -n show numerical addresses.

Becasue: netstat -tn is equivalent to netstat -t -n

Console print:

Where:

  • Foreign Address - shows ip addresses for connected clients

Note: as we can see in console print, there are connected only tcp6 clients.

2. Other netstats useful variants

Edit

If we would like remove errors we can redirect stderr (standard error output) to null dev (place where unnecessary things "vanish") with following command:

Where:

  • 2> redirects error output to other place.

If we would like to make print scrollable following command will be useful:

Where:

  • | redirects ouput from one program to another one,
  • less displays results in scrollable form.

Alternative titles

  1. Linux - how to list all connected tcp clients?
1
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