Link to home
Start Free TrialLog in
Avatar of Zack
ZackFlag for Australia

asked on

Displaying traffic using a specific port on a server.

Hi EE,

Running the command:

ss -t | grep 22


Result:

State      Recv-Q Send-Q                                         Local Address:Port                                             Peer Address:Port
ESTAB      0      0                                                  127.0.0.1:59392                                               127.0.0.1:38537
ESTAB      0      52                                              10.2.112.119:ssh                                                10.98.4.13:64686
ESTAB      0      0                                                  127.0.0.1:38537                                               127.0.0.1:59392
ESTAB      0      0                                                  127.0.0.1:59392                                               127.0.0.1:38535
ESTAB      0      0                                                  127.0.0.1:38535                                               127.0.0.1:59392

What is the correct syntax for only displaying connections that are using port 22 for comms?

Any assistance is welcome.

Thank you.
Avatar of Prabhin MP
Prabhin MP
Flag of India image

ss -t command will list out the connections which are established.
The ss command is a tool used to dump socket statistics and displays information in a similar fashion (although simpler and faster) to netstat.
 
-t means TCP
-u means UDP

ss -t | grep 22

shows  that you are searching  ssh established connections
Avatar of Zack

ASKER

Hi Prabhin,

Fair enough is there a way to get a historical log of established connections over a period of time using the command line.

Thank you.
ASKER CERTIFIED SOLUTION
Avatar of Prabhin MP
Prabhin MP
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zack

ASKER

Hi Prabhin,

Thank you for your help, much appreciated.