history命令Linux系统历史记录及清除

分类: Linux命令   出处:iocblog整理  更新时间:2009-08-09   添加到收藏  

  步骤如下:
 
  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的步骤,又可以使命令很清晰了。(来源www.iocblog.net)
 


Tag: history



文章整理:iocblog
版权申明:本站文章均来自网络,如有侵权,请联系我们,我们收到后立即删除,谢谢!
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有。