Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

up vote 17 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
add comment

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

fg

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.