CentOS系統裡的曆史命令:history

來源:互聯網
上載者:User

CentOS系統裡的曆史命令:history
[root@linux ~]# history [n]
[root@linux ~]# history [-c]
[root@linux ~]# history [-raw] histfiles
參數:
n :數字,意思是『要列出最近的 n 筆命令列表』的意思!
-c :將目前的 shell 中的所有 history 內容全部消除
-a :將目前新增的 history 指令新增入 histfiles 中,若沒有加 histfiles ,
則預設寫入 ~/.bash_history
-r :將 histfiles 的內容讀到目前這個 shell 的 history 記憶中;
-w :將目前的 history 記憶內容寫入 histfiles 中!
範例:
範例一:列出目前記憶體內的所有 history 記憶
[root@linux ~]# history
# 前面省略
1017 man bash
1018 ll
1019 history
1020 history
# 列出的資訊當中,共分兩欄,第一欄為該指令在這個 shell 當中的代碼,
# 另一個則是指令本身的內容喔!至於會秀出幾筆指令記錄,則與 HISTSIZE 有關!
範例二:列出目前最近的 3 筆資料
[root@linux ~]# history 3
1019 history
1020 history
1021 history 3
範例三:立刻將目前的資料寫入 histfile 當中
[root@linux ~]# history -w
# 在預設的情況下,會將曆史紀錄寫入 ~/.bash_history 當中!
[root@linux ~]# echo $HISTSIZE
1000

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.