We all know the bg and fg commands in Linux. On Windows, we either have a program running in the background as a service or stop the service. The program cannot be switched between the foreground and background. Linux provides fg and bg commands, allowing us to easily schedule running tasks. Www.2cto.com suppose you find it takes a long time to run a program on the foreground, but you need to do other things, you can use Ctrl-Z to suspend the program, then you can see the system prompt (job number in square brackets): [1] + Stopped/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. Fg, bg, jobs, &, ctrl + z are all related to system tasks. Although these commands are rarely used at present, they are also very practical. & This command is most often used at the end of a command. You can put this command in the background for execution 2. Ctrl + z can put a command that is being executed on the front-end to the background, and pause the three. Jobs: view the number of currently running commands in the background. Fg transfers the commands 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) 5 of the command being executed in the background found through the jobs command. Bg pauses a command in the background and continues execution. If there are multiple commands in the background, you can call out the selected command with bg % jobnumber, % jobnumber is the serial number (not pid) of the command being executed in the background found through the jobs command)