When you open vim with enthusiasm and start writing code. Operation mm ran over breathlessly: "Hurry up and run a xx data for me, I will use it for the meeting tomorrow." But I didn't want to close vim, and I couldn't open a new tty under some systems. What to do, can it only be
![](/images/smiles/icon_sad.gif)
![](http://dl2.iteye.com/upload/attachment/0122/4335/82451d91-d6da-3a00-a649-cc717307abeb.png)
2 To suspend a job
, you can use the ctrl+z shortcut to suspend the editing task in the background, and the terminal displays the status of that task as stopped or stopped. In this way, you can help the operation MM run the data,
![](/images/smiles/icon_biggrin.gif)
![](http://dl2.iteye.com/upload/attachment/0122/4337/fe547261-b53e-3a9c-8f03-3ccfa856b113.png)
3 Put the job to run in the background
or you will encounter such a situation. When running a very time-consuming task, the operation mm comes again, "Help me run a copy of xx data, which will be used for the meeting in the afternoon." Don't worry, you can use this:&. When executing a command, append & to make your job run in the background. View the cp task through the jobs command, and the task status is running.
![](http://dl2.iteye.com/upload/attachment/0122/4339/a0ed7da6-cced-3d76-a5c0-2f1b4f3d5312.png)
4 Return the job to the front desk The
operation mm has finally left, what should you do if you want to continue working? You can execute the fg command to bring a task suspended in the background back to the foreground. The job with + sign is taken out by default. If you want to take out the job with - sign, you can do this: fg %1 (1 is the number of the job).
![](http://dl2.iteye.com/upload/attachment/0122/4341/ecf9f9e7-eb36-381f-b90e-e084c00cf119.png)
5 Change the status of the job running in the background
When you use ctrl+z to suspend the task, but you don't want it to be idle, what should you do? You can use the bg command to change the running status of the job. The task will become Running or Running, followed by an ampersand.
![](http://dl2.iteye.com/upload/attachment/0122/4343/94dceea5-0579-3e6e-afb6-c41ba023cc26.png)
6 Killing a job
If there are many tasks suspended or running in the background, and you want to close some tasks, you can execute kill -9 %jobnumber.
![](http://dl2.iteye.com/upload/attachment/0122/4345/fece3cfb-a875-3d80-8238-3c579dd28864.png)
Write these first, and collect them if you like.