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.

I have been working in different screen sessions in past projects , hence have a few screen sessions accumulated. Now i have been asked to remove excess/unrequired screen sessions from the unix box.

one of the method that came to my mind is to delete the folder where screens are kept in the /tmp/mylogin/screen-r/... folder , but am not sure iff that would leave any unintentional process or something passive on the server

any idea how can i remove them without leaving any unknown dangling things around in the server ?

also i wanted to ask do these detached screens occupy quite a bit of resource , enough to alert the sys admin ie any issue with having a few unused/detached screen sessions around ?

PS : none of them are dead sessions , status is detached not dead. the OS is solaris

share|improve this question
1  
Have you considered attaching them, and exiting...? or are you asking for a fast way to kill them all? –  demure Jun 3 '13 at 23:58
2  
sounds like this is the same question stackoverflow.com/questions/1509677/… –  Hans Meiser Jun 4 '13 at 0:01
    
@demure i dont use them now , i made a new one for each project and now have quite a few .......... just thinking of ways to get rid of them or at least reduce them!! –  nsd Jun 4 '13 at 1:09
    
@HansMeiser ....... thanks , i did search for it , but didnt find anything here. I didnt look in SO. Any way to close this question or should i just delete this ? –  nsd Jun 4 '13 at 1:12
    
@HansMeiser to be fair, that one should probably have been migrated to SU... –  Kruug Jun 4 '13 at 17:54
add comment

1 Answer

How about something like this:

screen -ls | awk -F. '$NF~"(Attached)" {print "kill -HUP " $1}' | sh

Leave out the | sh if you want to see what it's going to execute.

It seems to work fine in a quick test I did.

share|improve this answer
    
Thanks , +1 for the answer . –  nsd Jun 4 '13 at 19:05
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.