How to run a process in background or bring to foreground in Linux

Running a process in background

What if you a script which takes more than 24 hours to run so in those cases it is not a good idea to run them on putty as in any case of connection failure your putty would stop working making you run the script again. In those cases you can run the process on background manually as shown below
For example:
Run the firefox using below parameter

# firefox & 

As you can see the firefox opened up on the background without occupying your terminal in the background.

Running a process in foreground

In this case the terminal used for running the process will be locked and as soon as you close the terminal your running process would be terminated. This can be seen  mostly when you are running a very time taking script on a terminal.
For example:
Try running firefox from your terminal without using any extra parameter

# firefox

Now as you see your terminal is locked and unless you close the firefox browser you won't be use that terminal. It means your process is running on foreground.
You can bring the process back to forground using the below cmd

# fg firefox