Vid*_*uth 14 command-line gnu-screen
我在screen登录ssh到我的服务器后使用。到目前为止,我手动设置了屏幕窗口中的拆分并手动运行命令,如下面的屏幕截图所示:
tail -n 1 -f /home/server/log/access.log。htop有什么办法可以通过命令/脚本来完成,所以我不必每次都手动重做?
mur*_*uru 17
对于窗口排列的特定情况,有一个 screen 命令可以将它们保存到文件中: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.
Run Code Online (Sandbox Code Playgroud)
因此,一旦您手动进行排列,请按Ctrla:,然后键入layout dump /path/to/some/file。布局将被保存到/path/to/some/file,然后您可以在新会话中恢复它:
screen -c /path/to/some/file
Run Code Online (Sandbox Code Playgroud)
Vid*_*uth 12
我想出了以下内容来创建我的问题中显示的输出并遵循@muru 的优秀答案。使用layout dump给了我以下内容:
split
focus
split -v
focus
Run Code Online (Sandbox Code Playgroud)
注意:波浪号 (
~) 扩展不适用于layout dumpso 而不是~/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
Run Code Online (Sandbox Code Playgroud)
现在我只需要输入screen并开始我想要的布局。我把它留在这里作为那些想知道的人的例子,但不要忘记给@muru 的答案投票,因为他是让我能够解决这个问题的人。
| 归档时间: |
|
| 查看次数: |
7070 次 |
| 最近记录: |