Linux netstat Command : Linux Networking

Blogs ❯❯ Linux

Image could not load

Image by pixabay

what is netstat command ?

netstat command की full form network statistics है यह एक networking tool जिसका use troubleshooting , configuration और किसी network पर connections के लिए monitoring tool की तरह use किया जाता है। incoming और outgoing connections, routing tables, port listening, और usage statistics को netstat command द्वारा ही monitoring किया जाता है।

इस article में हम netstat की कुछ basic और important commands के बारे में बात करेंगे ।

Linux install netstat

By default , system में netstat install नहीं होता है , इसे use करने से पहले आपको install करना पड़ेगा। Install करने के लिए नीचे दी गयी commands को run करें।

sudo apt update
sudo apt install netstat

install ही जाने के बाद , अब आप netstat command use कर सकते हैं।

List all listening ports

current network पर listening ports list करने के लिए netstat -a command use की जाती है। ये command run करने पर आपको काफी information देखने को मिलेगी। हालाँकि netstat command के साथ आप additional options pass कर सकते हैं।

netstat -a
netstat Command options

netstat के सभी options को देखने के लिए आप , man netstat या netstat --help command run करके देख सकते हैं।

man netstat 
netstat --help

List only TCP port connections

-a option pass करने पर आपको काफी information देखने को मिलती है , उसमे से सिर्फ TCP connections list करने के लिए -t option use करें।

netstat -at

List only UDP port connections

इसी तरह से सभी UDP connections list करने के लिए -au option pass करें।

netstat -au

List all actively listening ports

network पर सभी active listening ports (TCP और UDP) list करने के लिए netstat -l command का use किया जाता है।

netstat -l

हालाँकि आप अपनी need के according listening ports filter करने के लिए एक साथ -ut , -lut, -lu या -lt भी pass कर सकते हैं।

netstat -tunlp

netstat -tunlp command का use सभी active UDP + TCP ports को list करने के लिए किया जाता है , इस command में use किये गए options का मतलब इस तरह से है-

  • t : TCP

  • u : UDP

  • n : Numeric

  • l : listening

  • p : Program to show PID

netstat -tunlp

netstat + grep

Normally grep Command का use key के base पर search करने के लिए किया जाता है। और netstat command के साथ grep का use करके port connection को key के base पर filter कर सकते हैं।

For Example , सभी listening https , programs और ports list करने के लिए कुछ इस तरह से command run करेंगे।

netstat -ap | grep https

Network statistics

protocol को ascending order में sort करके सभी network statistics को pull और view करने के लिए -s option use किया जाता है।

netstat -s

इस पर आप need के according filters भी apply कर सकते हैं, जैसे -

  • netstat -st : for TCP statistics

  • netstat -su : for UDP statistics

Recent Blogs

Loading ...

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook