Chinaunix首页 | 论坛 | 博客
  • 博客访问: 20726
  • 博文数量: 4
  • 博客积分: 233
  • 博客等级: 入伍新兵
  • 技术积分: 30
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-05 11:38
文章分类
文章存档

2012年(4)

我的朋友
最近访客

分类: LINUX

2012-04-20 02:16:03


cited from 

In Matlab you can just type the first letters of a used command and press the arrow up key to get it back. In Bash you can do the same, but you have to press page up instead of arrow up.

If you want to have the same behavior in Bash as in Matlab, you can do it this way:

Create ~/.inputrc and add the following lines:

# Matlab like Bash history
"\e[B": history-search-forward
"\e[A": history-search-backward

# Include system wide settings which are ignored
# by default if one has its own .inputrc
$include /etc/inputrc

 

Also add the following to your ~/.bashrc:

# Load inputrc
export INPUTRC=~/.inputrc

# Ignore multiple entries of the same command in history
export HISTCONTROL=ignoreboth

 

Now the Bash history should work like the history in Matlab.

CTRL-C cleans the line, if you have searched for the wrong command.
In addition to that in Bash you can jump to last/next word in the command line by pressing CTRL-arrow left/arrow right.


阅读(1884) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~