zoukankan      html  css  js  c++  java
  • Linux shell命令

    一、删除监听指定端口的进程:

    lsof -ti: 80 | xargs kill -9

    -t: 输出pid

    -i:查看指定端口占用情况

    二、查看可执行文件动态链接库相关信息 

    ldd <可执行文件名>       查看可执行文件链接了哪些  系统动态链接库
    nm <可执行文件名>       查看可执行文件里面有哪些符号
    strip <可执行文件名>      去除符号表可以给可执行文件瘦身
    如果我们想从可执行程序里面提取出来一点什么文本信息的话,还可以用strings命令
    strings <可执行文件名>

    三、环境变量

    env   查看所有环境变量

    echo  $PATH  或者 env |grep 'PATH' 或者  env |grep -i path 查看PATH变量

    export PATH="$PATH:$JAVA_HOME/bin"  修改环境变量 设置后需要执行source /etc/profile

    四、指定CPU

    taskset -cp 4 4389#4389号进程运行在4号CPU上

    五 Top命令

    top==》f 列出菜单 ==》j选择显示进程最后运行的cpu ==》enter

    #显示指定进程的top信息

    top -p$(pgrep redis|awk 'BEGIN{ORS=","}{print $0}' |sed 's/.$//')   

     六 清理cache

    1. Writing to this will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
    2. To free pagecache:
    3. * echo 1 > /proc/sys/vm/drop_caches
    4. To free dentries and inodes:
    5. * echo 2 > /proc/sys/vm/drop_caches
    6. To free pagecache, dentries and inodes:
    7. * echo 3 > /proc/sys/vm/drop_caches
    8. As this is a non-destructive operation, and dirty objects are notfreeable, the user should run "sync" first in order to make sure allcached objects are freed.
    9. This tunable was added in 2.6.16.

     七 查看进程连接状态

    lsof -i|grep process_name

    例如查看ssh

     八 查看iptables

    上述信息表示未开启iptables。

     九、设置网卡IP和路由

     

  • 相关阅读:
    Win8 iis 环境搭建
    Windows phone 8 触发器使用小结
    Windows Phone 页面之间参数传递方法
    日期SQL 脚本
    net 内存泄露和内存溢出
    Emacs的一些事情(与Vi的争议及使用)
    matlab与示波器连接及电脑连接
    msp430学习笔记-TA
    28个Unix/Linux的命令行神器
    linux在线中文手册
  • 原文地址:https://www.cnblogs.com/ibyte/p/5802580.html
Copyright © 2011-2022 走看看