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

Opened port and services using netstat

netstat also returns network service statistics. It has many features beyond what is covered in this recipe.

Use netstat -tnp to list opened port and services:

$ netstat -tnp 
Proto Recv-Q Send-Q Local Address           Foreign Address         
    State       PID/Program name 

tcp        0      0 192.168.0.82:38163      192.168.0.2:3128        
    ESTABLISHED 2261/firefox-bin 

tcp        0      0 192.168.0.82:38164      192.168.0.2:3128        
    TIME_WAIT   -               

tcp        0      0 192.168.0.82:40414      193.107.206.24:422      
    ESTABLISHED 3836/ssh

tcp        0      0 127.0.0.1:42486         127.0.0.1:32955         
    ESTABLISHED 4022/GoogleTalkPlug

tcp        0      0 192.168.0.82:38152      192.168.0.2:3128        
    ESTABLISHED 2261/firefox-bin 

tcp6       0      0 ::1:22                  ::1:39263               
    ESTABLISHED -               

tcp6       0      0 ::1:39263               ::1:22                  
    ESTABLISHED 3570/ssh
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