All right, the Bash shell also provides a couple of convenient keyboard shortcuts.
We've already seen a few of them.
Let's talk about some more.
Control-C, quit the current interactive process.
So if ever you are waiting for a command and you think, what's happening, and you don't
get your prompt back, Control-C. Control-C is the generic way to kill a command, basically.
Then there is Control-D. Control-D sends an end of file character to the current interactive
process.
I would advise, if Control-C doesn't work, use Control-D. Control-A is very convenient
because it moves the cursor to the start of the current line.
And Control-E moves it back to the end of the current line.
Control-R is doing the reverse search in history.
And Control-L clears the screen.
And then we have Control-U, which removes the current line.
Also convenient are Alt-B, which moves the cursor one word backward, or Alt-F, which
moves the cursor one word forward.
Let me do a quick demo.
So sometimes you type a command, and this command, at the end of the command, you realize
that you need something in front of it.
So let me do user add.
We haven't talked about it, but user add, Linda, would create a use for Linda.
Oh no, I forgot.
I need super user powers in order to use that command.
Well, then Control-A comes in handy, and that allows you to put sudo in front of the command.
And Control-E, if you want to put something to the end of the command as well, like minus
L slash bin slash ZSH, for instance.
I'll tell you all about that later on.
Ignore the error message for now.
Then another example is sleep infinity.
It's a magical command that's telling your system to do nothing and to do it forever.
Well, that's not very convenient.
So let me use Control-C to get out of there.
And next, let me do a sudo user add Bob.
And you know what?
That changed my mind.
I didn't want to add use Bob anyway.
So Control-U will wipe my command line.
Next, history.
As you can see, I can continue typing on the bottom of my screen.
I don't like to work on the bottom of my screen, so I'm using Control-L to clear my screen.
And that's what I wanted to show you for now for these useful keyboard shortcuts.