系統(tǒng)狀態(tài)檢測(cè)命令
網(wǎng)卡網(wǎng)絡(luò)、系統(tǒng)內(nèi)核鲫售、系統(tǒng)負(fù)載共螺、內(nèi)存使用情況、當(dāng)前啟用終端數(shù)量情竹、歷史登錄記錄璃谨、命令執(zhí)行記錄以及救援診斷命令的使用方法。
1.ifconfig用于獲取網(wǎng)卡配置與網(wǎng)絡(luò)狀態(tài)等信息:格式為ifconfig [網(wǎng)絡(luò)設(shè)備] [參數(shù)]
鲤妥。
查看本機(jī)當(dāng)前的網(wǎng)卡配置與網(wǎng)絡(luò)狀態(tài)等信息,主要就是看每段開頭的網(wǎng)卡名稱拱雏、inet參數(shù)后面的IP地址棉安、ether參數(shù)后面的MAC網(wǎng)卡物理地址以及RX、TX的接收與發(fā)送數(shù)據(jù)包的流量大小铸抑,即下面加粗的信息內(nèi)容
[root@linuxprobe ~]# ifconfig
eno16777728: flags=4163 mtu 1500
inet 192.168.10.10 netmask 255.255.255.0 broadcast 192.168.10.255
inet6 fe80::20c:29ff:fec4:a409 prefixlen 64 scopeid 0x20
ether 00:0c:29:c4:a4:09 txqueuelen 1000 (Ethernet)
RX packets 36 bytes 3176 (3.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 38 bytes 4757 (4.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 0 (Local Loopback)
RX packets 386 bytes 32780 (32.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 386 bytes 32780 (32.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
2.uname命令用于查看系統(tǒng)內(nèi)核與系統(tǒng)版本等信息贡耽,格式為:uname [-a]
。
一般會(huì)固定搭配上-a參數(shù)來(lái)完整查看當(dāng)前系統(tǒng)的內(nèi)核名稱、主機(jī)名蒲赂、內(nèi)核發(fā)行版本阱冶、節(jié)點(diǎn)名、系統(tǒng)時(shí)間滥嘴、硬件名稱木蹬、硬件平臺(tái)、處理器類型以及操作系統(tǒng)名稱等信息:
[root@linuxprobe ~]# uname -a
Linux linuxprobe.com 3.10.0-123.el7.x86_64 #1 SMP Mon May 5 11:16:57 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux
3.uptime命令用于查看系統(tǒng)的負(fù)載信息若皱,格式為:“uptime”镊叁。
這個(gè)命令真的很棒,它可以為您顯示當(dāng)前系統(tǒng)時(shí)間走触、系統(tǒng)已運(yùn)行時(shí)間晦譬、啟用終端數(shù)量以及平均負(fù)載值等信息數(shù)據(jù)。平均負(fù)載值指的是最近1分鐘互广、5分鐘敛腌、15分鐘的系統(tǒng)壓力情況(下面加粗的信息部分),負(fù)載值越低越好惫皱,盡量不要長(zhǎng)期超過(guò)1像樊。另外您還可以結(jié)合搭配用"watch -n 1 uptime"命令來(lái)每秒刷新一次來(lái)獲得當(dāng)前的系統(tǒng)負(fù)載情況。
[root@linuxprobe ~]# uptime
22:49:55 up 10 min, 2 users, load average: 0.01, 0.19, 0.18
4.free命令用于顯示當(dāng)前系統(tǒng)中內(nèi)存的使用量信息逸吵,格式為:free [-h]
凶硅。
[root@controller openstack-dashboard]# free -h
total used free shared buff/cache available
Mem: 7.6G 4.2G 1.1G 16M 2.4G 3.1G
Swap: 4.0G 0B 4.0G
5.who命令用于查看當(dāng)前登入主機(jī)的用戶終端信息,格式為:who [參 數(shù)]
扫皱。
[root@controller openstack-dashboard]# who
登陸的用戶名 終端設(shè)備 登陸到系統(tǒng)的時(shí)間
root tty1 2017-07-12 19:32
root pts/0 2017-07-12 20:24 (10.1.1.1)
root tty4 2017-07-12 15:32
6.last命令用于查看所有系統(tǒng)的登入記錄足绅,格式為:last [參數(shù)]
。
使用last命令可以看到本機(jī)的登錄記錄韩脑,但由于這些信息都是被以日志文件的形式保存在系統(tǒng)中的數(shù)據(jù)內(nèi)容氢妈,駭客們很輕易的便可對(duì)內(nèi)容進(jìn)行篡改,所有千萬(wàn)不要單純以該命令的輸出信息而判斷系統(tǒng)有無(wú)被惡意入侵段多!
[root@controller openstack-dashboard]# last
root pts/0 10.1.1.1 Wed Jul 12 20:24 still logged in
root pts/1 10.1.1.1 Wed Jul 12 15:33 - 22:32 (06:58)
root tty4 Wed Jul 12 15:32 still logged in
root pts/0 10.1.1.1 Wed Jul 12 21:27 - 17:42 (-3:-44)
root tty1 Wed Jul 12 19:32 still logged in
reboot system boot 3.10.0-327.el7.x Wed Jul 12 19:19 - 19:27 (1+00:07)
root tty1 Mon Jul 10 02:32 - crash (2+16:47)
reboot system boot 3.10.0-327.el7.x Mon Jul 10 02:05 - 19:27 (3+17:22)
7.history命令用于顯示歷史執(zhí)行過(guò)的命令首量,格式為:“history [-c]”。
歷史命令會(huì)被保存到用戶家目錄中的".bash_history"文件中进苍。Linux系統(tǒng)中以點(diǎn)(.)開頭的文件均代表隱藏文件加缘,一般大多會(huì)是系統(tǒng)服務(wù)文件。
history -c
可以清空該用戶在本機(jī)中執(zhí)行的Linux命令歷史記錄信息觉啊。
8.sosreport命令用于收集系統(tǒng)配置并診斷信息后輸出結(jié)論文檔拣宏,格式為:“sosreport”。
9.stat命令用于查看文件的具體存儲(chǔ)信息和時(shí)間等信息杠人,格式“stat 文件名稱”勋乾。
[root@controller ~]# stat admin-openrc
File: ‘a(chǎn)dmin-openrc’
Size: 259 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050d Inode: 70120482 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u:object_r:admin_home_t:s0
Access: 2017-07-12 20:02:55.648994169 +0800
Modify: 2017-07-12 20:02:08.394996175 +0800
Change: 2017-07-12 20:02:08.394996175 +0800
Birth: -