Linux常用命令(工具)

1、ps 显示进程相关信息

用法了解: 

Basic options:    基本操作
 -A, -e               all processes  所有进程
 -a                   all with tty, except session leaders 所有的终端,除了会话首进程
  a                   all with tty, including other users 所有的终端,包括其他用户
 -d                   all except session leaders 除了session leader 的所有进程
 -N, --deselect       negate selection  
  r                   only running processes  只有运行着的进程
  T                   all processes on this terminal 这个终端的所有进程
  x                   processes without controlling ttys 不受终端控制的进程

Selection by list: 列表选项,即控制ps打印出来的列信息。

-C <command>         command name   命令名称

-G, --Group <GID>    real group id or name  实际组id或组名称

-p, p, --pid <PID>   process id 进程id

Output formats: 输出格式

-f                   full-format, including command lines 所有格式包括命令行本身

ps命令常常配合“grep ”

列如我想知道redis服务有没有正常启动

ps -ef|grep redis 

2 、kill pid

 kll -9 pid   强制杀死进程

kill -2 pid 等进程清除资源再结束进程。

需要结束后台程序的时候可以配合 ngrep  \  pidof等命令

kill -9 `ngrep 程序名`

kill -9 `pidof 程序名`

3、telnet 连接试探

 网络通信试探

telnet 目标ip 目标端口


4、netstat 查看网卡状态

 -r, --route              display routing table
        -i, --interfaces         display interface table
        -g, --groups             display multicast group memberships
        -s, --statistics         display networking statistics (like SNMP)
        -M, --masquerade         display masqueraded connections


        -v, --verbose            be verbose
        -W, --wide               don't truncate IP addresses
        -n, --numeric            don't resolve names
        --numeric-hosts          don't resolve host names
        --numeric-ports          don't resolve port names
        --numeric-users          don't resolve user names
        -N, --symbolic           resolve hardware names
        -e, --extend             display other/more information
        -p, --programs           display PID/Program name for sockets
        -c, --continuous         continuous listing


        -l, --listening          display listening server sockets
        -a, --all, --listening   display all sockets (default: connected) 所有sock链接
        -o, --timers             display timers
        -F, --fib                display Forwarding Information Base (default)

        -C, --cache              display routing cache instead of FIB


<Socket>={-t|--tcp} {-u|--udp} {-w|--raw} {-x|--unix} --ax25 --ipx --netrom 

列如我要查看redis程序监听的是什么端口

netstat -antp |grep redis


........................................................待更新...................................................................



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值