I'm not sure you are speaking about readline though.
Another very useful thing I use daily is Alt-F/B, to move forward/backward in the line one word at a time. Control does the same, one letter at a time. D will delete an element instead.
I'm not sure you are speaking about readline though.
Another very useful thing I use daily is Alt-F/B, to move forward/backward in the line one word at a time. Control does the same, one letter at a time. D will delete an element instead.
Personal favorites are C-r to search back in history and C-x C-e to edit the current command line in an external editor.
I use "yank-last-arg" most often, which is M-. by default.
$ mkdir abcd
$ cd <M-.>
On Zsh, I have M-, bound to "copy-earlier-word", which makes M-. M-, M-, cycle through the arguments to the previous command.In reading the manpage for Bash, which doesn't have this function, I've just found "history-search-backward", which searches through history to find commands based on what you've already typed. That will come in useful!
$ bind '"\er":history-search-backward'
$ bind <M-r>
(Note that M-r is bound to "revert-line" by default, but I doubt I'll use that.)These functions are all listed, with explanations, in the Bash and Zsh manpages.
Edit: As I see from another comment, a binding for "history-search-backward" to the Page Up key is in /etc/inputrc on Debian and derivatives.
if [[ $- == *i* ]]
then
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
fi
(fix: grammar)What's the point to type a half-command and then replace input line with one from history if I press up? That somewhat resembles ugly cmd.exe, which every windows user imagines when someone says 'cli'.
This is the shortcut to first learn when starting living in the command line.
Actually, just go read http://ss64.com/bash/syntax-keyboard.html or something, once per day, integrate a new one each time, and you will improve your productivity on the command line (as well as comfort).
Nice link - reminds me to try to use the history stuff like ! and ^ more.
Ctrl-L to clear the screen except the current line is also somewhat useful if you're at the bottom of the terminal screen and editing a long command line.
Somewhat less useful but neat is Alt-U which will cause the current word under the cursor to become all upper case and Alt-C which is similar but changes the first letter to upper case and the rest of the word to lower case.