Linux(ubuntu)基本信息查看

  • 查看版本
    • cat /proc/version
    root@husiwei:~# cat /proc/version
    Linux version 4.4.0-85-generic (buildd@lcy01-30) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #108-Ubuntu SMP Mon Jul 3 17:24:35 UTC 2017
    
    • uname -a
    root@husiwei:~# uname -a
    Linux husiwei 4.4.0-85-generic #108-Ubuntu SMP Mon Jul 3 17:24:35 UTC 2017 i686 i686 i686 GNU/Linux
    

    显示i686说明是32位操作系统,显示 x86_64说明是64位操作系统。

    • cat /etc/issue
    root@husiwei:~# cat /etc/issue
    Ubuntu 16.04.2 LTS \n \l
    
  • 查看32位还是64位
    • getconf LONG_BIT
    root@husiwei:~# getconf LONG_BIT
    32
    
  • 查看内存
    • grep MemTotal /proc/meminfo
    root@husiwei:~# grep MemTotal /proc/meminfo
    MemTotal:        4138848 kB
    
    • free -m |grep "Mem" | awk '{print $2}'
    root@husiwei:~# free -m |grep "Mem" | awk '{print $2}'
    4041
    
  • 查看cpu数量以及类型 grep "model name" /proc/cpuinfo
    root@husiwei:~# grep "model name"   /proc/cpuinfo
    model name    : Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
    model name    : Intel(R) Xeon(R) Platinum 8163 CPU @ 2.50GHz
    
  • 查看硬盘 df -h
    root@husiwei:~# df -h
    Filesystem      Size  Used Avail Use% Mounted on
    udev            2.0G     0  2.0G   0% /dev
    tmpfs           405M  2.7M  402M   1% /run
    /dev/vda1        40G  2.6G   35G   7% /
    tmpfs           2.0G     0  2.0G   0% /dev/shm
    tmpfs           5.0M     0  5.0M   0% /run/lock
    tmpfs           2.0G     0  2.0G   0% /sys/fs/cgroup
    tmpfs           405M     0  405M   0% /run/user/0
    
  • 查看系统状态 top
    root@husiwei:~# top
    top - 09:02:06 up 3 days,  9:27,  1 user,  load average: 0.00, 0.00, 0.00
    Tasks: 105 total,   1 running, 103 sleeping,   1 stopped,   0 zombie
    %Cpu(s):  0.0 us,  0.2 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
    KiB Mem :  4138848 total,  3319988 free,   238976 used,   579884 buff/cache
    KiB Swap:        0 total,        0 free,        0 used.  3483184 avail Mem 
    
    PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                            
    728 ntp       20   0   16056   4248   3872 S   0.3  0.1   0:11.46 ntpd                                                                               
    791 root      20   0  191628  17220  12948 S   0.3  0.4   8:24.80 xxxxx           ...                                                               
    
  • 查看网关 cat /etc/resolv.conf
    root@husiwei:~# cat /etc/resolv.conf
    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    options timeout:1 attempts:1 rotate single-request-reopen
    nameserver 100.100.12.137
    nameserver 100.100.12.128
    
  • 查看时区 date -R
    root@husiwei:~# date -R
    Sat, 16 Sep 2017 09:08:06 +0800
    

    +0800 中国北京时间

One thought on “Linux(ubuntu)基本信息查看

发表评论

电子邮件地址不会被公开。 必填项已用*标注