A Linux administrator spends most of his work time in the terminal. In this lecture 1
I'll show you a list of useful Bash shortcuts that every Linux admin should know if he wants to get 2
things done faster. 3
Let's get started! 4
Control and L clears the screen. 5
If there's anything on the screen, you can clear it by pressing control and L; it similar to running 6
the clear command. 7
Control and D closes the shell, it's similar to running the exit command. I am pressing control 8
and D. 9
The shell was closed; I'm opening the terminal again. 10
You can also type exit. 11
Control and A moves the cursor to the beginning of the line. 12
This is useful if we run a command on a file and then we want to run another command on the same file 13
like I'm running ls -l /etc/passwd 14
And now I want to run the cat command on the same file. 15
Instead of writing the command again, I can press up the arrow key to recall the last command and then press 16
on ctrl + A to move the cursor to the beginning of the line. 17
Now, I can simply replace ls with cat and run the new command. 18
Of course, I have to remove the -l option, which is an option of ls. 19
By the way, up arrow key retrieves the previous command; if you press it constantly, it takes you 20
through multiple commands in history so you can find the one you want. 21
Use the down arrow to move in the reverse direction through the history. 22
Another useful shortcut is control and E, which moves the cursor to the end of the line. I'm 23
pressing control and E and the cursor was moved to the end. 24
I can continue writing. 25
Another useful shortcut is control and U, which deletes all characters before the cursor by cutting 26
and adding them to the clipboard. 27
Let's consider this commeand and you want to execute another one; instead of pressing on backspace multiple 28
times, you could press control and U; control U is also useful when you type in a password 29
and after a few characters, you realize you made a mistake. 30
I have typed a few characters and I've realized I did a mistake; instead of pressing on backspace multiple 31
times, I could press control U; the entire command 32
line was deleted. 33
Let's move on and see another shortcut! To interrupt the process running in the current terminal, press 34
control and C. Let's say you run a command that takes some time in one to stop it. 35
Then you press control and 36
C. For example, I'm going to download a very big file using wget and after a few seconds I'll decide 37
that I want to stop it. 38
And I'm stopping the command pressing control and C. 39
It was stopped. 40
Or another one.! 41
Ping and the IP address; without any option ping will send packets continuously. 42
I'm stopping it by pressing on control and C. 43
It was stopped. 44
Note that control and Z does not stop the current running process as control C does, but only suspends 45
or pauses it and it can be resumed later on. 46
I am pressing on control and Z; the process was not interrupted, was just stopped; the difference being 47
that I can resume it any time later. 48
For example bg 49
%1 and the process was resumed. 50
We'll talk more about these concepts in the process section.