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. MFC文档视图结构学习笔记

    文档/视图概述 为了统一和简化数据处理方法,Microsoft公司在MFC中提出了文档/视图结构的概念,其产品Word就是典型的文档/视图结构应用程序 MFC通过其文档类和视图类提供了大量有关数据处理 ...

  2. angular2 组件内容嵌入(ng-content)

    一.简介 内容嵌入是组件的一个高级功能特性,使用组件的内容嵌入特性能很好地扩充组件的功能,方便代码的复用. 二.用法 如上,在模版中使用了<ng-content>标签,这个标签就是用来渲染 ...

  3. badboy录制添加检查点

    前提条件 安装badboy 下载地址:http://www.badboy.com.au/download/index 录制脚本 1.例:录制www.baidu.com 2.打开badboy工具输入录制 ...

  4. mysql中geometry类型的简单使用

    mysql中geometry类型的简单使用 编写本文的目的: 让和两天前的我一样的初学者,能够更快的使用geometry类型存储空间点数据    也是为了自己加深印象,更熟练的使用geometry类型 ...

  5. JS while 循环

    while循环:只要条件成立,就重复不断的执行循环体代码 while(条件判断) { 如果条件为true,则执行循环体代码 } while循环结构说明:   在循环开始前,必须要对变量初始化(声明变量 ...

  6. 集中式日志分析平台 - ELK Stack - 安全解决方案 X-Pack

    大数据之心 关注  0.6 2017.02.22 15:36* 字数 2158 阅读 16457评论 7喜欢 9 简介 X-Pack 已经作为 Elastic 公司单独的产品线,前身是 Shield, ...

  7. 三种方法实现MNIST 手写数字识别

    MNIST数据集下载: import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist ...

  8. python 中的 用chr()数值转化为字符串,字符转化为数值ord(s)函数

    1.1 python字符串定义 #!/usr/bin/python # -*- coding: utf8 -*- # 定义一个字符串 s1 = 'this is long String that sp ...

  9. Windows与Linux获取进程集合的方法

    Windows: List<String> tasklist=new ArrayList<String>(); try { Process process = Runtime. ...

  10. Spring Boot 实现定时任务的 4 种方式

    作者:Wan QingHua wanqhblog.top/2018/02/01/SpringBootTaskSchedule/ 定时任务实现的几种方式: Timer:这是java自带的java.uti ...