Switch between the front and back ends of a Linux task

Source: Internet
Author: User
The switch Shell in the front and back of a Linux task Supports Role control. you can use the following commands to switch between the front and back ends: 1. command & amp; let the process run 2.jobs in the background view the process running in the background 3.fg% n let the process running in the background n to the foreground 4.bg% n let the process n... the switch Shell in the front and back of a Linux task Supports Role control. you can use the following commands to switch between the front and back ends: 1. command & let the process run in the background 2. jobs: view the processes running in the background. 3. fg % n let the background running process n to the foreground 4. bg % n let process n go to the background; PS: "n" indicates the job number viewed by the jobs command, not the process number. fg, bg, jobs, &, ctrl + z are all related to system tasks. although these commands are rarely used, they are also very practical. 1. & This command is most often used at the end of a command. you can run this command in the background. 2. run ctrl + z to run a command in the foreground on the background, and pause 3. jobs View the number of commands currently running in the background. 4. fg transfers the command in the background to the foreground to continue running. if there are multiple commands in the background, you can use fg % jobnumber to call up the selected command, % jobnumber is the serial number (not pid) of the command being executed in the background found through the jobs command ). 5. bg changes a command paused in the background to continue execution. if there are multiple commands in the background, you can use bg % jobnumber to call up the selected command, % jobnumber is the serial number (not pid) of the command being executed in the background found through the jobs command ). Example: If you find that a program running on the front end takes a long time, but you need to do other things, you can use Ctrl-Z to terminate the program, and then you can see the system prompt: [1] + Stopped/root/bin/rsync. sh if this prompt is not displayed, run the jobs command to view the task: # jobs [1] + suincluded/root/bin/rsync. sh & then we can schedule the program to the background for execution: (the number following bg is the job number) # bg 1 [1] +/root/bin/rsync. sh & run the jobs command to view the Running tasks: # jobs [1] + Running/root/bin/rsync. sh & if you want to call it back to the foreground, use # fg 1/root/bin/rsync. sh. in this way, you can only wait for the task to be completed on the console.
Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.