Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In interactive mode (in Octave, gnuplot, R, etc.) I occasionally press Control + z by mistake. This pauses the program and kicks me back to the terminal.

Is it possible to re-enter the original interactive mode (with all the stored variables)?

To reproduce:

~> octave
octave:1> a = [1:10];
octave:2> ^Z
[1]+  Stopped                 octave

How can I recover my session with the variable a defined?

share|improve this question
up vote 36 down vote accepted

type fg and hit enter in terminal.

   fg [jobspec]
          Resume jobspec in the foreground, and make
          it  the  current  job.   If jobspec is not
          present, the shell’s notion of the current
          job  is used.  The return value is that of
          the command placed into the foreground, or
          failure  if  run  when job control is dis-
          abled  or,  when  run  with  job   control
          enabled,  if  jobspec  does  not specify a
          valid job or jobspec specifies a job  that
          was started without job control.
share|improve this answer
Ace! Thanks, solved my panic – Tom Jun 14 '11 at 12:03

Type the following to pull the job to the foreground again:


This is because you suspended the job, meaning it's doing nothing while you can't see it. You can actually let a job run in the background too (by entering bg). See Job Control for more info.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .