美文网首页Linux
Linux实用命令

Linux实用命令

作者: 沧海一粟_czs | 来源:发表于2018-12-21 17:11 被阅读0次

    修改主机名

    hostnamectl set-hostname new_host_name
    执行完重启生效

    查看服务进程

    ps -aux | grep service_name
    ps -ef | grep service_name
    service service_name status
    service --status-all | grep service_name
    查看所有服务
    service --status-all

    查看端口占用

    netstat -anp | grep 8080

    查看内存

    查看所有项内存
    cat /proc/meminfo
    atop
    top
    nmon
    vmstat
    ps aux --sort -rss
    free -h
    free -g
    free -m
    free -k
    查看某个进程的内存占用
    cat /proc/<pid>/status
    cat /proc/<pid>/statm
    memstat -p pid

    查看CPU

    查看物理CPU个数:cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l

    查看每个CPU核数:cat /proc/cpuinfo| grep "cpu cores"| uniq

    查看逻辑CPU个数:cat /proc/cpuinfo| grep "processor"| wc -l

    查看CPU信息型号:cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c

    相关文章

      网友评论

        本文标题:Linux实用命令

        本文链接:https://www.haomeiwen.com/subject/jnlvkqtx.html