zoukankan      html  css  js  c++  java
  • Linux查看硬件配置命令

     

    一、查看磁盘空间

    1、使用“df -k”命令,以KB为单位显示磁盘使用量和占用率。

    
    
    1. [root@master ~]# df -k
    2. Filesystem                    1K-blocks     Used Available Use% Mounted on
    3. /dev/mapper/vg_hadoop-lv_root  57294320 22785284  31605460  42% /
    4. tmpfs                           4023328       76   4023252   1% /dev/shm
    5. /dev/sda1                        495844    40011    430233   9% /boot

    2、使用“df -m”命令,以M为单位显示磁盘使用量和占用率。

    
    
    1. [root@master ~]# df -m
    2. Filesystem                    1M-blocks  Used Available Use% Mounted on
    3. /dev/mapper/vg_hadoop-lv_root     55952 22252     30865  42% /
    4. tmpfs                              3930     1      3929   1% /dev/shm
    5. /dev/sda1                           485    40       421   9% /boot

    3、使用“df -h”命令,以G为单位显示磁盘使用量和占用率。

    
    
    1. [root@master ~]# df -h
    2. Filesystem                     Size  Used Avail Use% Mounted on
    3. /dev/mapper/vg_hadoop-lv_root   55G   22G   31G  42% /
    4. tmpfs                          3.9G   76K  3.9G   1% /dev/shm
    5. /dev/sda1                      485M   40M  421M   9% /boot

    4、使用“df --help”命令,查看更多df命令的使用方法。

    
    
    1. [root@master ~]# df --help
    2. 用法:df [选项]... [文件]...
    3. 显示每个文件所在的文件系统的信息,默认是显示所有文件系统。
    4.  
    5. 长选项必须使用的参数对于短选项时也是必需使用的。
    6.   -a, --all             include dummy file systems
    7.   -B, --block-size=SIZE  use SIZE-byte blocks
    8.       --direct          show statistics for a file instead of mount point
    9.       --total           produce a grand total
    10.   -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
    11.   -H, --si              likewise, but use powers of 1000 not 1024
    12.   -i, --inodes 显示inode 信息而非块使用量
    13.   -k 即--block-size=1K
    14.   -l, --local只显示本机的文件系统
    15.       --no-sync 取得使用量数据前不进行同步动作(默认)
    16.   -P, --portability 使用POSIX 兼容的输出格式
    17.       --sync 取得使用量数据前先进行同步动作
    18.   -t, --type=类型只显示指定文件系统为指定类型的信息
    19.   -T, --print-type 显示文件系统类型
    20.   -x, --exclude-type=类型只显示文件系统不是指定类型信息
    21.   -v (忽略)
    22.       --help 显示此帮助信息并退出
    23.       --version 显示版本信息并退出
    24.  
    25. 所显示的数值是来自 --block-sizeDF_BLOCK_SIZEBLOCK_SIZE 
    26.  BLOCKSIZE 环境变量中第一个可用的 SIZE 单位。
    27. 否则,默认单位是 1024 字节(或是 512,若设定 POSIXLY_CORRECT 的话)。
    28.  
    29. SIZE 可以是一个可选的整数,后面跟着以下单位中的一个:
    30. KB 10001024MB 1000*10001024*1024,还有 GTPEZY
    31.  
    32. 请向bug-coreutils@gnu.org 报告df 的错误
    33. GNU coreutils 项目主页:<http://www.gnu.org/software/coreutils/>
    34. GNU 软件一般性帮助:<http://www.gnu.org/gethelp/>
    35. 请向<http://translationproject.org/team/zh_CN.html> 报告df 的翻译错误
    36. 要获取完整文档,请运行:info coreutils 'df invocation'

    二、查看内存 free -m

    
    
    1. [root@master batch]# free -m
    2.              total       used       free     shared    buffers     cached
    3. Mem:          7858       2241       5616          0         37       1005
    4. -/+ buffers/cache:       1198       6659
    5. Swap:         2047          0       2047

    下面是对这些数值的解释:
    total:总计物理内存的大小。
    used:已使用多大。
    free:可用有多少。

    三、查看CPU核数

    
    
    1. # 总核数 = 物理CPU个数 X 每颗物理CPU的核数 
    2. # 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数
    3. # 查看物理CPU个数
    4. cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
    5. # 查看每个物理CPU中core的个数(即核数)
    6. cat /proc/cpuinfo| grep "cpu cores"| uniq
    7. # 查看逻辑CPU的个数
    8. cat /proc/cpuinfo| grep "processor"| wc -l

     

     

    
    
    1. [root@oushus1 ~]# cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l
    2. 2
    3. [root@oushus1 ~]# cat /proc/cpuinfo| grep "cpu cores"| uniq 
    4. cpu cores : 10
    5. [root@oushus1 ~]# cat /proc/cpuinfo| grep "processor"| wc -l
    6. 40

    总核数 = 2 * 10 = 20(核)
    总逻辑CPU数  = 40 (个)

     

  • 相关阅读:
    PAT 乙级真题 1013.组个最小数
    PAT 乙级真题 1012.D进制的A+B
    PAT 乙级真题 1011.个位数统计
    PAT 乙级真题 1010.月饼
    PAT 乙级真题 1009.1019.数字黑洞
    PAT 乙级真题 1008.锤子剪刀布
    PAT 乙级真题 1007.A除以B
    PAT 乙级真题 1006.1016.部分A+B
    C++自定义sort函数
    VS2017如何使用scanf函数
  • 原文地址:https://www.cnblogs.com/yangcx666/p/8723862.html
Copyright © 2011-2022 走看看