zoukankan      html  css  js  c++  java
  • 实用Linux命令

    lsof -i:6379

    查看某个端口的程序有没有起起来。

    netstat -tnlp

    可以查看监听的端口,其中l是listening, p是显示program, n是显示ip而不是name, t看起来是只查看tcp的内容。

    每5秒查看内存使用或者cpu使用:

    $ vmstat 5
    procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
     r  b   swpd   free   buff  cache   si   so    bi    bo   in    cs us sy id wa
     3  0      0 123047944 337712 6273224    0    0     0     1    0     0  0  0 100  0
     0  0      0 123085800 337712 6273252    0    0     0    42 41991  6856  0  1 99  0
    ^C
    
    $ mpstat 5
    Linux 2.6.32_1-18-0-0 (gzns-ecom-baiduhui-201605-m42n04.gzns.baidu.com)         10/09/2016      _x86_64_        (40 CPU)
    
    12:03:14 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
    12:03:19 AM  all    0.03    0.04    0.09    0.03    0.00    0.00    0.00    0.00   99.82
    12:03:24 AM  all    0.04    0.10    0.33    0.04    0.00    0.00    0.00    0.00   99.50

    1、linux启动过程
    开启电源 –> BIOS开机自检 –> 引导程序lilo或grub –> 内核的引导(kernel boot)–> 执行init(rc.sysinit、rc)–> mingetty(建立终端) –> shell

    2、网卡绑定多IP

    ifconfig eth0:1 192.168.1.99 netmask 255.255.255.0

    3、设置DNS、网关
    echo “nameserver 202.16.53.68″ >> /etc/resolv.conf
    route add default gw 192.168.1.1

    10、删除所有空目录
    find /data -type d -empty -exec rm -rf {} ;

    11、linux下批量删除空文件(大小等于0的文件)的方法
    find /data -type f -size 0c -exec rm -rf {} ;
    find /data -type f -size 0c|xargs rm –f

    12、删除五天前的文件
    find /data -mtime +5 -type f -exec rm -rf {} ;

    13、删除两个文件重复的部份,打印其它
    cat 1.txt 3.txt |sort |uniq

    16、查看系统版本
    lsb_release -a

    注:我一般用 cat /etc/issue

    [验证,好用]

    33、如何查看目标主机192.168.0.1开放那些端口
    nmap -PS 192.168.0.1

    没搞清楚 -PS的用处,直接 nmap 192.168.0.1 出来的结果貌似是一样的

  • 相关阅读:
    设计模式之——工厂模式
    设计模式之——单例模式
    jQuery 全选 正反选
    将本地jar包添加到maven中
    配置项目启动的时候就加载 servlet
    Cannot call sendError() after the response has been committed(filter问题)
    mybatis pagehelper实现分页
    防止表单重复提交
    java.lang.Exception: No runnable methods 解决方案
    js 倒计时跳转页面
  • 原文地址:https://www.cnblogs.com/charlesblc/p/5940506.html
Copyright © 2011-2022 走看看