linuxscreencommand命令及示例.docx

上传人:b****3 文档编号:6236860 上传时间:2023-05-09 格式:DOCX 页数:15 大小:142.81KB
下载 相关 举报
linuxscreencommand命令及示例.docx_第1页
第1页 / 共15页
linuxscreencommand命令及示例.docx_第2页
第2页 / 共15页
linuxscreencommand命令及示例.docx_第3页
第3页 / 共15页
linuxscreencommand命令及示例.docx_第4页
第4页 / 共15页
linuxscreencommand命令及示例.docx_第5页
第5页 / 共15页
linuxscreencommand命令及示例.docx_第6页
第6页 / 共15页
linuxscreencommand命令及示例.docx_第7页
第7页 / 共15页
linuxscreencommand命令及示例.docx_第8页
第8页 / 共15页
linuxscreencommand命令及示例.docx_第9页
第9页 / 共15页
linuxscreencommand命令及示例.docx_第10页
第10页 / 共15页
linuxscreencommand命令及示例.docx_第11页
第11页 / 共15页
linuxscreencommand命令及示例.docx_第12页
第12页 / 共15页
linuxscreencommand命令及示例.docx_第13页
第13页 / 共15页
linuxscreencommand命令及示例.docx_第14页
第14页 / 共15页
linuxscreencommand命令及示例.docx_第15页
第15页 / 共15页
亲,该文档总共15页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

linuxscreencommand命令及示例.docx

《linuxscreencommand命令及示例.docx》由会员分享,可在线阅读,更多相关《linuxscreencommand命令及示例.docx(15页珍藏版)》请在冰点文库上搜索。

linuxscreencommand命令及示例.docx

linuxscreencommand命令及示例

本文包含两部分。

第一部分虽然是整理来的英文资料,但平时搜索不容易搜索到,所以还是比较有价值的,是关于多路利用终端软件详解和比较的http:

//hyperpolyglot.org/multiplexers,然后把自己不关心的tmux部分删除后,只留下screen的部分。

第二部分针对原文命令行参数部分的不足增加了完整的help,并增加了一个sipP测试的例子。

本人其实只关心原文的screencommand那一列,因为从命令行help无法获取这一部分信息,而我一起在苦苦查找这部分资料,它对以编程的方式控制screen是非常重要的参考,使在无人值守的情况下(如定时或在系统崩溃重新启动后)自动创建一个有多window的screen并启动若干后台测试成为可能。

1.Terminology

server|client|session|window|region|pane

howsshworks:

Whenauserlogsintoaremotehostusingssh,thesshprocesscontactsansshdprocesslisteningonTCPport22.ThesshdprocessopensupanewTCPportandforksoffacopyofitselfforcommunicatingwiththesshprocess.Thenewportandchildprocessarefortheexclusiveuseoftheconnectionbeingestablished.

Thechildsshdprocessauthenticatesthesshprocess,andifitpassesitcreatesapseudo-terminal.Itthenforkstheremoteuser'sshellwhichbecomesthecontrollingprocessforthepseudo-terminal.

Ifthenetworkconnectionisclosed,eitherexplicitlybythesshprocessorbecauseofalossofnetworkconnectivity,thechildsshdprocessclosesthepseudo-terminal,andthisinturncausestheshelltoexit.

theSIGHUPproblem:

Iftheshellhadanyprocessgroupsrunningwhenitexits,theyaresentaSIGHUPsignalfollowedbyaSIGCONTsignal.BydefaultprocessesexitwhentheyreceiveSIGHUP.Thismakesitchallengingtorunlong-runningjobsonaremotehostwhenthenetworkconnectionisunreliable.

AsimplesolutiontotheSIGHUPproblemistoruneachjobwithnohup.Optionally,shellssuchasbashandzshhaveadisownbuilt-inwhichcanbeusedonaprocessthatisalreadyrunning,shouldtheuserhaveneglectedtorunitwithnohup.

Thefishshellwheninvokingaprocessinthebackgroundwith&setsthesignalhandlingstateoftheprocesstoignoreSIGHUP.Itwilldothesameiftheprocessissuspendedwith^Zandthenputinthebackgroundwithbg.

Multiplexersofferasolutionwhichprotectstheshellinsteadofthejob.Theuserdoesn'tneedtoremembertoruneachjobwithnohup.Asanaddedbenefitanystatekeptbytheshellispreserved.

server:

Themultiplexerservercreatespseudo-terminalswhichareusedforrunningandinteractingwithprograms.

ScreenandTmuxserverscancreatemultiplepseudo-terminals.Thecontrollingprocessforeachpseudo-terminalistheuser'sshell.

client:

Toseetheoutputofashelltheusermustconnecttothemultiplexerserverwithamultiplexerclientprocess.

Ifthemultiplexerisbeingrunonaremotemachineandtheuser'sconnectionislost,theserveranditsterminalsandcontrollingprocessespersist,buttheclientprocessexits.

Whenmultipleclientprocessesconnecttothesameservertheyseethesameoutput.Thisisawaytoshareadisplayacrosscomputers.

session:

Multiplexerssupportmultiplesessions.Eachmultiplexersessionhasitsownsetofterminalsandcontrollingprocesseswhichitisrunning.Theclientmustchooseasessiontoattachto,andwillonlybeabletoseetheoutputofthecontrollingprocessesinthatsession.Sessionscanbegivennamestomakeiteasyfortheclienttochoosethecorrectsession.

Screenlaunchesaseparateserverprocessforeachsession.Screenserversandclientscommunicatevianamedpipes.

Tmuxbydefaultwillonlyrunoneserverprocessperuser,andthisserverprocesscanhavemultiplesessions.ATmuxclientandtheservercommunicateviaaUnixdomainsocketinthe/tmpdirectory.The-Loptioncanbeusedtospecifyadifferentsocket;anewserveriscreatedforeachsocket.

window:

BothScreenandTmuxhaveentitieswhichtheycallwindows.

AScreenwindowhasasinglepseudo-terminalandshell.ATmuxwindowcanhavemultiplepseudo-terminalsandshells.

Screenwindowscansharetheviewport.TheTmuxviewportcanonlydisplayonewindowatatime.

BothScreenandTmuxwindowsarenumberedstartingfromzero.

region:

Screencandividetheviewportintomultipleregions.

Screenregionscanbeemptyortheycancontainawindow.Thesamewindowcanbedisplayedinmorethanoneregion.Whenregionsshareawindowtheircontentisidentical.

Screenregionsarestackedontopofeachotherandextendthefullwidthofthewindow.

pane:

Tmuxcandividewindowsintomultiplepanes.

Tmuxpanescontainasinglepseudo-terminalwithashell,andeachpseudo-terminalandshellbelongstoonlyonepane.

Tmuxwindowscanbedividedbothhorizontallyandverticallyintopanes.Eachdivisioncanbesubdividedfurther.

Tmuxpanesarenumbered.

Tmuxpanescanbemovedbetweenwindows.

commandcharacter(prefix):

Multiplexerspassmostinputontotheshellintheregionwithfocus,butaspecialcommandcharacterisusedtosendcommandstothemultiplexer.

ThedefaultcommandcharacterinScreenisC-a.ThekeystrokeswhichfollowC-aareinterpretedbyScreeninsteadofbeingpassedtotheshell.

TmuxcallsthecommandcharactertheprefixandthedefaultvalueisC-b.ThekeystrokesfollowingtheprefixareinterpretedbyTmuxinsteadofbeingpassedtoshell.

scrollbackbuffer(history):

ScreenandTmuxkeepahistoryoftheoutputofeachshell.Themaximumlengthoftheoutputinlinesisconfigurable.

Screencallsthehistorythescrollbackbuffer.

copy/scrollbackmode(copymode):

ScreenandTmuxsupporttwomodesforeachregion.Indefaultmode,inputwhichisnotinterceptedbythemultiplexerispassedtotheshell.

Whentheregionisincopymodetheregionbehaveslikearead-onlybufferofaneditor.Thecontentsaretheoutputoftheshellincludingoutputthatmayhavescrolledoffthetopoftheregion.

ThekeybindingsusedbyScreenincopy/scrollbackmodeareVim-style.ItispossibletocustomizethemtobeEmacs-style.

TheTmuxcallscopy/scrollbackmodesimplycopymode.ThekeybindingsarebydefaultEmacs-style.

pastebuffer:

Screenhasasinglepastebuffer.

Tmuxhasmultiplepastebuffers.TheTmuxpastebuffersarenumbered;themostrecentisnumberzero.Sessionsshareacommonpastebufferhistory.

caption(statusline):

WhenaScreenwindowissplitintomultipleregions,acaptionlineisplacedatthebottomofeachregion.Whenawindowcontainsasingleregion,Screenbydefaultdoesnotdisplayacaption.Thecaption,whenpresent,containsinformationfromScreen.Theinformationthatisdisplayedcanbecustomized.

Tmuxcallsthelineatthebottomofawindowthestatusline.Bydefaultitisalwaysdisplayed,thoughitcanbeturnedoff.ThestatuslinecontainsinformationfromTmuxwhichcanbecustomized.

2.

KeyBindings

sessions|windows|regions|panes|pastebuffer|copymode

functoin

C-ashotcut

screencommand

help

?

:

help

sendprefixtoapp

a

:

meta

suspendmultiplexer

C-z

:

suspend

showpreviousmultiplexermessage

m

C-m

:

lastmsg

sourcefile

-

:

sourcefile

detach

d

C-d

:

detach

sessions

function

C-ashotcut

screencommand

newsession

-

-

newnamedsession

-

-

switchsession

-

-

renamesession

-

:

sessionnamefoo

killsession

C-\

:

quit

windows

function

C-ashotcut

screencommand

createnewwindow

c

C-c

:

screen

switchtonextwindow

n

C-n

SPACE

:

next

switchtopreviouswindow

p

C-p

BACKSPACE

h

:

prev

toggletolastwindow

C-a

:

other

selectwindown

-

-

listwindows

w

C-w

:

windows

showcurrentwindownumberandname

N

:

number

renumbercurrentwindow

-

-

movecurrentwindowtoanothersession

-

-

redrawcurrentwindow

l

C-l

:

redisplay

choosewindowinteractively

"

:

windowlist-b

renamewindow

A

:

title

selectwindowfoo

'

:

select

closecurrentwindow

C-k

:

kill

joinwindow1tocurrentwindow

-

-

joinregion0ofwindow1tocurrentwindow

-

-

regions

function

C-ashotcut

screencommand

splitintotopandbottomregions

S

:

split

movedowntonextregion

TAB

:

focus

makeregionssameheight

-

:

resize=

closecurrentregion

X

:

remove

closeallbutcurrentregion

Q

:

only

clearcurrentregion

C

:

clear

logregiontofile

-

fileisscreenlog.NN

:

log

turnofflogging

-

:

logoff

makecurrentregionnrowstaller/shorter

-

:

resize+n

:

resize-n

makecurrentregionnrowstall

-

:

resizen

pastebuffer

function

C-ashotcut

screencommand

entercopymode

[

C-[

ESC

:

copy

pastemostrecentbuffer

]

-

listbuffers

onlyonebuffer

-

choosebuffertopasteinteractively

-

-

writebuffertofile

writesto/tmp/screen-exchange:

>

:

writebufpath

copyfiletobuffer

copiesfrom/tmp/screen-exchange:

<

:

readbufpath

copymode

function

shotcut

screencommand

defaultbindings

Vim-style

setmark

SPACE

-

copyfrommarktopointandexitcopymode

whenmarkisset:

SPACE

-

singlecolumnmovement

alsoleftrightarrow

hl

-

singlelinemovement

alsodownuparrow

jk

-

beginningofline

0

-

endofline

$

-

forwardword

e

-

backwardword

b

-

pageup

C-b

-

pagedown

C-f

-

beginningofbuffer

g

-

endofbuffer

G

-

searchbackwards

?

phrase

-

searchforwards

/phrase

-

exitcopymode

anyunboundkeyalsoworks:

ESC

-

3.

Customization

funciton

configuration

startupfile

~/.screenrc

scrollbacklength

defscrollback2000

setprefix

howtosetprefixtoC-b,withasecondC-btosendaC-btothecontrollingprocess:

escape^B^B

definekeybinding

bind

undefinekeybinding

-

setcopy/scrollbackkeybindingstyle

vibindingsbydefault.

Whenredefining,usevi

commandsonleftofequations:

markkeysh=^B:

l=^F:

$=^E

disablestartupmessage

startup_messageoff

numberwindowsfromone

-

alwaysshowstatusbar

splitonlybydefault:

captionalways

captionsplitonly

customizecaption

captionstring"string"

captionescapes

function

configuration

shelloutput

firstargisanidentifierreferencedbythecaptionstring;

thesecondandth

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 小学教育 > 语文

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2