美文网首页
Linux Practice

Linux Practice

作者: 南北东西总相随 | 来源:发表于2017-09-28 16:58 被阅读0次

    Linux Practice

    https://www.kernel.org/

    http://www.gnu.org/

    Coreutils - GNU core utilities

    https://www.gnu.org/software/coreutils/

    System context

    uname: Print system information

    Print all information

    $ uname -a
    Linux debian-512mb-sgp1-01 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u2 (2017-06-26) x86_64 GNU/Linux
    

    Print the kernel release

    $ uname -r
    3.16.0-4-amd64
    

    Print the kernel version

    $ uname -v
    #1 SMP Debian 3.16.43-2+deb8u2 (2017-06-26)
    

    hostname: Print or set system name

    Get the hostname

    $ hostname
    mysql.example.com
    $ cat /etc/hostname
    mysql.example.com
    

    Set the hostname. Note, that this is effective only until the next reboot. Edit /etc/hostname for permanent change.

    $ hostname redis.example.com
    $ hostname
    redis.example.com
    $ cat /etc/hostname
    mysql.example.com
    
    $ echo redis.example.com > /etc/hostname
    $ reboot ## REBOOT!!! ##
    $ hostname
    redis.example.com
    

    uptime: Print system uptime and load

    uptime prints the current time, the system's uptime, the number of logged-in users and the current load average.

    $ uptime
     03:48:42 up 28 min,  2 users,  load average: 0.00, 0.00, 0.00
    
    # 读取系统平均负载。后面的分数,分母表示系统进程总数,分子表示正在运行的进程数,最后一个数字表示最近运行的进程 ID。
    $ cat /proc/loadavg
    0.00 0.00 0.00 1/74 1248
    
    # 读取 CPU 核心数目
    $ grep 'model name' /proc/cpuinfo | wc -l
    1
    

    相关文章

      网友评论

          本文标题:Linux Practice

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