Use telnet command

The syntax is:
telnet {host} {port}
telnet www.cyberciti.biz 80
telnet 192.168.2.254 80

Sample outputs:

Trying 192.168.2.254...
Connected to router.
Escape character is '^]'.
^]
telnet> q
Connection closed.

To close your session, press Ctrl+]+q.

Use nc command

The syntax is:
nc -vz {host} {port}
nc -vz 192.168.2.254 80
nc -vz www.cyberciti.biz 443

Sample outputs:

found 0 associations
found 1 connections:
1: flags=82<connected,preferred>
outif utun1
src 10.8.0.2 port 54997
dst 104.20.187.5 port 443
rank info not available
TCP aux info available

Connection to www.cyberciti.biz port 443 [tcp/https] succeeded!

Use nmap command

The syntax is:
nmap -PNp {port} {host}
nmap -p {port} {host}
nmap -p 22 www.cyberciti.biz
nmap -p 443 192.168.2.254

Sample outputs:

Starting Nmap 7.40 ( https://nmap.org ) at 2017-05-24 01:00 IST
Nmap scan report for router (192.168.2.254)
Host is up (0.00034s latency).
PORT STATE SERVICE
443/tcp open https

Nmap done: 1 IP address (1 host up) scanned in 0.04 seconds

See “Top 32 Nmap Command Examples For Sys/Network Admins” for more info.

Use bash shell

The syntax is as follows:

## check for tcp port ##
## need bash shell ##
(echo >/dev/tcp/{host}/{port}) &>/dev/null && echo "open" || echo "close"
(echo >/dev/udp/{host}/{port}) &>/dev/null && echo "open" || echo "close"
(echo >/dev/tcp/www.cyberciti.biz/22) &>/dev/null && echo "Open 22" || echo "Close 22"
(echo >/dev/tcp/www.cyberciti.biz/443) &>/dev/null && echo "Open 443" || echo "Close 443"

Sample outputs:

Close 22
Open 443

Use nping command

Nping is an open-source tool for network packet generation, response analysis and response time measurement. Nping allows users to generate network packets of a wide range of protocols, letting them tunevirtually any field of the protocol headers. While Nping can be used as a simple ping utility to detect active hosts, it can also be used as a raw packet generator. The syntax is:
sudo nping --tcp -p {port} {host}
sudo nping --tcp -p 443 www.cyberciti.biz

Sample outputs:

Fig.01: nping just pinged www.cyberciti.biz host at port 443

How to ping and test for a specific port from Linux or Unix command line的更多相关文章

  1. Linux和Windows下ping命令详解(转:http://linux.chinaitlab.com/command/829332.html)

    一.Linux下的ping参数 用途 发送一个回送信号请求给网络主机. 语法 ping [ -d] [ -D ] [ -n ] [ -q ] [ -r] [ -v] [ \ -R ] [ -a add ...

  2. DOS cmd - how to ping a remote host with specified port

    You can use ping to test whether you can connect to a remote host: ping baidu.com ping 125.6.45.88 ( ...

  3. 系统盘的消耗 谨慎的日志存储到系统盘+日志级别!! 569 error_log = /usr/local/php7/logs/php-error.log 26 error_log = /usr/local/php7/logs/fpm_error_log

    案例: 系统盘一夜之间骤增近20G nginx + php-fpm cat  /usr/local/nginx/conf/nginx.conf 查看对请求的处理 4个配置文件 /usr/local/n ...

  4. sublime text 3插件

    Package Control Messages Emmet emmet插件 Thank you for installing Emmet -- a toolkit that can greatly ...

  5. <转>boost 1.53 and STLPort build binary for windows

      1.编译STLPort:    1.1 .开始菜单运行vs2008的命令行工具    1.2.进入E:\00.CODE.SDK\STLport-5.2.1\    1.2.运行configure ...

  6. Watch out for these 10 common pitfalls of experienced Java developers & architects--转

    原文地址:http://zeroturnaround.com/rebellabs/watch-out-for-these-10-common-pitfalls-of-experienced-java- ...

  7. The Daligner Overlap Library

    /************************************************************************************\ * * * Copyrig ...

  8. bedtools 每天都会用到的工具

    详细的使用说明:http://bedtools.readthedocs.org/en/latest/ Collectively, the bedtools utilities are a swiss- ...

  9. 计算机视觉code与软件

    Research Code A rational methodology for lossy compression - REWIC is a software-based implementatio ...

随机推荐

  1. java 在数组{1,2,3,4,6,7,8,9,10}中插入一个数5,使其插入完成后仍然有序

    1.需要实现的效果 2.代码实现 import java.util.Scanner; /* * 11.在数组{1,2,3,4,6,7,9,8,10}中插入一个数5, * 使其插入完成后仍然有序,运行结 ...

  2. iOS逆向系列-动态调试

    Xcode调试App原理 Mac安装了Xcode Xcode的安装包中包含了debugserver 可执行类型的Mach-O文件,iPhone第一次连接Xcode调试会将Xcode中的debugser ...

  3. RabbitMQ探索之路(二):RabbitMQ在Linux下的安装

    引言 消息队列现在在互联网项目中应用的还是非常多的,在接下来的博客中小编会深入的了解MQ的实现过程,在此博客中将介绍如何在centos7下面安装MQ以及遇到的问题. 第一步:安装Erlang 因为ra ...

  4. ReentrantLock中的公平锁与非公平锁

    简介 ReentrantLock是一种可重入锁,可以等同于synchronized的使用,但是比synchronized更加的强大.灵活. 一个可重入的排他锁,它具有与使用 synchronized ...

  5. yum -y install python-devel

    yum -y install python-devel的时候报错如图: Could not retrieve mirrorlist http://mirrorlist.centos.org/?rele ...

  6. leetcood学习笔记-45-跳跃游戏二

    题目描述: 第一次提交;超时 class Solution: def jump(self, nums: List[int]) -> int: l = [] for i in range(len( ...

  7. 两个对象值相同 (x.equals(y) == true),但却可有不同的 hash code,这句话对不对?

    不对,如果两个对象x和y满足x.equals(y) == true,它们的哈希码(hash code)应当相同.Java对于eqauls方法和hashCode方法是这样规定的: (1)如果两个对象相同 ...

  8. linux中对EINTR错误的处理

    https://www.cnblogs.com/flyfish10000/articles/2576885.html EINTR错误的产生:当阻塞于某个慢系统调用的一个进程捕获某个信号且相应信号处理函 ...

  9. Could not open file ..\obj\sys.o: No such file or directory解决办法

    一.你的keil的安装路径以及系统用户名是否带中文字符以及一些特殊字符.二.环境变量的值存在中文或者特殊字符了,解决方法如下: 1.在C盘建立一个新的文件夹,命名为英文,如qcl2.右击"此 ...

  10. System.Web.Mvc.JavaScriptResult.cs

    ylbtech-System.Web.Mvc.JavaScriptResult.cs 1.程序集 System.Web.Mvc, Version=5.2.3.0, Culture=neutral, P ...