How do you learn all this. Even the man page is liken to an epic novel.
As the saying goes:
"Necessity is the mother of all invention"
I've been using Linux for many years - and I've always learnt things as and when I've needed to. And I'm continuing to learn. I'm always learning new things.
Any time I have a problem, or want to know how to be able to do something new - I've always looked to the documentation.
Now, I know telling people to RTFM is a bit of a cliche, but seriously:
There is a LOT of information in the man and info pages. Reading through it can be time well spent. And if you don't want to read the entire manual - you could always just search for parts of the manual that you are interested in using the search command.
In the man-page viewer, you can press / and enter a regex to search for specific text.
If the documentation is incomplete, or unclear - I will look to the internet for answers. And 99% of the time I manage to find an existing solution without having to post a question myself.
Sometimes it takes a bit of time to find exactly what I need, so a bit of patience and persistence is required. But to me - it's worth it!
Interesting enough, you seem to like vi and emacs over nano. For sake of argument. Can you edit Bashrc with nano and achieve same result?
To clear up any misunderstanding that you may have:
My original post has nothing to do with the systems default text editor, or anybody's preferred editor - it is purely about the default shortcut keys available in Bash via GNU readline - which depends on which input-style readline is set-up to use (emacs or vi).
GNU readline is a command-line utility which is used by various command-line tools to get input from users. This includes shells like bash.
So when you are typing commands in bash - whether you know it or not, you are using readline. And whilst editing commands in bash you can use emacs or vi style keyboard shortcuts. Again, the default for readline is emacs, so whether you knew it or not - in Bash, you've had emacs style keyboard shortcuts available to you the whole time. Even if you haven't been using them - they are there.
When you are using nano (or whatever your favourite command line text editor is) you are using nanos keyboard shortcuts. But when typing commands in Bash, depending on how readline is set up, you will either be using emacs style keyboard shortcuts, or vi-style shortcuts.
In my original post, I was pointing out that Robs suggestion to use "ctrl + l" to clear the screen in the terminal only works "out of the box" if your shell has readline set to its default 'emacs' input mode.
Personally, I'm a vim user - so I quite like using the vi input mode for readline.
If readline is set to use the vi input mode, you have to press <esc> - to switch from vi-insert mode to vi-command mode and then press "ctrl +l" to clear the screen. And it's a little clunky, having to press <esc> and then "ctrl+l".
So for the benefit of other users who use readlines vi option - I demonstrated how to set up a custom keybind for readlines vi-insert mode, which would allow "ctrl+l" to be used to clear the screen whilst editing a command (without having to press <esc> first).
You can edit .bashrc with ANY text editor you like. But the edits specified in my post will only set up a new key-bind for readlines vi-input mode.
Readline doesn't have a nano input mode. It only has emacs or vim input modes. But if you really wanted to, you could create custom keybinds for any of readlines emacs or vi input modes, that will mimic keybinds/functionality from nano or any other editor.
But, many of nano's keyboard shortcuts are similar to the emacs shortcuts anyway.
ctrl+n = next line,
ctrl+p = previous line,
ctrl+f = next character,
ctrl+b = previous character
So for a nano user, the emacs input method for readline would probably meet most, if not all of your needs anyway!
I hope I explained all of that clearly enough.
If you have any further questions, fire away!
Here is the list of the default keyboard shortcuts for Bash - including the emacs-style "cursor movement" and "editing" keybinds:
Switching to the vi mode would change all of the keybinds in the "cursor movement" and "editing" sections to be more vi-like. The other commands (history, process control etc) are mostly the same.
Here are the default keybinds for vi-mode: