<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>http://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>http://jackxiang.com/post/5133/</link>
<title><![CDATA[[实践OK]如何使linux系统下的root用户不保存终端历史记录到.bash_history中?]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Unix/LinuxC技术]]></category>
<pubDate>Mon, 16 Apr 2012 14:40:08 +0000</pubDate> 
<guid>http://jackxiang.com/post/5133/</guid> 
<description>
<![CDATA[ 
	实践OK：<br/>————————————————<br/>1）history -c&nbsp;&nbsp;//是把Linux下的/root/.bash_history&nbsp;&nbsp;全给清了，实现不保存，作为黑客是不地道的。<br/>再从其他终端倒腾回去：<br/>history &#124;awk -F&quot; &quot;&nbsp;&nbsp;&#039;&#123;if(NR&gt;0)&#123;$1=&quot;&quot;;print $0&#125;&#125;&#039;&#124;grep -v &quot;multepollserver&quot; &gt; /root/.bash_history<br/><br/>2）不留痕迹的办法,把指向给修改到/dev/null下：<br/>[root@localhost ~]# echo $HISTFILE<br/>/root/.bash_history<br/>[root@localhost ~]# HISTFILE=/dev/null<br/>[root@localhost ~]# echo $HISTFILE&nbsp;&nbsp;&nbsp;&nbsp;<br/>/dev/null<br/><br/>[root@test ~]# vi /root/.bash_history<br/>对前面的：history &#124;awk -F&quot;&nbsp;&nbsp;&quot; &#039;&#123;print $3&#125;&#039; &gt; /root/.bash_history 删除，退出即可。<br/><br/><br/><br/>请教一个关于linux下不保存命令历史记录的问题，不需要在任何文件中设置：<br/>ssh 登陆之后，在命令行下运行<br/>set HISTIGNORE=*<br/>或者<br/>export HISTIGNORE=*<br/>以后的命令就不会被保存了。<br/><br/>用 history -c 清空历史命令.<br/>在.bashrc的最后行追加<br/>unset HISTFILE<br/>这样做终端历史记录还是保存到了.bash_history文件中，只是新打开的终端不能直接用上键调用而已，用&quot;cat .bash_history&quot;仍能查看历史记录<br/>cat .bash_history 看到的历史记录是 unset HISTFILE 之前保留的命令.<br/>unset HISTFILE 之后的命令并没有保留.<br/>用 history -c 清空历史命令.<br/><br/><br/>步骤如下:<br/>1、建立一个文件来存储常用命令，例如/root/history.txt,把常用命令当成文本写进去，每个命令占一行<br/>2、在终端运行history -c，清除杂乱的历史记录<br/>3、运行history -r /root/history.txt,把命令读进来作为当前bash的历史记录<br/>4、运行history,就得到一个整洁的命令列表了，例如:<br/>[root@localhost windata]# history -c<br/>[root@localhost windata]# history -r /root/history.txt<br/>[root@localhost windata]# history<br/>1 history -r /root/history.txt<br/>2 mount -t msdos -o iocharset=gb2312 /dev/sda1 /mnt/usb<br/>3 mount -t vfat -o iocharset-gb2312 /dev/hda5 /mnt/windata<br/>4 umount /mnt/windata<br/>5 mount -t vfat -o iocharset-gb2312 /dev/hda5 /mnt/windata<br/>6 cd /mnt/windata<br/>7 history<br/>[root@localhost windata]#<br/>5、以后命令乱了，重复1-4的步骤，又可以使命令很清晰了。<br/><br/><br/>可以用history命令来查看。<br/>其它的记录你在/var/log这个文件夹下去找吧。它记录了所有的记录。<br/>实际上。history命令也是读的/var/log的东西<br/><br/>历史命令都在 .bash_history 文件中呀，每个用户的家目录中都有这个文件的，去看他们的历史命令吧 <br/>在每个用户的家目录里，看文本命令很多，如： cat &#92; more &#92; less &#92; vi 等等这些命令都可以看某个用户的 .bash_history 文件。<br/><br/>例：# more ~user/.bash_history&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;看 user 用户的历史命令，但是你要访问的权限才行。<br/>.bash_history在每个用户的$HOME下<br/>在每个用户的home目录下的.bash_history<br/><br/>6.把一些命令给去掉回写回/root/.bash_history的方法：<br/><textarea name="code" class="C" rows="15" cols="100">
history &#124;awk -F&quot; &quot;&nbsp;&nbsp;&#039;&#123;if(NR&gt;0)&#123;$1=&quot;&quot;;print $0&#125;&#125;&#039;&#124;grep -v &quot;multepollserver&quot; &gt; /root/.bash_history
</textarea>
]]>
</description>
</item><item>
<link>http://jackxiang.com/post/5133/#blogcomment63718</link>
<title><![CDATA[[评论] [实践OK]如何使linux系统下的root用户不保存终端历史记录到.bash_history中?]]></title> 
<author>hxngb1af &lt;ptdu987@domozmail.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Wed, 02 May 2012 00:40:39 +0000</pubDate> 
<guid>http://jackxiang.com/post/5133/#blogcomment63718</guid> 
<description>
<![CDATA[ 
	要看要看。謝謝分享哦
]]>
</description>
</item>
</channel>
</rss>