zoukankan      html  css  js  c++  java
  • 有用的shell命令

    1. netstat
      netstat - Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
      参见参数:

      -a (all)显示所有选项,默认不显示LISTEN相关
      -t (tcp)仅显示tcp相关选项
      -u (udp)仅显示udp相关选项
      -n 拒绝显示别名,能显示数字的全部转化成数字。
      -l 仅列出有在 Listen (监听) 的服務状态

      -p 显示建立相关链接的程序名
      -r 显示路由信息,路由表
      -e 显示扩展信息,例如uid等
      -s 按各个协议进行统计
      -c 每隔一个固定时间,执行该netstat命令。

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

      netstat -anp      //列出所有的端口(包括监听和未监听的),不显示别名而显示数字,显示建立相关链接的程序名及PID
      以上命令结合grep :80   可以用来查找正在使用80端口的程序。

      具体参考:Linux netstat命令详解
    2. lsof
      lsof - list open files
      在linux环境下,任何事物都以文件的形式存在,通过文件不仅仅可以访问常规数据,还可以访问网络连接和硬件。所以如传输控制协议 (TCP) 和用户数据报协议 (UDP) 套接字等,系统在后台都为该应用程序分配了一个文件描述符,无论这个文件的本质如何,该文件描述符为应用程序与基础操作系统之间的交互提供了通用接口。因为应用程序打开文件的描述符列表提供了大量关于这个应用程序本身的信息,因此通过lsof工具能够查看这个列表对系统监测以及排错将是很有帮助的。
      具体参考: linux lsof详解
    3. curl
      DESCRIPTION
             curl  is  a tool to transfer data from or to a server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP,
             LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP). The command is designed to work without user interaction.

             curl offers a busload of useful tricks like proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume, Met-
             alink, and more. As you will see below, the number of features will make your head spin!

             curl is powered by libcurl for all transfer-related features. See libcurl(3) for details.
      SYNOPSIS
             curl [options] [URL...]

      有用的选项:
      1. --head 或者 -I     只获取http中的首部信息。对应http中的HEAD方法
      2. --verbose 或者 -v  显示整个操作过程中的详细信息。多用于debug
    4. ?

    推荐:

    linux命令查询网站 http://man.linuxde.net/   ,(内容、用例非常详细)

  • 相关阅读:
    axis2学习笔记
    一个奇怪的数组越界报错
    zk实现分布式锁
    springBoot配置双数据源
    oracle查询
    maven项目打包
    linux修改yum源为阿里云
    kafka入门
    大话设计模式读书笔记(中介者模式)
    大话设计模式读书笔记(职责链模式)
  • 原文地址:https://www.cnblogs.com/jade640/p/6776382.html
Copyright © 2011-2022 走看看