Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the nc command to check if the Linux system remote port is open

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to use the nc command to check whether the Linux system remote port is open, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

A port is a logical entity that communicates with an application or process on the Linux operating system. Before using it, it is useful to know which ports are open and running services on the target machine.

We can easily list the open ports in Linux on the local machine using netstat or several other Linux commands such as NMAP.

In this guide, we will show you how to use a simple netcat (nc) command to determine whether a port on a remote host is accessible / open.

Netcat (or nc for short) is a powerful and easy-to-use program that can be used for anything related to TCP, UDP, or UNIX domain sockets in Linux.

# yum install nc [in CentOS/RHEL] # dnf install nc [in Fedora 22 +] $sudo apt-get install netcat [in Debian/Ubuntu]

We can use it: open TCP connections, listen on any TCP and UDP ports, send UDP packets, and perform port scans on IPv4 and IPv6.

With netcat, you can check the range of single or multiple open ports, as shown below. The following command will help us see if port 22 is open on host 192.168.56.10:

$nc-zv 192.168.1.15 22

In the above command, these flags are:

-z-set nc to just scan and listen for daemons and actually send no data to them.

-v-enable verbose mode

The following command checks whether ports 80, 22, and 21 are open on the remote host 192.168.5.10 (we can also use the hostname):

Nc-zv 192.168.56.10 80 22 21

You can also specify the range of port scans:

$nc-zv 192.168.56.10 20-80 is all the contents of the article "how to use the nc command to check whether the remote port of a Linux system is open". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report