In this article, we cover Ctrl + z in Linux. The keyboard shortcut is used to stop currently running jobs. While working on something, we may choose to stop it temporarily. And, resume working on it later.
It can be done through the keyboard shortcut Ctrl + z. What it does is, it stops the process/job and sends it to the background. This ensures that we can start with a new job.
Understand it with the help of an example. Open a terminal and issue the following command:
vim is a text editor and we work on a new file test. It opens the file for us. But, in between, our system notifies us about a security update. And, we choose to install it first. So, instead of saving the file now. We use the keyboard shortcut Ctrl + z.
This returns with:
1]+ Stopped vim test
We can list all the stopped jobs through the following command:
Now, the jobs can’t stay in the background forever. We need to bring them to the foreground. We consider here that there are two or more than two stopped jobs in the background. So, we need to select which should be given the priority.
To bring a process to the foreground, use the syntax:
We can get the job_ID through the jobs -l command. If we wish to bring process 2 to the foreground then,
If there is just one process that is there in the background, then just use:
In conclusion, we have covered here how to use Ctrl + z in Linux.