Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I connected to my server:

$ ssh me@example.com

While in the server, I open a dtach session with vim:

$ dtach -c \tmp\my-dtach-session-pipe vim

Then my ssh session dies. I attempt to go back to my session:

$ ssh me@example.com
$ dtach -a \tmp\my-dtach-session-pipe

I do not get vim, but instead just a blinking cursor. I cannot do anything from there, not even ctrl+c, I can only detach the dtach with ctrl+\.

How can I get my dtach session back properly? Or am I missing the idea of how dtach is supposed to behave?

N.B. I am well aware of the tmux and screen utilities.

share|improve this question
1  
1. Why are you using backslash? 2. Why are you use dtatch instead of (arguably wider known and easier to use) screen or tmux? 3. Wouldn't it be better to open shell session inside the dtach session in which there would be vim session? Sometimes full-screen applications gets confused by changing screen size and suspend (<kbd>C-z</kbd>) and resume (fg) fix it. –  Maciej Piechotka Jan 19 '11 at 17:44
    
I use tmux. I would like to learn dtach so that I can learn it and use it in combination with dvtm. –  kzh Jan 19 '11 at 17:56
    
@Gilles thanks for adding the dtach tag. I would have if I had enough rep. –  kzh Jan 20 '11 at 4:04
add comment

2 Answers 2

up vote 2 down vote accepted

I think you can prevent this by passing a WINCH signal to dtach:

dtach -c /tmp/my-dtach-session-pipe -r winch vim

Or at reattachment:

dtach -a /tmp/my-dtach-session-pipe -r winch
share|improve this answer
    
I tried dtach -a dtach-pipe -r winch and that did not seem to re-attach my vim session, either, but if I use the -r winch option on creation (-c), it does work. Now the question is, if I forget to use -r winch can I get my dtach session back? –  kzh Jan 19 '11 at 21:38
add comment

Perhaps you did get what you want, but you need to redraw the screen? Try pressing CTRL + L.

share|improve this answer
    
Incidentally, how do I make ctrl+L look like a keyboard button? –  bahamat Jan 19 '11 at 20:07
    
<kbd> element will give you the cool button thing, but not on comments. On another note, I had already tried ctrl+L, but it did not work, but you still get a +1 for a great suggestion. –  kzh Jan 19 '11 at 20:09
    
Bummer, I was hoping that was it ;-) –  bahamat Jan 20 '11 at 2:18
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.