bash_history 和 mysql_history

7 篇文章 0 订阅

bash history

1 history

查看历史命令

2 export HISTTIMEFORMAT='%F %T '

   history

查看带上时间的历史命令。

3 cat ~/.bash_history | less

 查看历史命令文件。

4 !n

 执行编号为n的历史命令

5 history n

 显示最近n条历史命令。

6 ctrl+R+name

 搜索包含name的历史命令,然后按↑↓键可以看到该命令相邻的命令。

7 !name 

 执行以name开头的命令

8 vim ~/.bash_profile

   HISTFILE=new history name

修改历史命令保存的文件,默认在.bash_history中

9 history -c

  清除所有的历史命令。


MySQL history

On Unix, the mysql client writes a record of executed statements to a history file. By default, the history file is named .mysql_history and is created in your home directory. To specify a different file, set the value of the MYSQL_HISTFILE environment variable. 
If you do not want to maintain a history file, first remove .mysql_history if it exists, and then use either of the following techniques: 
Set the MYSQL_HISTFILE variable to /dev/null. To cause this setting to take effect each time you log in, put the setting in one of your shell's startup files. 
Create .mysql_history as a symbolic link to /dev/null: shell> ln -s /dev/null $HOME/.mysql_history
You need do this only once.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值