• 要找福利?记不住网址?搜不到?如何与我们保持联系?试试 CTRL+D 把零点博客添加进您的浏览器收藏夹,一键直达永不失联!

系统管理-Linux screen命令

linux系统 涛涛 137次浏览 0个评论

Linux screen命令

Linux 命令大全 Linux 命令大全

Linux screen命令用于多重视窗管理程序。

screen为多重视窗管理程序。此处所谓的视窗,是指一个全屏幕的文字模式画面。通常只有在使用telnet登入主机或是使用老式的终端机时,才有可能用到screen程序。

语法

<span class="pln">screen </span><span class="pun">[-</span><span class="typ">AmRvx</span> <span class="pun">-</span><span class="pln">ls </span><span class="pun">-</span><span class="pln">wipe</span><span class="pun">][-</span><span class="pln">d </span><span class="pun"><作业名称>][-</span><span class="pln">h </span><span class="pun"><行数>][-</span><span class="pln">r </span><span class="pun"><作业名称>][-</span><span class="pln">s </span><span class="str"><shell></span><span class="pun">][-</span><span class="pln">S </span><span class="pun"><作业名称>]</span>

参数说明

  • -A  将所有的视窗都调整为目前终端机的大小。
  • -d<作业名称>  将指定的screen作业离线。
  • -h<行数>  指定视窗的缓冲区行数。
  • -m  即使目前已在作业中的screen作业,仍强制建立新的screen作业。
  • -r<作业名称>  恢复离线的screen作业。
  • -R  先试图恢复离线的作业。若找不到离线的作业,即建立新的screen作业。
  • -s<shell>  指定建立新视窗时,所要执行的shell。
  • -S<作业名称>  指定screen作业的名称。
  • -v  显示版本信息。
  • -x  恢复之前离线的screen作业。
  • -ls或–list  显示目前所有的screen作业。
  • -wipe  检查目前所有的screen作业,并删除已经无法使用的screen作业。

实例

创建 screen 终端

<span class="com"># screen //创建 screen 终端</span>

创建 screen 终端 并执行任务

<span class="com"># screen vi ~/main.c //创建 screen 终端 ,并执行 vi命令</span>

离开 screen 终端

<span class="com"># screen vi ~/main.c //创建 screen 终端 ,并执行 vi命令</span>

<span class="com">#include</span><span class="pln"> 

main </span><span class="pun">()</span>
<span class="pun">{</span>

<span class="pun">}</span>

<span class="str">"~/mail.c"</span>       <span class="lit">0</span><span class="pun">,</span><span class="lit">0</span><span class="pun">-</span><span class="lit">1</span>    

<span class="pun">在</span><span class="pln"> screen </span><span class="pun">终端</span> <span class="pun">下</span> <span class="pun">按下</span> <span class="typ">Ctrl</span><span class="pun">+</span><span class="pln">a d</span><span class="pun">键</span>

重新连接离开的 screen 终端

<span class="com"># screen -ls  //显示已创建的screen终端 </span>
<span class="typ">There</span><span class="pln"> are screens on</span><span class="pun">:</span>
<span class="lit">2433.pts</span><span class="pun">-</span><span class="lit">3.linux</span><span class="pln">    </span><span class="pun">(</span><span class="lit">2013</span><span class="pun">年</span><span class="lit">10</span><span class="pun">月</span><span class="lit">20</span><span class="pun">日</span> <span class="lit">16</span><span class="pun">时</span><span class="lit">48</span><span class="pun">分</span><span class="lit">59</span><span class="pun">秒)</span><span class="pln">    </span><span class="pun">(</span><span class="typ">Detached</span><span class="pun">)</span>
<span class="lit">2428.pts</span><span class="pun">-</span><span class="lit">3.linux</span><span class="pln">    </span><span class="pun">(</span><span class="lit">2013</span><span class="pun">年</span><span class="lit">10</span><span class="pun">月</span><span class="lit">20</span><span class="pun">日</span> <span class="lit">16</span><span class="pun">时</span><span class="lit">48</span><span class="pun">分</span><span class="lit">05</span><span class="pun">秒)</span><span class="pln">    </span><span class="pun">(</span><span class="typ">Detached</span><span class="pun">)</span>
<span class="lit">2284.pts</span><span class="pun">-</span><span class="lit">3.linux</span><span class="pln">    </span><span class="pun">(</span><span class="lit">2013</span><span class="pun">年</span><span class="lit">10</span><span class="pun">月</span><span class="lit">20</span><span class="pun">日</span> <span class="lit">16</span><span class="pun">时</span><span class="lit">14</span><span class="pun">分</span><span class="lit">55</span><span class="pun">秒)</span><span class="pln">    </span><span class="pun">(</span><span class="typ">Detached</span><span class="pun">)</span>
<span class="lit">2276.pts</span><span class="pun">-</span><span class="lit">3.linux</span><span class="pln">    </span><span class="pun">(</span><span class="lit">2013</span><span class="pun">年</span><span class="lit">10</span><span class="pun">月</span><span class="lit">20</span><span class="pun">日</span> <span class="lit">16</span><span class="pun">时</span><span class="lit">13</span><span class="pun">分</span><span class="lit">18</span><span class="pun">秒)</span><span class="pln">    </span><span class="pun">(</span><span class="typ">Detached</span><span class="pun">)</span>
<span class="lit">4</span> <span class="typ">Sockets</span> <span class="kwd">in</span> <span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">run</span><span class="pun">/</span><span class="pln">screen</span><span class="pun">/</span><span class="pln">S</span><span class="pun">-</span><span class="pln">root</span><span class="pun">.</span>

<span class="com"># screen -r 2276 //连接 screen_id 为 2276 的 screen终端</span>

欢迎转载本文:系统管理-Linux screen命令
喜欢 (0)
[ld]
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址