Restarting a stopped process

This procedure describes how to restart a process that has been stopped with a Ctrl-Z.

Note: Ctrl-Z works in the Korn shell (ksh) and C shell (csh), but not in the Bourne shell (bsh). To restart a stopped process, you must either be the user who started the process or have root user authority.
  1. To show all the processes running or stopped but not those killed on your system, type the following:
    ps -ef
    You might want to pipe this command through a grep command to restrict the list to those processes most likely to be the one you want to restart. For example, if you want to restart a vi session, you could type the following:
    ps -ef | grep vi
    This command would display only those lines from the ps command output that contained the word vi. The output would look something like this:
    UID    PID   PPID   C      STIME       TTY  TIME  COMMAND
    root   1234  13682  0      00:59:53    -    0:01  vi test
    root  14277  13682  1      01:00:34    -    0:00  grep vi
  2. In the ps command output, find the process you want to restart and note its PID number. In the example, the PID is 1234.
  3. To send the CONTINUE signal to the stopped process, type the following:
    kill -19 1234
    Substitute the PID of your process for the 1234. The -19 indicates the CONTINUE signal. This command restarts the process in the background. If the process can run in the background, you are finished with the procedure. If the process must run in the foreground (as a vi session would), you must proceed with the next step.
  4. To bring the process in to the foreground, type the following:
    fg 1234
    Once again, substitute the PID of your process for the 1234. Your process should now be running in the foreground. (You are now in your vi edit session).