When using the command shell or terminal in Linux, there are several keyboard shortcuts available to you that perform common functions. Many of these shortcuts are common across many of the different shells, such as bash, csh, ksh or fish. That means you do not have to remember different commands for different shells.
We will see some common keyboard shortcuts or signals that allow you to control processes from the shell. These keyboard shortcuts are actually sending Unix Signals to running processes or thread to notify of an event. There are several different ways to send signals to processes and these are just one way.
In short, Signals are a way of sending notifications to processes and keyboard shortcuts send specific signals to (child) processes with in the shell.
You can use Ctrl+C to kill and exit the currently running process in the shell. This is extremely useful when you need to kill a process because it is misbehaving or is taking too long to complete.
Ctrl+C essentially sends a SIGINT signal from the controlling terminal to the process, causing it to be killed. It is equivalent to using the kill command (or system call) with the process id.
Closely related to Ctrl+C is the Ctrl+\ shortcut. It basically sends the SIGQUIT signal which will the process to terminate and dump core. This is useful when the process or program is misbehaving and you want to find out why. The core dump file can be used to debug the program.
Sometimes you just want to suspend the process and not kill it. Suspending the process will allow you to resume the process at a later time. The keyboard shortcut Ctrl+Z sends the SIGTSTP signal to the process which causes it to suspend its processing or execution for the time being.
You can resume the process later by using the fg command.
The Ctrl+T shortcut is not widely available across all shells or terminals. This is essentially to print out detailed information about the executing process. It is equivalent to the SIGINFO signal being send to the process.
This shortcut works as a way to close the currently executing shell, and logout the user. It sends an EOF marker to the shell, and it will exit the current shell. This is more of a graceful exit to shell or the process compared to the Ctrl+C mentioned above.
If you have logged in as another user or started another child shell from with in the shell, then it will lose the child shell and exit to the parent shell. This is useful when using su to login as super user or another user.
This is an useful shortcut that allows you to clear the screen with out interrupting the executing process. It can be handy when you have multiple processes running on the same terminal spewing out messages to the same stdout.
It leaves the current line at the top of the screen and clears out the rest of it. If you are running a program like vi, then it will clear the screen and redraw the output of the program afresh.
Hitting Tab key while entering command will auto-complete the command or will print out all the available options. Of course, you will need the auto-completion feature enabled for the shell. It is usually enabled by default for most modern shell such as bash or fish. You enter the first few characters of the command and the rest can auto-completed by hitting the Tab key.
Depending on the shell that you are using, you have access to several more shortcuts. Some of them are specific to the shell, while some are rarely needed or used. The above seven shortcuts should be enough for most daily operations and it is the first step towards mastering the command shell in Linux.