什么是GNU屏幕? [英] What is GNU Screen?

查看:55
本文介绍了什么是GNU屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是GNU屏幕?

推荐答案

什么是 GNU屏幕?太好了!

Erm,一个稍微有用的答案:它允许您在一个终端上运行多个控制台应用程序或命令.有点像选项卡式终端仿真器.实际上,这就是事实(只是使用常规的GUI工具包无法做到)

Erm, a slightly more useful answer: it allows you to run multiple console applications, or commands, in one terminal. Kind of like a tabbed terminal emulator. In fact, that's exactly what it is (just not done with the regular GUI toolkits)

为什么这么好?很简单,您可以在屏幕会话中运行程序(运行screen并运行默认外壳程序,运行screen myapp并在会话中运行myapp),然后按 ctrl + a (屏幕控制序列),然后按 d ( ctrl + a d )分离.

Why is it so great? Simple, you can run a program in a screen session (Run screen and it runs your default shell, run screen myapp and it runs myapp in the session), hit ctrl+a (the screen control sequence) and then press d (ctrl+a,d) to detach.

该程序一直在后台运行,但是 mycmd &不同,您可以运行screen -r重新连接会话,一切就如您所愿.您可以将输入发送到命令,如果它是curses UI,则所有操作仍然像是真实"终端一样.

The program keeps running in the background, but, unlike doing mycmd &, you can run screen -r to reattach the session, and everything is as you left it. You can send input to the command, if it's a curses UI, everything still works just like if it were a "real" terminal.

它在控制台IRC客户端中非常流行-您可以运行(说)screen irssi并从可以通过SSH进行连接的任何位置重新附加会话.

It's very popular with console IRC clients - you can run (say) screen irssi and reattach the session from anywhere you can SSH from.

一些有用的命令:

  • ctrl + a c 在会话中创建新的虚拟终端(或窗口")
  • ctrl + a n ctrl + a p 可以在多个窗口中循环
  • ctrl + a 1 选择窗口1, ctrl + a 4 选择窗口4,依此类推
  • ctrl + a ctrl + a 可以在最后两个活动窗口之间滑动
  • ctrl + a shift + a (大写a)允许您重命名当前窗口
  • ctrl + a `(对我来说,这是 shift + 2 -引号)列出了窗口,您可以使用箭头并选择一个.在标签栏"设置中也很有用,我将在一秒钟内列出
  • ctrl+a, c to make a new virtual terminal (or "window") in the session
  • ctrl+a, n and ctrl+a, p to cycle through multiple windows
  • ctrl+a, 1 to select window 1, ctrl+a, 4 to select window 4 and so on
  • ctrl+a, ctrl+a to flick between the last two active windows
  • ctrl+a, shift+a (upper-case a) allows you to rename the current window
  • ctrl+a, ` (for me, that's shift+2 - the quote mark) lists windows, you can use the arrows and select one. Also useful with the "tab bar" setting I'll list in a second

我偶然发现的其他一些有用的东西:

A few other useful things I've stumbled across:

  • 启动屏幕时使用-U标志,以便它支持Unicode(例如screen -xU)
  • -x标志允许您多次重新连接同一会话. (-r断开现有连接)
  • 您可以在状态栏上做一些有趣的事情.我有显示[ hostname ][ 0-$ bash (1*$ irssi) ][16/09 9:32]的设置(在主机名上运行,它有两个窗口.这是由我的.screenrc中的hardstatus行设置的(答案的末尾)
  • Use the -U flag when you launch screen so it supports Unicode (for example, screen -xU)
  • The -x flag allows you to reattach the same session multiple times. (-r disconnects existing connections)
  • You can do interesting stuff with the status bar. I have my setup to display [ hostname ][ 0-$ bash (1*$ irssi) ][16/09 9:32] (Running on hostname, it has two windows. This is set by the hardstatus lines in my .screenrc (at the end of the answer)
startup_message off
vbell off
hardstatus alwayslastline
hardstatus string '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%?%?%= %{g}]%{=y C}[%d/%m %c]%{W}'

这篇关于什么是GNU屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆