Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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

2 Answers 2

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
1  
@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
    
@houbysoft you can't have it both ways, either you get asked every time or not at all. Remembering to run cat in another tab in cases you don't to accidentally close is even more cumbersome. –  patrix Jun 26 '12 at 20:13
1  
@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
show 3 more comments
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
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.