Ask Different is a question and answer site for power users of Apple hardware and software. 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

Sometimes I'm working on something in the terminal, and then go away. When I come back, I want to resume what I was working on, but sometimes I forget, and hit command-Q, which closes all the terminal windows automatically, no questions asked.

Is there a command that can "hold" a Terminal tab so that I don't accidentally close what I was doing?

As an example, what I want can be hackishly accomplished by running sleep LARGE_NUMBER in the tab I want to keep open.

Then if I accidentally hit command-Q, it won't close directly, and rather present me with the following, which gives me an opportunity to cancel and resume what I was doing:

share|improve this question

There's an option to show a dialog before closing any tab in the preferences:

enter image description here

Translating the screenshot to english is left as an exercise to the reader.

share|improve this answer
Right, but most of the time I don't want it to ask... Although I guess this could work for some. – houbysoft Jun 26 '12 at 20:02
@patrix , you are my hero :) Not all answers have to be so serious. – ephsmith Jun 26 '12 at 20:03
@houbysoft, this is probably your best approach. A gentle confirmation dialog isn't that bad given your propensity toward command-q. – ephsmith Jun 26 '12 at 20:06
@patrix I'm tempted to revert the answer so the website isn't quite so monoglot and humourless. – CajunLuke Jun 26 '12 at 20:17
:-) I changed it back due to popular demand... – patrix Jun 27 '12 at 18:27
up vote 1 down vote accepted

This can be solved by running cat, which will make it wait for input forever.

For faster usage, an alias can be defined in ~/.bashrc:

alias h="cat"
share|improve this answer
Runnin top should also work. – lhf Jun 26 '12 at 20:22

Your Answer


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.