Ask Your Question
2

Default behaviour of Ctrl-P on bash, fedora 26

asked 2018-09-12 08:26:08 -0500

I am trying to find documentation on the command issued by the key sequence Alt-P on bash. I can't find anything on it. After pressing it, a ":" appears on the command line, and every subsequent keystroke is typed literally, similar to what happen with the command showkey -a, until I type Ctrl-C. Is there a some utility that takes a key sequence and shows the command that it issues? Can anyone point to some documentation on this?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2018-09-12 10:39:40 -0500

villykruse gravatar image

This is for looking up a previous command in the command history. After the colon, enter the first few letters of the command you would be looking for and hit return. You can edit this command line if you want and then run it.

edit flag offensive delete link more

Comments

That's a cool feature! How can I turn this on? On my bash (no matter if gnome-terminal or tty), CTRL+p puts in the last command (as if I press arrow up). From bind -p: https://paste.fedoraproject.org/paste...

florian gravatar imageflorian ( 2018-09-14 09:50:23 -0500 )edit

The question headers said ctrl-P but the question body talks about alt-P.

More info in the man page for bash in the section called 'Commands for Manipulating the History'. The notation M-p means alt-P or Esc+P. C-p means ctrl-P.

If you are an emacs user you will feel right at home with these commands. Vi users can switch to vi-mode and use vi commands instead. set -o vi will enable vi mode.

villykruse gravatar imagevillykruse ( 2018-09-14 11:08:47 -0500 )edit
1

answered 2018-09-13 13:30:17 -0500

ptrck4193 gravatar image

updated 2018-09-13 13:31:36 -0500

For documentation, execute bind -p | grep '\\ep'.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-09-12 08:25:23 -0500

Seen: 32 times

Last updated: Sep 13