答案1
对于窗口排列的具体情况,有一个屏幕命令可以将它们保存到文件中:layout dump
。从man screen
:
layout dump [filename]
Write to a file the order of splits made in the current layout. This is
useful to recreate the order of your regions used in your current
layout. Only the current layout is recorded. While the order of the
regions are recorded, the sizes of those regions and which windows
correspond to which regions are not. If no filename is specified, the
default is layout-dump, saved in the directory that the screen process
was started in. If the file already exists, layout dump will append to
that file. As an example:
C-a : layout dump /home/user/.screenrc
will save or append the layout to the user's .screenrc file.
因此,一旦您手动进行安排,请按Ctrla:,然后输入layout dump /path/to/some/file
。布局将保存到/path/to/some/file
,然后您可以在新会话中使用以下命令恢复它:
screen -c /path/to/some/file
答案2
我想出了以下内容来创建我的问题中显示的输出,并遵循@muru 的精彩回答。使用layout dump
给了我以下信息:
split
focus
split -v
focus
注意:波浪号 (
~
) 扩展不适用于,因此您需要使用layout dump
而不是。~/layout.dmp
/home/<username>/layout.dmp
然后我创建了以下内容.screenrc
# create the top screen
chdir /home/server/log
screen -t "Apache Log" tail -n 1 -f access.log
# split the screen and focus onto the new created space
split
focus
#create the bash
chdir /home/server/log
screen
# split vertically and focus onto the new area
split -v
focus
# create the htop screen
screen -t "Htop" htop
# focus twice to end up with the bash area active
focus
focus
现在我只需要输入screen
并开始我想要的布局。我把这个留在这里作为给那些想知道的人的一个例子,但不要忘记给@muru 的答案点赞,因为他是让我能够解决这个问题的人。