
- Kali Linux Tutorial
- Kali Linux - Home
- Installation & Configuration
- Information Gathering Tools
- Vulnerability Analyses Tools
- Kali Linux - Wireless Attacks
- Website Penetration Testing
- Kali Linux - Exploitation Tools
- Kali Linux - Forensics Tools
- Kali Linux - Social Engineering
- Kali Linux - Stressing Tools
- Kali Linux - Sniffing & Spoofing
- Kali Linux - Password Cracking Tools
- Kali Linux - Maintaining Access
- Kali Linux - Reverse Engineering
- Kali Linux - Reporting Tools
- Kali Linux Useful Resources
- Kali Linux - Quick Guide
- Kali Linux - Useful Resources
- Kali Linux - Discussion
How to Watch TCP and UDP Ports in Real-time in Linux?
In a computer network, the network service runs a software in each of the computers that are part of the network. In Linux System this network software uses a protocol called TCP or UDP along with port number. TCP is known as transmission control protocol and UDP is known as user datagram protocol. In this article we will see how to watch the ports are sockets which are running on this protocols on a real time basis.
List of Open Ports
As a first step we look for the open ports that are available in the system. Bye open we mean the ports are available for listening which also means accepting request from other systems. The below command is used to list the open ports.
$ sudo netstat –tulpn The meaning of various flags is as below. t - enable listing of TCP ports. u - enables listing of UDP ports. l - print only the open sockets. p - print the program name n – print the port number
Running the above code gives us the following result −
Active Internet connections (only Proto Recv-Q Send-Q Local Address Foreign Address State PM/Program name tcp 127.0.1.1:53 0.0.0.0:* LISTEN 966/dnsmasq tcp 0.0.0.0:22 0.0.0.0:* LISTEN 941/sshd tcp 127.0.0.1:631 0.0.0.0:* LISTEN 11450/cupsd tcp6 :::22 LISTEN 941/sshd tcp6 ::1:631 LISTEN 11450/cupsd udp 0.0.0.0:50228 0.0.0.0:* 792/avahi-daemon: r udp 0.0.0.0:5353 0.0.0.0:* 792/avahi-daemon: r udp 127.0.1.1:53 0.0.0.0:* 966/dnsmasq udp 0.0.0.0:68 0.0.0.0:* 949/dhclient udp 0.0.0.0:51324 0.0.0.0:* 966/dnsmasq udp 0.0.0.0:631 0.0.0.0:* 11452/cups-browsed udp6 :::5353 792/avahi-daemon: r ud.6 :::50929 792 avahi-daemon: r
Open Ports in Real-Time
But in case you want to watch the ports in real time, so that you can monitor the number of bytes, sent and received, then we have to add the watch flag.
$ sudo watch netstat –tulpn
Running the above code gives us the following result −
Active Internet connections (only servers) Proto Recv-Q Send-QLocal Address Foreign Address State PID/Program name tcp 127.0.1.1:53 0.0.0.0:* LISTEN 966/dnsmasq tcp 0.0.0.0:22 0.0.0.0:* LISTEN 941/sshd tcp 127.0.0.1:631 0.0.0.0:* LISTEN 11450/cupsd tcp6 63 :::22 ••LISTEN 941/sshd tcp6 ::1:631 LISTEN 11450/cupsd udp 0.0.0.0:50228 0.0.0.0:* 792/avahi-daemon: r udp 0.0.0.0:5353 0.0.0.0:* 792/avahi-daemon: r udp 127.0.1.1:53 0.0.0.0:* 966/dnsmasq udp 0.0.0.0:68 0.0.0.0:* 949/dhclient udp 0.0.0.0:51324 0.0.0.0:* 966/dnsmasq udp 0.0.0.0:631 0.0.0.0:* 11452/cups-browsed udp6 :::5353 • • • 792/avahi-daemon: r udp6 :::50929 792/avahi-daenon: r
- Related Articles
- TCP and UDP in Transport Layer
- Difference between TCP and UDP
- How Applications Coexist over TCP and UDP?
- Distinguish between the TCP and UDP.
- What are the TCP/IP Ports and its applications?
- Linux watch Command
- Using TCP/IP ports for accessing SAP HANA database
- How to convert varchar “time” to real time in MySQL?
- Netdata – A Real-Time Performance Monitoring Tool for Linux Systems
- How to manage watch time on YouTube mobile App?
- Difference between Serial Ports and Parallel Ports
- How to monitor real time SQL execution statistics in Oracle?
- Freeing up a TCP/IP Port on Linux
- How to find and sort files based on modification date and time in linux
- How to detect human faces in real-time in OpenCV using C++?
