自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

干貨:Linux查詢 OS、CPU、內(nèi)存、硬盤信息

系統(tǒng) Linux
當(dāng)我們接手了一臺(tái)或者幾臺(tái)服務(wù)器的時(shí)候,首先我們有必要對(duì)服務(wù)器的基本配置有所認(rèn)識(shí),這樣才可以對(duì)癥下藥,對(duì)以后的軟件部署,系統(tǒng)運(yùn)維會(huì)有事半功倍的效果。

 一.前言

當(dāng)我們接手了一臺(tái)或者幾臺(tái)服務(wù)器的時(shí)候,首先我們有必要對(duì)服務(wù)器的基本配置有所認(rèn)識(shí),這樣才可以對(duì)癥下藥,對(duì)以后的軟件部署,系統(tǒng)運(yùn)維會(huì)有事半功倍的效果。

二.關(guān)于服務(wù)器基本配置

查詢服務(wù)器的基本配置一般查詢操作系統(tǒng),CPU,內(nèi)存,硬盤,下面進(jìn)行逐一講解。

2.1 操作系統(tǒng)基本配置查詢

查看操作系統(tǒng)版本 

  1. #cat /etc/redhat-release這個(gè)命令主要是查看紅帽發(fā)行的操作系統(tǒng)的版本號(hào)  
  2. [root@node5 ~]# cat /etc/redhat-release   
  3. CentOS Linux release 7.4.1708 (Core)   
  4. #cat /etc/issue這個(gè)命令適用于大多數(shù)linux發(fā)行版  
  5. [root@node5 ~]# cat /etc/issue  
  6. \S  
  7. Kernel \r on an \m 

查看操作系統(tǒng)內(nèi)核版本 

  1. [root@node5 ~]# uname -r  
  2. 3.10.0-693.el7.x86_64 

查看操作系統(tǒng)詳細(xì)信息 

  1. [root@node5 ~]# uname -a  
  2. Linux node5 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux  
  3. #從上面這段輸出可以看出,該服務(wù)器主機(jī)名是node5,linux內(nèi)核版本是3.10.0-693.el7.x86_64,CPU是x86架構(gòu)  
  4. #該命令可以查看更多信息  
  5. [root@node5 ~]# more /etc/*release   
  6. ::::::::::::::  
  7. /etc/centos-release  
  8. ::::::::::::::  
  9. CentOS Linux release 7.4.1708 (Core)   
  10. ::::::::::::::  
  11. /etc/os-release  
  12. ::::::::::::::  
  13. NAME="CentOS Linux"  
  14. VERSION="7 (Core)"  
  15. ID="centos"  
  16. ID_LIKE="rhel fedora"  
  17. VERSION_ID="7"  
  18. PRETTY_NAME="CentOS Linux 7 (Core)"  
  19. ANSI_COLOR="0;31"  
  20. CPE_NAME="cpe:/o:centos:centos:7"  
  21. HOME_URL="https://www.centos.org/"  
  22. BUG_REPORT_URL="https://bugs.centos.org/"  
  23. CENTOS_MANTISBT_PROJECT="CentOS-7"  
  24. CENTOS_MANTISBT_PROJECT_VERSION="7"  
  25. REDHAT_SUPPORT_PRODUCT="centos"  
  26. REDHAT_SUPPORT_PRODUCT_VERSION="7"  
  27. ::::::::::::::  
  28. /etc/redhat-release  
  29. ::::::::::::::  
  30. CentOS Linux release 7.4.1708 (Core)   
  31. ::::::::::::::  
  32. /etc/system-release  
  33. ::::::::::::::  
  34. CentOS Linux release 7.4.1708 (Core) 

2.2 CPU基本配置查詢

名詞解釋

名詞 含義
CPU物理個(gè)數(shù) 主板上實(shí)際插入的cpu數(shù)量
CPU核心數(shù) 單塊CPU上面能處理數(shù)據(jù)的芯片組的數(shù)量,如雙核、四核等 (cpu cores)
邏輯CPU數(shù)/線程數(shù) 一般情況下,邏輯cpu=物理CPU個(gè)數(shù)×每顆核數(shù),如果不相等的話,則表示服務(wù)器的CPU支持超線程技術(shù)

查看 CPU 物理個(gè)數(shù) 

  1. [root@node5 ~]# grep 'physical id' /proc/cpuinfo | sort -u | wc -l  

查看 CPU 核心數(shù)量 

  1. [root@node5 ~]# grep 'core id' /proc/cpuinfo | sort -u | wc -l  

查看 CPU 線程數(shù) 

  1. #邏輯cpu數(shù):一般情況下,邏輯cpu=物理CPU個(gè)數(shù)×每顆核數(shù),如果不相等的話,則表示服務(wù)器的CPU支持超線程技術(shù)(HT:簡(jiǎn)單來說,它可使處理#器中的1 顆內(nèi)核如2 顆內(nèi)核那樣在操作系統(tǒng)中發(fā)揮作用。這樣一來,操作系統(tǒng)可使用的執(zhí)行資源擴(kuò)大了一倍,大幅提高了系統(tǒng)的整體性能,此時(shí)邏#輯cpu=物理CPU個(gè)數(shù)×每顆核數(shù)x2) 
  2. [root@node5 ~]# cat /proc/cpuinfo| grep "processor"|wc -l  
  3.  
  4. [root@node5 ~]# grep 'processor' /proc/cpuinfo | sort -u | wc -l  

查看 CPU 型號(hào) 

  1. [root@node5 ~]# cat /proc/cpuinfo | grep name | sort | uniq  
  2. model name  : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz  
  3. [root@node5 ~]# dmidecode -s processor-version | uniq   #使用uniq進(jìn)行去重  
  4. Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz 

查看 CPU 的詳細(xì)信息 

  1. #CPU有幾個(gè)核,就會(huì)輸出幾個(gè)重復(fù)的信息  
  2. [root@node5 ~]# cat /proc/cpuinfo  
  3. processor  : 0  
  4. vendor_id  : GenuineIntel  
  5. cpu family  : 6  
  6. model    : 142  
  7. model name  : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz  
  8. stepping  : 10  
  9. microcode  : 0x96  
  10. cpu MHz    : 2000.921  
  11. cache size  : 8192 KB  
  12. physical id  : 0  
  13. siblings  : 4  
  14. core id    : 0  
  15. cpu cores  : 4  
  16. apicid    : 0  
  17. initial apicid  : 0  
  18. fpu    : yes  
  19. fpu_exception  : yes  
  20. cpuid level  : 22  
  21. wp    : yes  
  22. flags    : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec arat 
  23. bogomips  : 4002.00  
  24. clflush size  : 64  
  25. cache_alignment  : 64  
  26. address sizes  : 43 bits physical, 48 bits virtual  
  27. power management: 

查看CPU的詳細(xì)信息 

  1. [root@node5 ~]# lscpu  
  2. Architecture:          x86_64  
  3. CPU op-mode(s):        32-bit, 64-bit  
  4. Byte Order:            Little Endian  
  5. CPU(s):                4  
  6. On-line CPU(s) list:   0-3  
  7. Thread(s) per core:    1  
  8. Core(s) per socket:    4  
  9. Socket(s):             1  
  10. NUMA node(s):          1  
  11. Vendor ID:             GenuineIntel  
  12. CPU family:            6  
  13. Model:                 142  
  14. Model name:            Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz  
  15. Stepping:              10  
  16. CPU MHz:               2000.921  
  17. BogoMIPS:              4002.00  
  18. Virtualization:        VT-x  
  19. Hypervisor vendor:     VMware  
  20. Virtualization type:   full  
  21. L1d cache:             32K  
  22. L1i cache:             32K  
  23. L2 cache:              256K  
  24. L3 cache:              8192K  
  25. NUMA node0 CPU(s):     0-3  
  26. Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch tpr_shadow vnmi ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec arat 

CPU配置總結(jié)

通過以上的查詢,我們可以知道該服務(wù)器是1路4核的CPU ,CPU型號(hào)是Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz,該CPU沒有超線程。

2.3 內(nèi)存基本配置查詢

名詞解釋

名詞 含義
Mem 內(nèi)存的使用情況總覽表
Swap 虛擬內(nèi)存。即可以把數(shù)據(jù)存放在硬盤上的數(shù)據(jù),當(dāng)物理內(nèi)存不足時(shí),拿出部分硬盤空間當(dāng)SWAP分區(qū)(虛擬成內(nèi)存)使用,從而解決內(nèi)存容量不足的情況。SWAP意思是交換,顧名思義,當(dāng)某進(jìn)程向OS請(qǐng)求內(nèi)存發(fā)現(xiàn)不足時(shí),OS會(huì)把內(nèi)存中暫時(shí)不用的數(shù)據(jù)交換出去,放在SWAP分區(qū)中,這個(gè)過程稱為SWAP OUT。當(dāng)某進(jìn)程又需要這些數(shù)據(jù)且OS發(fā)現(xiàn)還有空閑物理內(nèi)存時(shí),又會(huì)把SWAP分區(qū)中的數(shù)據(jù)交換回物理內(nèi)存中,這個(gè)過程稱為SWAP IN。當(dāng)然,swap大小是有上限的,一旦swap使用完,操作系統(tǒng)會(huì)觸發(fā)OOM-Killer機(jī)制,把消耗內(nèi)存最多的進(jìn)程kill掉以釋放內(nèi)存。
shared 共享內(nèi)存,即和普通用戶共享的物理內(nèi)存值, 主要用于進(jìn)程間通信
buffers 用于存放要輸出到disk(塊設(shè)備)的數(shù)據(jù)的
cached 存放從disk上讀出的數(shù)據(jù)
total 總的物理內(nèi)存,total=used+free
used 使用掉的內(nèi)存
free 空閑的內(nèi)存

查詢服務(wù)器內(nèi)存 

  1. [root@node5 ~]# free -m  
  2.               total        used        free      shared  buff/cache   available  
  3. Mem:           3941         286        3446          19         208        3407  
  4. Swap:          2047           0        2047  
  5. #注釋  
  6. #linux的內(nèi)存管理機(jī)制的思想包括(不敢說就是)內(nèi)存利用率最大化。內(nèi)核會(huì)把剩余的內(nèi)存申請(qǐng)為cached,而cached不屬于free范疇。當(dāng)系統(tǒng)運(yùn)#行時(shí)間較久,會(huì)發(fā)現(xiàn)cached很大,對(duì)于有頻繁文件讀寫操作的系統(tǒng),這種現(xiàn)象會(huì)更加明顯。直觀的看,此時(shí)free的內(nèi)存會(huì)非常小,但并不代表可##用的內(nèi)存小,當(dāng)一個(gè)程序需要申請(qǐng)較大的內(nèi)存時(shí),如果free的內(nèi)存不夠,內(nèi)核會(huì)把部分cached的內(nèi)存回收,回收的內(nèi)存再分配給應(yīng)用程序。所以#對(duì)于linux系統(tǒng),可用于分配的內(nèi)存不只是free的內(nèi)存,還包括cached的內(nèi)存(其實(shí)還包括buffers)。 
  7. #對(duì)于操作系統(tǒng):  
  8. #MemFree=total-used  
  9. #MemUsed  = MemTotal - MemFree  
  10. #對(duì)于應(yīng)用程序:  
  11. #MemFree=buffers+cached+free 

每隔3秒查詢一下內(nèi)存 

  1. [root@node5 ~]# free -s 3  
  2.               total        used        free      shared  buff/cache   available  
  3. Mem:        4036316      361144     3458272       19536      216900     3419776  
  4. Swap:       2097148           0     2097148  
  5.               total        used        free      shared  buff/cache   available  
  6. Mem:        4036316      361144     3458272       19536      216900     3419776  
  7. Swap:       2097148           0     2097148  
  8.               total        used        free      shared  buff/cache   available  
  9. Mem:        4036316      361144     3458272       19536      216900     3419776  
  10. Swap:       2097148           0     2097148 

2.4 硬盤基本配置查詢

查詢磁盤整體使用情況 

  1. [root@node5 ~]# df -h  
  2. Filesystem               Size  Used Avail Use% Mounted on  
  3. /dev/mapper/centos-root   17G  4.1G   13G  24% /  
  4. devtmpfs                 2.0G     0  2.0G   0% /dev  
  5. tmpfs                    2.0G  8.0K  2.0G   1% /dev/shm  
  6. tmpfs                    2.0G  8.7M  2.0G   1% /run  
  7. tmpfs                    2.0G     0  2.0G   0% /sys/fs/cgroup  
  8. /dev/sda1               1014M  125M  890M  13% /boot  
  9. tmpfs                    395M     0  395M   0% /run/user/0  
  10. #命令拓展  
  11. #df -a 顯示全部的文件系統(tǒng)的使用情況  
  12. #df -i顯示inode信息  
  13. #df -k 已字節(jié)數(shù)顯示區(qū)塊占用情況  
  14. #df -T 顯示文件系統(tǒng)的類型 

查詢某個(gè)目錄磁盤占用情況 

  1. #命令拓展  
  2. #du -s 指定目錄大小匯總  
  3. #du -h帶計(jì)量單位  
  4. #du -a 含文件  
  5. #du --max-depth=1 子目錄深度  
  6. #du -c 列出明細(xì)的同時(shí),增加匯總值  
  7. [root@node5 ~]# du -sh /home/  
  8. 1.7G  /home/  
  9. [root@node5 ~]# du -ach --max-depth=2 /home/  
  10. 4.0K  /home/www/.bash_logout  
  11. 4.0K  /home/www/.bash_profile  
  12. 4.0K  /home/www/.bashrc  
  13. 4.0K  /home/www/web  
  14. 16K  /home/www  
  15. 4.0K  /home/nginx/.bash_logout  
  16. 4.0K  /home/nginx/.bash_profile  
  17. 4.0K  /home/nginx/.bashrc  
  18. 12K  /home/nginx  
  19. 4.0K  /home/esnode/.bash_logout  
  20. 4.0K  /home/esnode/.bash_profile  
  21. 4.0K  /home/esnode/.bashrc  
  22. 4.0K  /home/esnode/.oracle_jre_usage  
  23. 4.3M  /home/esnode/elasticsearch-analysis-ik-6.2.2.zip  
  24. 80M  /home/esnode/kibana-6.2.2-linux-x86_64.tar.gz  
  25. 300M  /home/esnode/x-pack-6.2.2.zip  
  26. 28M  /home/esnode/elasticsearch-6.2.2.tar.gz  
  27. 4.0K  /home/esnode/.bash_history  
  28. 294M  /home/esnode/elasticsearch-6.2.2  
  29. 4.0K  /home/esnode/.ssh  
  30. 4.0K  /home/esnode/x-pack生成的秘鑰.txt  
  31. 1014M  /home/esnode/kibana-6.2.2-linux-x86_64  
  32. 8.0K  /home/esnode/.viminfo  
  33. 1.7G  /home/esnode  
  34. 1.7G  /home/  
  35. 1.7G  total 

查看目錄結(jié)構(gòu) 

  1. #tree命令默認(rèn)沒有安裝,需要手動(dòng)安裝一下  
  2. [root@node5 ~]# yum -y install tree  
  3. #-L指定目錄深度  
  4. [root@node5 ~]# tree -L 2 /home/  
  5. /home/  
  6. ├── esnode  
  7. │   ├── elasticsearch-6.2.2  
  8. │   ├── elasticsearch-6.2.2.tar.gz  
  9. │   ├── elasticsearch-analysis-ik-6.2.2.zip  
  10. │   ├── kibana-6.2.2-linux-x86_64  
  11. │   ├── kibana-6.2.2-linux-x86_64.tar.gz 
  12. │   ├── x-pack-6.2.2.zip 
  13. │   └── x-pack\347\224\237\346\210\220\347\232\204\347\247\230\351\222\245.txt  
  14. ├── nginx  
  15. └── www  
  16.     └── web  
  17. 6 directories, 5 files 

以樹狀的格式顯示所有可用的塊設(shè)備信息 

  1. [root@node5 ~]# lsblk  
  2. NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT  
  3. sda               8:0    0   20G  0 disk   
  4. ├─sda1            8:1    0    1G  0 part /boot  
  5. └─sda2            8:2    0   19G  0 part   
  6.   ├─centos-root 253:0    0   17G  0 lvm  /  
  7.   └─centos-swap 253:1    0    2G  0 lvm  [SWAP]  
  8. sdb               8:16   0    1G  0 disk   
  9. └─sdb1            8:17   0  200M  0 part   
  10. sr0              11:0    1 1024M  0 rom 
  11. #注釋  
  12. #NAME —— 設(shè)備的名稱  
  13. #MAJ:MIN —— Linux 操作系統(tǒng)中的每個(gè)設(shè)備都以一個(gè)文件表示,對(duì)塊(磁盤)設(shè)備來說,這里用主次設(shè)備編號(hào)來描述設(shè)備。  
  14. #RM —— 可移動(dòng)設(shè)備。如果這是一個(gè)可移動(dòng)設(shè)備將顯示 1,否則顯示 0。  
  15. #TYPE —— 設(shè)備的類型  
  16. #MOUNTPOINT —— 設(shè)備掛載的位置  
  17. #RO —— 對(duì)于只讀文件系統(tǒng),這里會(huì)顯示 1,否則顯示 0。  
  18. #SIZE —— 設(shè)備的容量 

列出所有可用的設(shè)備、通用唯一識(shí)別碼(UUID)、文件系統(tǒng)類型以及卷標(biāo) 

  1. [root@node5 ~]# blkid  
  2. /dev/sda1: UUID="6503b4ad-2975-4152-a824-feb7bea1b622" TYPE="xfs"   
  3. /dev/sda2: UUID="nqZ4uJ-ksnN-KzYS-N42b-00m3-Ohc2-BJXunP" TYPE="LVM2_member"   
  4. /dev/sdb1: UUID="94396e17-4821-4957-aa76-d41f33958ff5" TYPE="xfs"   
  5. /dev/mapper/centos-root: UUID="c1d38b37-821d-48e7-8727-3937ccc657a4" TYPE="xfs"   
  6. /dev/mapper/centos-swap: UUID="c2fcaf11-42d8-4e4c-bf9e-6464f0777198" TYPE="swap" 

 【編輯推薦】

 

責(zé)任編輯:龐桂玉 來源: 良許Linux
相關(guān)推薦

2020-12-23 10:48:18

LinuxOSCPU

2020-07-03 07:46:22

CPUOS內(nèi)存

2009-02-16 18:08:01

linux硬件信息cpu

2010-02-04 09:26:34

Linux vmsta

2010-05-27 16:03:22

Linux查看cpu

2010-06-13 15:20:20

Linux 查看內(nèi)存

2009-02-16 18:27:09

2020-08-11 09:41:27

CPU硬盤操作系統(tǒng)

2014-07-28 16:47:41

linux性能

2022-09-09 14:56:18

Linuxcpu

2021-02-21 11:48:30

內(nèi)存磁盤IO

2024-07-31 11:59:23

linux內(nèi)存磁盤

2010-05-27 16:41:30

Linux查看版本

2022-11-07 15:29:06

UbuntuLinuxCPU

2020-05-15 07:00:00

Linux硬盤信息

2021-04-21 09:44:18

LinuxCPUCLI工具

2021-05-28 10:10:05

LinuxCPU機(jī)器學(xué)習(xí)

2021-04-13 10:57:02

LinuxCPUCLI

2011-03-31 11:14:30

MRTG監(jiān)測(cè)

2011-03-31 11:14:29

MRTG監(jiān)測(cè)
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)