screen ÊÇÒ»¸ö·Ç³£ÓÐÓõÄÃüÁÌṩ´Óµ¥¸ö SSH »á»°ÖÐʹÓöà¸ö shell ´°¿Ú£¨»á»°£©µÄÄÜÁ¦¡£µ±»á»°±»·ÖÀë»òÍøÂçÖжÏʱ£¬screen »á»°ÖÐÆô¶¯µÄ½ø³ÌÈÔ½«ÔËÐУ¬Äã¿ÉÒÔËæʱÖØÐÂÁ¬½Óµ½ screen »á»°
screen ÃüÁîʹÓÃscreen ÃüÁîʹÓÃ
screen ÊÇÒ»¸ö·Ç³£ÓÐÓõÄÃüÁÌṩ´Óµ¥¸ö SSH »á»°ÖÐʹÓöà¸ö shell ´°¿Ú£¨»á»°£©µÄÄÜÁ¦¡£µ±»á»°±»·ÖÀë»òÍøÂçÖжÏʱ£¬screen »á»°ÖÐÆô¶¯µÄ½ø³ÌÈÔ½«ÔËÐУ¬Äã¿ÉÒÔËæʱÖØÐÂÁ¬½Óµ½ screen »á»°¡£Èç¹ûÄãÏëÔËÐÐÒ»¸ö³Ö¾ÃµÄ½ø³Ì»òÕß´Ó¶à¸öλÖÃÁ¬½Óµ½ shell »á»°£¬ÕâÒ²ºÜ·½±ã¡£
ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«Õ¹Ê¾ÔÚ Linux ÉÏ°²×°ºÍʹÓà screen µÄ»ù±¾ÖªÊ¶¡£
ÈçºÎ°²×° screen
screen
ÔÚһЩÁ÷Ðеķ¢ÐаæÉÏÒѾԤ°²×°ÁË¡£Äã¿ÉÒÔʹÓÃÏÂÃæµÄÃüÁî¼ì²éÊÇ·ñÒѾÔÚÄãµÄ·þÎñÆ÷ÉÏ°²×°ÁË¡£
screen -v
Screen version 4.00.03 (FAU)
Èç¹ûÔÚ Linux Öл¹Ã»ÓÐscreen £¬Äã¿ÉÒÔʹÓÃϵͳÌṩµÄ°ü¹ÜÀíÆ÷ºÜ¼òµ¥µØ°²×°Ëü¡£
CentOS/RedHat/Fedora
yum -y install screen
Ubuntu/Debian
apt-get -y install screen
ÈçºÎÆô¶¯Ò»¸ö screen »á»°
Äã¿ÉÒÔÔÚÃüÁîÐÐÖÐÊäÈë screen À´Æô¶¯Ëü£¬½Ó×Å»áÓÐÒ»¸ö¿´ÉÏÈ¥ºÍÃüÁîÐÐÌáʾ·ûÒ»ÑùµÄ screen »á»°Æô¶¯¡£
screen
ʹÓÃÃèÊöÐÔÃû³ÆÆô¶¯ÆÁÄ»»á»°ÊÇÒ»¸öºÜºÃµÄ×ö·¨£¬ÕâÑùÄã¿ÉÒÔÇáËɵؼÇס»á»°ÖÐÕýÔÚÔËÐеĽø³Ì¡£ÒªÊ¹ÓûỰÃû³Æ´´½¨Ð»Ự£¬ÇëÔËÐÐÒÔÏÂÃüÁ
screen -S name
½« ¡°name¡± Ì滻Ϊ¶ÔÄã»á»°ÓÐÒâÒåµÄÃû×Ö¡£
´Ó screen »á»°ÖзÖÀë
Òª´Óµ±Ç°µÄ screen »á»°ÖзÖÀ룬Äã¿ÉÒÔ°´ÏÂCtrl-A ºÍ d¡£ËùÓÐµÄ screen »á»°ÈÔ½«ÊÇ»îÔ¾µÄ£¬ÄãÖ®ºó¿ÉÒÔËæʱÖØÐÂÁ¬½Ó¡£
ÖØÐÂÁ¬½Óµ½ screen »á»°
Èç¹ûÄã´ÓÒ»¸ö»á»°·ÖÀ룬»òÕßÓÉÓÚijЩÔÒòÄãµÄÁ¬½Ó±»ÖжÏÁË£¬Äã¿ÉÒÔʹÓÃÏÂÃæµÄÃüÁîÖØÐÂÁ¬½Ó£º
screen -r
Èç¹ûÄãÓжà¸ö screen »á»°£¬Äã¿ÉÒÔÓà ls ²ÎÊýÁгöËüÃÇ¡£
screen -ls
There are screens on:
7880.session (Detached)
7934.session2 (Detached)
7907.session1 (Detached)
3 Sockets in /var/run/screen/S-root.
ÔÚÎÒÃǵÄÀý×ÓÖУ¬ÎÒÃÇÓÐÈý¸ö»îÔ¾µÄ screen »á»°¡£Òò´Ë£¬Èç¹ûÄãÏëÒª»¹Ô ¡°session2¡± »á»°£¬Äã¿ÉÒÔÖ´ÐУº
screen -r 7934
»òÕßʹÓà screen Ãû³Æ¡£
screen -r -S session2
ÖÐÖ¹ screen »á»°
Óм¸ÖÖ·½·¨À´ÖÐÖ¹ screen »á»°¡£Äã¿ÉÒÔ°´Ï Ctrl+d £¬»òÕßÔÚÃüÁîÐÐÖÐʹÓà exit ÃüÁî¡£
Òª²é¿´screenÃüÁîËùÓÐÓÐÓõŦÄÜ£¬Äã¿ÉÒԲ鿴 screen µÄ man Êֲᡣ
man screen
NAME
screen - screen manager with VT100/ANSI terminal emulation
SYNOPSIS
screen [ -options ] [ cmd [ args ] ]
screen -r [[pid.]tty[.host]]
screen -r sessionowner/[[pid.]tty[.host]]
˳±ã˵һÏ£¬Èç¹ûÄãϲ»¶ÕâƪÎÄÕ£¬ÇëÔÚÉç½»ÍøÂçÉÏÓëÄãµÄÅóÓÑ·ÖÏí£¬»òÕßÔÚÆÀÂÛÇøÁôÏÂÆÀÂÛ¡£Ð»Ð»¡£
±¾ÎÄתÔØ×Ô£ºhttp://www.linuxprobe.com/screen-example.html
Ãâ·ÑÌṩ×îÐÂLinux¼¼Êõ½Ì³ÌÊé¼®£¬Îª¿ªÔ´¼¼Êõ°®ºÃÕßŬÁ¦×öµÃ¸ü¶à¸üºÃ£¬¿ªÔ´Õ¾µã£ºhttp://www.linuxprobe.com/
Сº¢Ò»¸ö ÓÚ 2017-09-07 13:05:19·¢±í:
Â¥Ö÷ÐÁ¿àÁË£¬Ð»Ð»
Ronny ÓÚ 2017-09-06 17:33:21·¢±í:
screen ÃüÁîʹÓã¡À÷º¦