screen使用

centos 7 要想title正常,需修改~/.bashrc

在~/.bashrc 中加入unset PROMPT_COMMAND

https://unix.stackexchange.com/questions/206100/gnu-screen-window-rename-nuisance

为此我还做了一个gif动画:

https://gitee.com/cshi/git-test/raw/master/screen-title-change-issue.gif

避免screen在vim,less等程序退出后不清屏

加上altscreen on选项

https://superuser.com/questions/137714/using-screen-commands-like-less-and-man-dont-clear-the-screen-afterwards/137751#137751

https://serverfault.com/questions/270103/gnu-screen-clearing-on-vim-less-etc-exit

设置别名

alias scr='screen'

如果提示要密码

https://superuser.com/questions/343965/what-is-the-default-password-of-screen

如果screen中的进程在消耗CPU,htop就会显示SCREEN进程占用CPU

[root@screen-4.5.0]$ cat ~/.screenrc

hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "

$HOME/.screenrc如果不生效,可能需要给screen 加-a参数

screen教程

http://www.ibm.com/developerworks/cn/aix/library/au-gnu_screen/
http://www.cnblogs.com/mchina/archive/2013/01/30/2880680.html
http://www.cnblogs.com/bamanzi/p/switch-tmux-to-gnu-screen.html
https://www.gnu.org/software/screen/manual/screen.html
http://web.mit.edu/gnu/doc/html/screen_15.html

源码

https://savannah.gnu.org/git/?group=screen

git地址

http://git.savannah.gnu.org/cgit/screen.git

用make install时,好像etc目录要手动复制??

root@screen-4.5.0$ make install
./etc/mkinstalldirs /opt/screen-4.05/bin /opt/screen-4.05/share/screen/utf8encodings
mkdir /opt/screen-4.05
mkdir /opt/screen-4.05/bin
mkdir /opt/screen-4.05/share
mkdir /opt/screen-4.05/share/screen
mkdir /opt/screen-4.05/share/screen/utf8encodings
cd doc ; make installdirs
make[1]: Entering directory `/root/tmp/screen-4.5.0/doc'
./../etc/mkinstalldirs /opt/screen-4.05/share/man/man1 /opt/screen-4.05/share/info
mkdir /opt/screen-4.05/share/man
mkdir /opt/screen-4.05/share/man/man1
mkdir /opt/screen-4.05/share/info
make[1]: Leaving directory `/root/tmp/screen-4.5.0/doc'
if [ -f /opt/screen-4.05/bin/screen-4.5.0 ] && [ ! -f /opt/screen-4.05/bin/screen-4.5.0.old ]; \
        then mv /opt/screen-4.05/bin/screen-4.5.0 /opt/screen-4.05/bin/screen-4.5.0.old; fi
/usr/bin/install -c screen /opt/screen-4.05/bin/screen-4.5.0
chown root /opt/screen-4.05/bin/screen-4.5.0 && chmod 4755 /opt/screen-4.05/bin/screen-4.5.0
if [ -f /opt/screen-4.05/bin/screen ] && [ ! -f /opt/screen-4.05/bin/screen.old ]; then mv /opt/screen-4.05/bin/screen /opt/screen-4.05/bin/screen.old; fi
rm -f /opt/screen-4.05/bin/screen
(cd /opt/screen-4.05/bin && ln -f -s screen-4.5.0 screen)
cp ./utf8encodings/?? /opt/screen-4.05/share/screen/utf8encodings
cd doc ; make install
make[1]: Entering directory `/root/tmp/screen-4.5.0/doc'
./../etc/mkinstalldirs /opt/screen-4.05/share/man/man1 /opt/screen-4.05/share/info
/usr/bin/install -c -m 644 ./screen.1 /opt/screen-4.05/share/man/man1/screen.1
make screen.info
make[2]: Entering directory `/root/tmp/screen-4.5.0/doc'
makeinfo ./screen.texinfo -o screen.info
make[2]: Leaving directory `/root/tmp/screen-4.5.0/doc'
if test -f screen.info; then d=.; else d=.; fi; \
    if test -f $d/screen.info; then \
    for f in $d/screen.info*; do /usr/bin/install -c -m 644 $f /opt/screen-4.05/share/info;done; \
    if /bin/sh -c 'install-info --version' >/dev/null 2>&1; then \
      install-info --info-dir=/opt/screen-4.05/share/info $d/screen.info; \
    else true; fi; \
    fi
make[1]: Leaving directory `/root/tmp/screen-4.5.0/doc'
if [ -d /usr/lib/terminfo ]; then \
        PATH="$PATH:/usr/5bin" tic ./terminfo/screeninfo.src; \
        chmod 644 /usr/lib/terminfo/s/screen*; \
    fi
termcap entry (./terminfo/screencap) should be installed manually.
You may also want to install ./etc/etcscreenrc in /opt/screen-4.05/etc/screenrc

注意源码编译时,make install之后的提示,要求要手工将screencap,etcscreenrc复制到相关目录。碰到问题时,不要忽略这一点

从此妈妈再也不担心我突然断线工作丢失了……

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值