Last month was mention about the Linux Processes on PIDs , parent and child processes and using the ps command. In this part 2, let see how the background and foreground background process work.
Background and foreground processes
An interactive process can run in the foreground or background. To place a process in the background, you use the command bg or the ampersand symbol (&). This lets you do other jobs while waiting for the command to finish. Let’s say you use the syntax
$ find / filename 2 > /dev/null | grep filename | tee result
A command using this syntax could take a long time to execute, especially if you have a lot of files and are listing several network drives. Only one job at a time can run in the foreground, so no further commands can be issued until the prompt returns. To continue working on the command line while it processes, you can execute the same command in the background, using the ampersand. For example, you could enter the command using the following syntax:
$ find / filename 2 > /dev/null | grep filename | >result &
After the command has been issued, the shell displays a message, which looks similar to the following: (more…)














































My name is Calvyn, from PENANG, an IT Engineer, Malaysia LIFE tech blogger. I am an IT Engineer who blog about my LIFE working Experience, such as Technology, Computing, Networking and also my hobbies, Photography.