歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux服務器 >> 清除Linux操作系統命令的歷史記錄

清除Linux操作系統命令的歷史記錄

日期:2017/3/2 16:49:24   编辑:Linux服務器

 步驟如下:
  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的步驟,又可以使命令很清晰了

Copyright © Linux教程網 All Rights Reserved