netstat -ntlp

查看端口使用情况!

netstat -ntlp | grep 80

查看具体的端口是否使用!

# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 2247/redis-server 1
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1365/rpcbind
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 32169/nginx
tcp 0 0 0.0.0.0:39922 0.0.0.0:* LISTEN 1383/rpc.statd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1670/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1509/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 2265/sendmail
tcp 0 0 :::53294 :::* LISTEN 1383/rpc.statd
tcp 0 0 :::111 :::* LISTEN 1365/rpcbind
tcp 0 0 :::22 :::* LISTEN 1670/sshd
tcp 0 0 ::1:631 :::* LISTEN 1509/cupsd
tcp 0 0 :::3306 :::* LISTEN 15856/mysqld

下面来看看所以然,

常见参数

-a (all)显示所有选项,默认不显示LISTEN相关

-t (tcp)仅显示tcp相关选项

-u (udp)仅显示udp相关选项

-n 拒绝显示别名,能显示数字的全部转化成数字。

-l 仅列出有在 Listen (监听) 的服務状态

-p 显示建立相关链接的程序名

-r 显示路由信息,路由表

-e 显示扩展信息,例如uid等

-s 按各个协议进行统计

-c 每隔一个固定时间,执行该netstat命令。

提示:LISTEN和LISTENING的状态只有用-a或者-l才能看到

由上面的参数可以看出,ntlp意思是只显示端口数字,tcp的,监听中的,相关程序名的数据。

Linux 实用指令之查看端口开启情况的更多相关文章

  1. 【linux杂记】Ubuntu查看端口使用情况

    转载地址: https://www.linuxidc.com/Linux/2016-01/127345.htm Ubuntu查看端口使用情况,使用netstat命令: 查看已经连接的服务端口(ESTA ...

  2. centos(linux) 下如何查看端口占用情况及杀死进程

    使用这个命令:netstat -nap [root@Jaosn sphinx]# netstat -nap Active Internet connections (servers and estab ...

  3. Linux和Windows中查看端口占用情况

    一.命令 netstat -lnt  或 netstat -tnlp 如: 二.较全 netstat -antulp 三.简单 ss -tanl  或 ss -tanlp 三.补充 Windows中使 ...

  4. 26. linux查看端口占用情况

    linux系统下,查看端口占用情况的命令:lsof -i[root@www ~]# lsof -i

  5. linux(8)Linux 查看端口占用情况

    前言 平常使用linux,我们经常需要查看哪个服务占用了哪个端口,接下来就为大家介绍了2种 Linux 查看端口占用情况可以使用 lsof 和 netstat 命令. 1. lsof -i:端口号 用 ...

  6. Centos6.9以下查看端口占用情况和开启端口命令

    Centos查看端口占用情况命令,比如查看80端口占用情况使用如下命令:   lsof -i tcp:80   列出所有端口   netstat -ntlp   1.开启端口(以80端口为例)     ...

  7. 【转】Linux 查看端口占用情况

    Linux 查看端口占用情况可以使用 lsof 和 netstat 命令. lsof lsof(list open files)是一个列出当前系统打开文件的工具. lsof 查看端口占用语法格式: l ...

  8. Centos查看端口占用情况和开启端口命令

    Centos查看端口占用情况命令,比如查看80端口占用情况使用如下命令: lsof -i tcp:80 列出所有端口 netstat -ntlp 1.开启端口(以80端口为例)方法一: /sbin/i ...

  9. Netstat -tln 命令是Linux查看端口使用情况

    Netstat -tln 命令是Linux查看端口使用情况

随机推荐

  1. [UVa OJ] Longest Common Subsequence

    This is the classic LCS problem. Since it only requires you to print the maximum length, the code ca ...

  2. Python设置默认编码为UTF-8

    1.在Python\Lib\site-packages目录下创建一个sitecustomize.py文件 源代码: import sys sys.setdefaultencoding('utf-8') ...

  3. Java Json API:Gson使用简单入门

    GSON是Google开发的Java API,用于转换Java对象和Json对象.本文讨论并提供了使用API的简单代码示例.更多关于GSON的API可以访问:http://sites.google.c ...

  4. emo前端

    1 点击按钮可以在form中添加input控件,以name给input编号,然后点击按钮ajax上传表单,在回调函数中弹框显示结果: <form id="newfriends" ...

  5. django模板复用 extends,block,include

    template复用 extends block include render 参考:https://code.ziqiangxuetang.com/django/django-template.ht ...

  6. [译]理解Windows消息循环

    出处:http://www.cnblogs.com/zxjay/archive/2009/06/27/1512372.html 理解消息循环和整个消息传送机制对Windows编程来说非常重要.如果对消 ...

  7. Flask(2)- 装饰器的坑及解决办法、flask中的路由/实例化配置/对象配置/蓝图/特殊装饰器(中间件、重定义错误页面)

    一.装饰器的坑以及解决方法 1.使用装饰器装饰两个视图函数,代码如下 from flask import Flask, redirect, render_template, request, sess ...

  8. EasySQLMAIL使用实践系列

    原文:http://blog.sina.com.cn/s/articlelist_5713986487_0_1.html 通过sql语句发送微信消息(转) 使用EasySQLMAIL的外部接口功能实现 ...

  9. Mac 启动和关闭rabbitmq

    1.安装 brew install rabbitmq 2.启动及关闭RabbitMQ服务 前台启动 sudo ./rabbitmq-server    或 sudo su/usr/local/Cell ...

  10. 使用jqueryUI和corethink实现的类似百度的搜索提示

    代码:http://download.csdn.net/detail/u012995856/9676845 效果: 目录: 这里是以corethink模块的形式,只需要安装上访问 index.php? ...