linuxcpu核數查看
Ⅰ linux如何查看cpu核心數和內存大小
linux查看cpu核數和內存大罩御高小命令分別為:
1、查看CPU個數*核心數:
cat /proc/cpuinfo |grep「physical id」 | uniq | wc -l
96 #一共96核
2、查看內存總數
#cat /proc/meminfo | grep MemTotal
MemTotal: 230993600 kB
Linux下查看CPU型號,內存大小,硬碟空間的命令:
1、查看CPU核數
cat /proc/cpuinfo | grep 「cpu cores」 | uniq
cpu cores : 12 #12是拆虛單顆CPU的核心數
2、查看CPU型號
cat /proc/cpuinfo | grep 『model name』 |uniq
model name : Intel® Xeon® CPU E7-4830 v3 @ 2.10GHz
3、查看linux物理內存數量物尺及大小
dmidecode -t memory | grep Size: | grep -v 「No Mole Installed」
Ⅱ linux鏌ョ湅cpu涓鏁板拰鏍稿績鏁
cpu淇℃伅璁板綍鍦/proc/cpuinfo涓銆
linux鎬庝箞鏌ョ湅cpu鐨勪釜鏁幫紵鎴戜滑涓璧鋒潵浜嗚В涓涓嬪惂銆傜涓縐嶆柟娉曪細top鍛戒護娉曢栧厛鎵ц宼op鍛戒護銆傚湪top鍛戒護鐨勬樉紺虹晫闈錛屾寜鏁板瓧閿1錛屽嵆鍙鏌ョ湅鍒板綋鍓嶇郴緇熶腑鐨勬籧pu鏁般
linux緋葷粺鏂規硶/姝ラ1/proc/cpuinfo鏈綆鍗曠殑鏂規硶灝辨槸鏌ョ湅/proc/cpuinfo錛岃繖涓鉶氭嫙鏂囦歡灞曠ず鐨勬槸鍙鐢–PU紜浠剁殑閰嶇疆銆
榧犳爣鍙抽敭鐐瑰嚮妗岄潰錛岄夋嫨鈥滄墦寮緇堢鈥濓紝濡備笅鍥炬墍紺恆傚厛杈撳叆鍛戒護鈥渃at/proc/cpuinfo鈥濓紝鐒跺悗鍐嶆寜鍥炶濺閿灝辮兘鐪嬪埌鏈嶅姟鍣ㄧ殑CPU淇℃伅錛屽備笅鍥炬墍紺恆
鏌ヨ㈤昏緫CPU鎬繪暟錛歝at/proc/cpuinfo|grepprocessor|wc-l璇風偣鍑昏緭鍏ュ浘鐗囨弿榪版渶鍚庯紝緇欏ぇ瀹朵粙緇嶄笅CPU鍨嬪彿鐨勬煡璇㈡柟寮忋
1銆佺涓縐嶆柟娉曪細top鍛戒護娉曢栧厛鎵ц宼op鍛戒護銆傚湪top鍛戒護鐨勬樉紺虹晫闈錛屾寜鏁板瓧閿1錛屽嵆鍙鏌ョ湅鍒板綋鍓嶇郴緇熶腑鐨勬籧pu鏁般
2銆佹煡鐪媍pu鎬諱釜鏁版柟娉曪細棣栧厛鎵ц宼op鍛戒護錛屽備笅鍥句腑鍐呭規墍琛ㄧず銆傚湪top鍛戒護鐨勬樉紺虹晫闈錛屾寜鏁板瓧閿1錛屽嵆鍙鏌ョ湅鍒板綋鍓嶇郴緇熶腑鐨勬籧pu鏁幫紝濡備笅鍥句腑鍐呭規墍琛ㄧず銆
3銆侀栧厛鏄瀵逛簬CPU鐨勮存槑鏈嶅姟鍣–PU鎬ц兘鍙傛暟涓昏佷俊鎮鍙浠ラ氳繃鏌ョ湅/proc/cpuinfo鑾峰緱銆
4銆佹渶綆鍗曠殑鏂規硶灝辨槸鏌ョ湅/proc/cpuinfo錛岃繖涓鉶氭嫙鏂囦歡灞曠ず鐨勬槸鍙鐢–PU紜浠剁殑閰嶇疆銆傞氳繃鏌ョ湅榪欎釜鏂囦歡錛屼綘鑳借瘑鍒鍑虹墿鐞嗗勭悊鍣ㄦ暟(鎻掓Ы)銆佹瘡涓狢PU鏍稿績鏁般佸彲鐢ㄧ殑CPU鏍囧織瀵勫瓨鍣ㄤ互鍙婂叾瀹冧笢瑗跨殑鏁伴噺銆
5銆佽風偣鍑昏緭鍏ュ浘鐗囨弿榪頒篃鍙浠ヤ嬌鐢ㄥ備笅鏂瑰紡鍗曠嫭鏌ヨCPU涓鏁般佹牳鏁板強閫昏緫CPU鎬繪暟銆
1銆丆PU鐨勪俊鎮瀛樻斁鍦/proc/cpuinfo涓錛屽備笅鍥炬墍紺猴紝physicalid浠h〃絎鍑犱釜CPU錛岀紪鍙蜂粠0寮濮嬶紝cpucores浠h〃鏍告暟錛屽彲浠ョ湅鍑烘槸1棰1鏍哥殑CPU錛屽嵆CPU涓鏁版槸1涓銆
2銆乴inux鎬庝箞鏌ョ湅cpu鏍告暟錛熸垜浠涓璧鋒潵浜嗚В涓涓嬪惂銆傛墦寮linux緋葷粺錛屽湪linux鐨勬岄潰鐨勭┖鐧藉勫彸鍑匯傚湪寮瑰嚭鐨勪笅鎷夐夐」閲岋紝鐐瑰嚮鎵撳紑緇堢銆傝緭鍏cat/proc/cpuinfo鍛戒護錛屽洖杞﹁繍琛岋紝鍏朵腑cpucores浠h〃鏍告暟銆
3銆佹柟娉/姝ラlinux鐨刢pu淇℃伅鍙浠ヤ粠鏂囦歡涓璫puinfo璇誨彇銆傛墽琛屽懡浠わ細cat/proc/cpuinfo璇風偣鍑昏緭鍏ュ浘鐗囨弿榪版垜浠涓鑸鐪嬪埌鐨刾rocessor鏄閫昏緫鏍搞
4銆乧pu淇℃伅璁板綍鍦/proc/cpuinfo涓銆
1銆乧pu淇℃伅璁板綍鍦/proc/cpuinfo涓銆
2銆乴inux鎬庝箞鏌ョ湅cpu鐨勪釜鏁幫紵鎴戜滑涓璧鋒潵浜嗚В涓涓嬪惂銆傜涓縐嶆柟娉曪細top鍛戒護娉曢栧厛鎵ц宼op鍛戒護銆傚湪top鍛戒護鐨勬樉紺虹晫闈錛屾寜鏁板瓧閿1錛屽嵆鍙鏌ョ湅鍒板綋鍓嶇郴緇熶腑鐨勬籧pu鏁般
3銆佹墦寮xshell杞浠惰繛鎺ヤ笂linux鏈嶅姟鍣ㄣ傝緭鍏ユ寚浠ゃ恈at/proc/cpuinfo|grepname|cut-f2-d錛殀uniq-c銆戞煡鐪媍pu鍨嬪彿淇℃伅銆傜劧鍚庤緭鍏ユ寚浠ゃ恎repphysicalid/proc/cpuinfo|sort|uniq|wc-l銆戣繕鍙浠ユ煡鐪媍pu鐗╃悊涓鏁般
4銆佹煡璇㈤昏緫CPU鎬繪暟錛歝at/proc/cpuinfo|grepprocessor|wc-l璇風偣鍑昏緭鍏ュ浘鐗囨弿榪版渶鍚庯紝緇欏ぇ瀹朵粙緇嶄笅CPU鍨嬪彿鐨勬煡璇㈡柟寮忋
5銆佹煡cpu鏁扮殑鏂規硶絎涓縐嶆柟娉曪細top鍛戒護娉曞湪top鍛戒護鐨勬樉紺虹晫闈錛屾寜鏁板瓧閿1錛屽嵆鍙鏌ョ湅鍒板綋鍓嶇郴緇熶腑鐨勬籧pu鏁幫紝濡備笅鍥句負4鏍哥殑cpu銆
鏌ョ湅linux緋葷粺CPU淇℃伅鐨勬柟娉曞伐鍏/鍘熸枡linux緋葷粺鏂規硶/姝ラ1/proc/cpuinfo鏈綆鍗曠殑鏂規硶灝辨槸鏌ョ湅/proc/cpuinfo錛岃繖涓鉶氭嫙鏂囦歡灞曠ず鐨勬槸鍙鐢–PU紜浠剁殑閰嶇疆銆
Linux鍛戒護琛屽彲浠ヤ嬌鐢╰op鎴栬卾mstat鍛戒護鏌ョ湅緋葷粺鐨凜PU鍜屽唴瀛樹嬌鐢ㄦ儏鍐點
鍦ㄧ數鑴戜腑榪涘叆Linux鎿嶄綔緋葷粺錛屾墦寮Linux鍛戒護鐣岄潰銆傚湪Linux鍛戒護鐣岄潰涓杈撳叆cat/proc/meminfo鍛戒護鍚庯紝鏁插嚮閿閿鐩樺洖杞﹂敭銆傚湪鏁插嚮瀹屽洖杞﹂敭鍚庯紝鍑虹幇MemTotal鍜孧emFree鍒嗗埆灝辨槸鍙鏀閰嶅唴瀛樺拰絀洪棽鍐呭瓨浜嗐
linux濡備綍鏌ョ湅cpu鍨嬪彿錛屼負鎮ㄦ彁渚沴inux濡備綍鏌ョ湅cpu鍨嬪彿鍥炬枃淇℃伅錛屾墦寮linux緋葷粺錛屽湪linux鐨勬岄潰鐨勭┖鐧藉勫彸鍑匯傚湪寮瑰嚭鐨勪笅鎷夐夐」閲岋紝鐐瑰嚮鎵撳紑緇堢銆