Matlab like Bash history

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.

This entry was posted in MATLAB and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *