如何清除Linux作業系統命令的記錄

來源:互聯網
上載者:User

步驟如下:

1、建立一個檔案來儲存常用命令,例如/root/history.txt,把常用命令當成文本寫進去,每個命令佔一行

2、在終端運行history -c,清除雜亂的記錄

3、運行history -r /root/history.txt,把命令讀進來作為當前bash的記錄

4、運行history,就得到一個整潔的命令列表了,例如:

[root@localhost windata]# history -c

[root@localhost windata]# history -r /root/history.txt

[root@localhost windata]# history

1 history -r /root/history.txt

2 mount -t msdos -o iocharset=gb2312 /dev/sda1 /mnt/usb

3 mount -t vfat -o iocharset-gb2312 /dev/hda5 /mnt/windata

4 umount /mnt/windata

5 mount -t vfat -o iocharset-gb2312 /dev/hda5 /mnt/windata

6 cd /mnt/windata

7 history

[root@localhost windata]#

5、以後命令亂了,重複1-4的步驟,又可以使命令很清晰了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.