Linux background program running and recovery-general Linux technology-Linux programming and kernel information. The following is a detailed description. This article from "constantly pursuing perfection" blog, please be sure to keep this source http://hhlenglish.blog.51cto.com/151687/95604
1. Two commands running in the background & and ctr + z
At the beginning, the + "&" method is as follows: [command] space [&]
For example:
[Root @ pcmxexweb etc] # find/-name xml &
In this way, the lookup program runs in the background. It does not affect other tasks.
But sometimes I forget to add the '&' symbol after the command, and I am not willing to stop the command and rewrite it again. You can press [ctrl + z] to switch the current program to the background.
[Root @ pcmxexweb etc] # find/-name xml
/Etc/xml
/Usr/lib64/python2.4/xml
/Usr/share/vim/vim70/autoload/xml
/Usr/share/maid/data/xml
/Usr/share/java-utils/xml
/Usr/share/xml
/Usr/share/doc/libvorbis-devel-1.1.2/xml
/Usr/local/apache-tomcat-6.0.14/webapps/examples/jsp/xml
/Webapp/web/jsp/xml
[Root @ pcmxexweb etc] # find/-name xml
/Etc/xml
/Usr/lib64/python2.4/xml
/Usr/share/vim/vim70/autoload/xml
/Usr/share/maid/data/xml
/Usr/share/java-utils/xml
/Usr/share/xml
[1] + Stopped find/-name xml
However, note that the program in the background is in the Stopped state (check the last line above ).
Use jobs to view programs running in the background.
[Root @ pcmxexweb etc] # jobs
[1]-Stopped find/-name xml
[2] + Stopped vi/etc/hosts
You can use the command bg 2. The effect is the same as that of using find/-name xml & at the beginning, so that this command runs in the background.
2. Transfer the background program back to the foreground
According to jobs, the corresponding program is redeployed back to the front-end by using fg 2.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.