0

When using the linux screen, vi editor overwrites all console information. I expect vi to open the file as a separate window and on exit, it has to return back to console.

My .screenrc is,

################
#
# default windows
#
screen -t screen1 1
screen -t screen2 2
screen -t screen3 3
screen -t screen4 4
screen 1

# caption always "%3n %t%? @%u%?%? [%h]%?%=%c"
# hardstatus alwaysignore
# hardstatus alwayslastline "%Lw"
#hardstatus string "[screen %n]:%h"


hardstatus on
hardstatus alwayslastline

hardstatus string '%{= wk}%-w %{bw} [ %n %t ] %{Kd}%+w %-= %{KY} | %D %M %d %Y% | %C %A %{-} '




#caption always
#caption string "%{= bW}%3n %{y}%t %{-}%= %{m}%H%?%{-} -- %{c}%l%?%{-} -- %D %M %d %{y}%c"

#term screen-256color
attrcolor b ".I"    # allow bold colors - necessary for some reason
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'   # tell screen how to set colors. AB = background, AF=foreground
defbce on    # use current bg color for erased chars

vbell  off
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
shim_mang
  • 323
  • 4
  • 17

1 Answers1

0

Screen does that. When opening a vi editor in screen, it will appear on the screen pushing back all the log on the console. Also, you cannot scroll back while checking a log on screen for similar reason. However, every screen has a log file. It logs to screenlog.%n by default, where %n is the screen window number. In your .screenrc file, you can check/change this log file's path. To start logging, start the screen using screen -L command.

To emulate what you need, open a new terminal tab and do a tail -f screenlog.0. This will give you the live updated log from your screen.

---Edit---

If you're comfortable with shifting to a new application, try tmux. It should do exactly what you need. Read this for more info.

gaganshera
  • 2,629
  • 1
  • 14
  • 21
  • Isn't there any way to avoid this behavior? – shim_mang Apr 25 '17 at 10:28
  • I don't think you can override the default screen bahaviour. However, to emulate what you need, open a second terminal tab and do a `tail -f screenlog.0` in that, that will give you the log by log updates for what you need. Try it – gaganshera Apr 25 '17 at 10:55
  • I tried and don't find it comfortable. Is there any other application which I can use similar to screen with this functionality? – shim_mang Apr 27 '17 at 04:08
  • @shim_mang If you're comfortable with shifting to a new application, try tmux. It should do exactly what you need. I'll update my answer with this. [Read this](https://www.howtogeek.com/114582/2-alternatives-to-gnu-screen-for-linux-terminal-multitasking/) for more info. – gaganshera Apr 27 '17 at 07:11