Linux Basics

54 / 87
Interacting with processes

You can see the list of jobs by using the command:

    jobs

The number that you see in square brackets [] is the job id. This is different from process id. To bring a process to foreground, you can use

    fg %jobid

or simply

    fg jobid

Question-

If jobs command lists following:

        [1]-  Stopped         tail -f mycmd.sh
        [2]+  Stopped         top
        [3]   Running         sleep 1000 &

Which command will bring the "top" to the foreground?

  • fg 2 or fg %2
  • fg [2]
  • fg %[2]
  • It is not possible to bring "top" command to foreground.