Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Sat Oct 22, 2011 8:24 pm 
Offline

Joined: Sat Oct 22, 2011 8:15 pm
Posts: 1
Hello guys,

in order to make sure my server will be still running after I leave ssh, I have to use screen.

I type screen and hti ctrl + A C to create a new screen window.

And I run my server and use ctrl+A d to detach

Things work fine, but I don't know how to kill a window.

I use screen -r xxxxx to reattach to that window and hit ctrl+A K

I thought I killed that window, but when I use screen -ls, I can still see it there, it says that window is detached.

but when I use screen -r xxx to reconnect to that window, I saw error:

there is no screen to be resumed.

So basically, I can create a new window, but I cannot kill a window, so my windows are getting more and more.



How am I suppose to kill a screen window?


Top
   
 Post subject:
PostPosted: Sat Oct 22, 2011 9:01 pm 
Offline
Senior Member
User avatar

Joined: Thu Jun 16, 2011 8:24 am
Posts: 412
Location: Cyberspace
When you're in a screen window, you can exit (and close) that window by typing "exit" (no quotes).

To clean up dead screen windows, use "screen -wipe" (no quotes). That should clean out any windows that were killed but are still open.

_________________
Kris the Piki Geeker


Top
   
 Post subject:
PostPosted: Sat Oct 22, 2011 11:07 pm 
Offline
Senior Member

Joined: Mon Dec 20, 2010 11:37 pm
Posts: 76
I use what Piki says.
Also, if you have only one screen detached, you can reattach with "screen -r" (without xxxx). Faster.


Top
   
 Post subject:
PostPosted: Sun Oct 23, 2011 9:23 am 
Offline
Senior Member
User avatar

Joined: Tue Apr 13, 2004 6:54 pm
Posts: 833
Appears to be some terminology confusion, which might explain things.

You can think of screen as a "window manager". You can open many windows open in one instance of screen. When you do ctrl-a c then you open a new window, when you do ctrl-a K then you close a window. (NOTE: exiting the shell you open in the window will also close the window). You can see what windows you have open with ctrl-a w. For example, I have these windows open
Code:
0 spam  1 news  2 ksh  3* ksh  4- ksh  5 ksh  6 daffy  

Closing a window does not stop the screen session; screen will die automatically when the last window it manages closes.

Now you can also have multiple instances of screen running at the same time. This is what you see when you run "screen -ls"; all the different screen instances.

From here you can see that ctrl-a K will not close screen down, unless you kill the last window inside a screen session.

So, if you have a number of detached screen sessions on the machine you can attach to one of them ("screen -r") and then see the windows it manages (ctrl-a w). You can then switch between the windows (ctrl-a 0 through ctrl-a 9) and close each window. When you close the last window then that screen instance will shutdown. You can then move onto the next detached session (if any) and tidy that up.

Finally, screen can get confused (normally this is due to a reboot or crash or bug) and leave things behind that it lists as detached, but without any screen session running. That can lead to the "no session" errors. These can be cleaned up, as others have mentioned, with the "-wipe" option.

_________________
Rgds
Stephen
(Linux user since kernel version 0.11)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group