Skip to Content
Linux Shell Scripting Cookbook - Third Edition
book

Linux Shell Scripting Cookbook - Third Edition

by Clif Flynt, Sarath Lakshman, Shantanu Tushar
May 2017
Beginner
552 pages
28h 47m
English
Packt Publishing
Content preview from Linux Shell Scripting Cookbook - Third Edition

Displaying the status of tcp sockets

A tcp socket connection is opened for every HTTP access, every SSH session, and so on. The -t option reports the status of TCP connections:

    $ ss -t
    ESTAB      0      0   192.168.1.44:740          192.168.1.2:nfs  
    ESTAB      0      0   192.168.1.44:35484        192.168.1.4:ssh

    CLOSE-WAIT 0      0   192.168.1.44:47135         23.217.139.9:http    

This example shows an NFS server connected at IP address 192.168.1.2 and an SSH connection to 192.168.1.4.

The CLOSE-WAIT socket status means that the FIN signal has been sent, but the socket has not been fully closed. A socket can remain in this state forever (or until you reboot). Terminating the process that owns the socket may free the socket, but that's not guaranteed.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Linux Shell Scripting - Second Edition

Mastering Linux Shell Scripting - Second Edition

Mokhtar Ebrahim, Andrew Mallett

Publisher Resources

ISBN: 9781785881985