fg (Foreground)

fg stands for foreground

If you hit the Ctl-Z key (see #7), your process went into “the background.” What does that mean, exactly? It means your process is still running, with a process ID number that can be examined with ps (see #5) and seen running in the background, on one of many threads, operating on your computer system.

To get it back, that is, to go back to the state where your shell prompt had the Rails app running, use fg, or foreground.

Essentially, your shell will keep a stack (first-in-last-out) of processes which have been backgrounded. You use fg to move them back to the foreground of your shell prompt (for example, if you want to exit them without using kill.)