杀死所有独立的屏幕会话
问题描述:
当我执行screen -ls
时,会看到以下内容.如何杀死所有独立的会话?
When I execute screen -ls
, I see the following. How can I kill all the detached sessions?
有以下屏幕:
There are screens on:
84918.ttys002.ros-mbp (Detached)
84944.ttys008.ros-mbp (Detached)
84970.ttys013.ros-mbp (Attached)
84998.ttys002.ros-mbp (Detached)
85024.ttys002.ros-mbp (Detached)
/var/folders/86/062qtcyx2rxbnmn8mtpkyghs0r0r_z/T/.screen中的5个套接字.
5 Sockets in /var/folders/86/062qtcyx2rxbnmn8mtpkyghs0r0r_z/T/.screen.
答
screen -ls | grep pts | cut -d. -f1 | awk '{print $1}' | xargs kill
杀死仅已分离屏幕会话(信用@schatten):
Kill only Detached screen sessions (credit @schatten):
screen -ls | grep Detached | cut -d. -f1 | awk '{print $1}' | xargs kill