赞
踩
Screen被称之为一个全屏窗口管理器,可以轻松在一个物理终端上获得多个虚拟终端的效果。你能够使用一个单一的终端窗口运行多终端的应用。Screen中有会话的概念,用户可以在一个screen会话中创建多个screen窗口,在每一个screen窗口中就像操作一个真实的telnet/SSH连接窗口那样。即使SSH远程连接被中断,你可以通过命令恢复该会话。
screen 下载网址 http://ftp.gnu.org/gnu/screen/
ncurses 下载网址 http://ftp.gnu.org/gnu/ncurses/
查看网上教程,安装screen可能会出错,需要安装ncurses软件,因此我直接先安装ncurses,后安装screen.
tar -zxvf ncurse-6.3.tar.gz
tar -zxvf screen-4.9.0.tar.gz
进入目录 cd ncurse-6.3
创建build文件夹 mkdir build && cd build
配置环境 ../configure
编译 sudo make
安装 sudo make install
如果安装报错权限不够,将build下文件权限都改为777 chmod 777 ./*
再次安装
同上,直接跳到配置环境这一步,发现没有configure文件,怎么办?
查找文件中有没有README 或者INSTALL 文件,这些文件是用来提供帮助文档使用,包括软件使用命令文档、安装文档
使用cat INSTALL
查看安装教程
可以发现,运行autogen.sh 可以生成configure文件,之后的安装过程与necurses一样。
安装完成后,查看
screen手册:http://www.gnu.org/software/screen/manual/screen.html
@dell-PowerEdge-R940xa:~$ screen --help Use: screen [-opts] [cmd [args]] or: screen -r [host.tty] Options: -a Force all capabilities into each window's termcap. -A -[r|R] Adapt all windows to the new display width & height. -c file Read configuration file instead of '.screenrc'. -d (-r) Detach the elsewhere running screen (and reattach here). 断开当前会话 -dmS name Start as daemon: Screen session in detached mode. -D (-r) Detach and logout remote (and reattach here). -D -RR Do whatever is needed to get a screen session. -e xy Change command characters. -f Flow control on, -fn = off, -fa = auto. -h lines Set the size of the scrollback history buffer. -i Interrupt output sooner when flow control is on. -l Login mode on (update /var/run/utmp), -ln = off. -ls [match] or -list Do nothing, just list our SockDir [on possible matches]. 查看所有会话 -L Turn on output logging. -Logfile file Set logfile name. -m ignore $STY variable, do create a new screen session. -O Choose optimal output rather than exact vt100 emulation. -p window Preselect the named window if it exists. -q Quiet startup. Exits with non-zero return code if unsuccessful. -Q Commands will send the response to the stdout of the querying process. -r [session] Reattach to a detached screen process.重新连接断开的会话 -R Reattach if possible, otherwise start a new session. -s shell Shell to execute rather than $SHELL. -S sockname Name this session <pid>.sockname instead of <pid>.<tty>.<host>. 为新创建的会话命名,取代默认名称 -t title Set title. (window's name). 设置窗口名称 -T term Use term as $TERM for windows, rather than "screen". -U Tell screen to use UTF-8 encoding. -v Print "Screen version 4.09.00 (GNU) 30-Jan-22". -wipe [match] Do nothing, just clean up SockDir [on possible matches]. -x Attach to a not detached screen. (Multi display mode). -X Execute <cmd> as a screen command in the specified session.
screen 默认命令,默认命名复杂
screen -S session_name 创建一个自己命名的会话,不会检测同名会话,也就是可能创建同名会话
screen -R session_name 创建一个自己命名的会话,检查有没有同名会话已经创建,若有,则进入该回话
screen -ls 查看所有会话
screen -r 恢复会话
exit 清除会话(进入会话后)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。