2016年8月29日 星期一

Linux History

[root@localhost ~]# history
#前面省略
201 LANG=C
212 ifup eno33554992
215 history 10
214 vi ~/.bash_history
215 history
216 vi ~/.bashrc
217 hostname
218 ip a
219 ip route
220 nmcli c s
#顯示歷史指令
#參數介紹
-c 刪除紀錄
-a 新增
-w 寫入 histfiles
#資料庫位置
~/.bash_history
view raw 20160830B01.sh hosted with ❤ by GitHub
[root@localhost ~]# history 3
218 ip a
219 ip route
220 nmcli c s
#只列出最近的3筆資料
view raw 20160830B02.sh hosted with ❤ by GitHub
[root@localhost ~]# ![number]
#執行[history 序號]
[root@localhost ~]# !!
#執行上一個指令
[root@localhost ~]# !219
ip route
default via 192.168.1.1 dev eno33554992
169.254.0.0/16 dev eno16777736 scope link metric 1002
169.254.0.0/16 dev eno33554992 scope link metric 1003
192.168.1.0/24 dev eno33554992 proto kernel scope link src 192.168.1.108
192.168.2.0/24 dev eno16777736 proto kernel scope link src 192.168.2.131
#[219]為 ip route
view raw 20160830B03.sh hosted with ❤ by GitHub

沒有留言: