recentpopularlog in

kme : screen   46

Share your .screenrc : linux
r/linux: All things Linux and GNU/Linux -- this is neither a community exclusively about the kernel Linux, nor is exclusively about the GNU operating system.
screen  showmeyour  screenrc  dotfile  configfile 
may 2019 by kme
macos - How to prevent screen from resizing my Terminal in Mac OS X? - Super User |
Disable "session-initiated terminal resizing"; PuTTY has a checkbox for this, too.
putty  iterm  solution  screen  macos  osx  linux 
may 2019 by kme
A nice default screenrc · GitHub
A nice default screenrc. GitHub Gist: instantly share code, notes, and snippets.
screen  screenrc  configfile  dotfile  movein  newbie  terminalmultiplexer 
may 2019 by kme
unix - Use GNU screen as login "shell" - Super User
<code class="language-bash">
# if $STY is not set...
if [ -z "$STY" ]; then
exec screen -ARR
unix  linux  sysadmin  screen  login  loginshell  solution 
march 2019 by kme
Linux/Documentation/filesystems/devpts.txt - Linux Cross Reference - Free Electrons
I saw this on a Debian 8.6 (Jessie, kernel 4.4.19-1-pve) where /dev/pts/ptmx was c--------- and both Screen and tmux would just immediately bail out with no error messages. Even 'strace' wasn't much help in getting to the bottom of this, but The short-term fix was to 'chmod 0666 /dev/pts/ptmx', but adding the mount option discussed below might be a long-term fix.

There are 'lxcfs' entries in the list of mounts, so it could be the same issue discussed elsewhere that's related to containerization. I dunno. I'm satisfied now that I actually understand why the heck this was happening in the firts place.

- (SE thread that gave me the idea to start googling for 'ptmx' which eventually led me here)
As an option instead of placing a /dev/ptmx device node at /dev/ptmx it is possible to place a symlink to /dev/pts/ptmx at /dev/ptmx or to bind mount /dev/ptx/ptmx to /dev/ptmx. If you opt for using the devpts filesystem in this manner devpts should be mounted with the ptmxmode=0666, or chmod 0666 /dev/pts/ptmx should be called.
linux  screen  tmux  terminalmultiplexor  ptmx  devpts  permissions  sysadmin  solution 
december 2016 by kme
linux - How do I use the terminal SCREEN when chrooted? - Super User
I had this problem once where /dev/pts/ptmx was c--------- and Screen and tmux would both refuse to run (without any error message!).
screen  pts  ptmx  sysadmin  permissions  maybesolution 
december 2016 by kme
tmux exits immediately after starting - Unix & Linux Stack Exchange
This little tidbit

If screen does not work as well, make sure you have read-write access to /dev/ptmx. If not, no new pty can be spawned and especially tmux terminates without an error message.

that eventually turned up, which recommends:
As an option instead of placing a /dev/ptmx device node at /dev/ptmx it is possible to place a symlink to /dev/pts/ptmx at /dev/ptmx or to bind mount /dev/ptx/ptmx to /dev/ptmx. If you opt for using the devpts filesystem in this manner devpts should be mounted with the ptmxmode=0666, or chmod 0666 /dev/pts/ptmx should be called.

and it seems that was the eventual solution.

This bug report could also be related, as the host where I experienced this problem had a bunch of 'lxcfs' entries in the mounts list:
tmux  screen  annoyance  ptmx  devpts  debian  jessie  solution 
july 2016 by kme
SSH agent forwarding and screen
To have SSH within a screen session use the symlink, add the following line to ~/.screenrc:

setenv SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock

To update the symlink we'll use the ~/.ssh/rc file which is executed by SSH on each connection. This can be any executable file, so something like the following script will do:

if test "$SSH_AUTH_SOCK" ; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock

Also, from the comments, the same thing can be done in a ~/.bashrc:

if [[ -n "$SSH_TTY" && -S "$SSH_AUTH_SOCK" ]]; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock

And for tmux (courtesy:
# fix ssh agent when tmux is detached
setenv -g SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock
screen  tmux  ssh  ssh-agent  dotfiles  solution 
june 2016 by kme
How to auto-update SSH agent environment variables when attaching to existing tmux sessions - Stack Overflow
There's an excellent gist by Martijn Vermaat, which addresses your problem in great depth, although it is intended for screen users, so I'm adjusting it for tmux here.

To summarize:

create ~/.ssh/rc if it doesn't exist yet, and add the following content:


# Fix SSH auth socket location so agent forwarding works with tmux
if test "$SSH_AUTH_SOCK" ; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock

Make it work in tmux, add this to your ~/.tmux.conf:

# fix ssh agent when tmux is detached
setenv -g SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock

solution  tmux  screen  ssh-agent  dotfile  authentication 
june 2016 by kme
software installation - Trying to compile GNU Screen - Unix & Linux Stack Exchange
The actual "solution" for me was to compile an older version of screen (4.0.3).
screen  compiler  errormessage  sortof  solution 
march 2016 by kme
Re: screen with 256 color xterm
MacPorts' version of 'screen' (v4.03.x) seems to have 256-color support, and MacPorts does include the 'screen-256color' term type. You do need to (at a minimum) specify 'term xterm-256color' in your ~/.screenrc, though, otherwise you get this error:
"TERMCAP", line 19, col 1, terminal 'SC': Missing separator

Not sure if this is because I bulk-imported a bunch of screen terminfo database entries at one point on my Mac or what?

This 'termcapinfo' line seems to work OK, or it doesn't, or it isn't necessary, as long as screen has 256-color support compiled in (see the post for details on that) and you use 'TERM=xterm-256color. Note that the 'xterm' below would correspond to whatever your TERM variable was set to. So if your TERM is 'xterm-256color', the line below would only enable 256 colors if you specified 'TERM=xterm'; otherwise the termcap/terminfo entry should (might?) take care of the initialization for you.
2. $HOME/.screenrc needs the following:
<code>termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
After this, everything works beautifully while inside screen. :-)
screen  termcap  terminfo  256colors  xterm-256color  errormessage  solution 
march 2016 by kme
256 Colors in GNU screen and vim
This works without needing to force TERM to 'xterm-256color' or something like that:
set t_Co=256
screen  vim  bash  xterm-256color  howto  reference  annoyance 
march 2016 by kme
Code and Hacks: Setting the Terminal Title in Gnu Screen
NB: You can still use the caption line with the settings below, e.g.:
caption always "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %d/%m %C%a "

Setup screen (via .screenrc) to update your terminals title bar and include the name of the current window.

# Add to .screenrc
termcapinfo xterm* 'hs:ts=\E]0;:fs=\007:ds=\E]0;\007'
defhstatus "screen ^E (^Et) | $USER@^EH"
hardstatus off

The escape string ^Et in the defhstatus is converted into the current window’s name/title.

Create a function to update the name of each screen window.

# Add to .bashrc
# Set the title of a Terminal window
function settitle() {
if [ -n "$STY" ] ; then # We are in a screen session
echo "Setting screen titles to $@"
printf "\033k%s\033\\" "$@"
screen -X eval "at \\# title $@" "shelltitle $@"
printf "\033]0;%s\007" "$@"

screen  hardstatus  terminalemulator  configfile  solution  movein 
march 2016 by kme
An introduction to the visual features of GNU Screen
# look and feel for the bottom two lines.
caption always "%{+b rk}%H%{gk} |%c %{yk}%d.%m.%Y | %72=Load: %l %{wk}"
hardstatus alwayslastline "%?%{yk}%-Lw%?%{wb}%n*%f %t%?(%u)%?%?%{yk}%+Lw%?"

Kinda like this one better:
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %d/%m %C%a "
caption always "%3n %t%? @%u%?%? [%h]%?"
terminal  multiplexor  configsettings  screen  configfile  solution  reference  hardstatus 
march 2016 by kme
linux - Making 256-color AND Line drawing characters both work in PuTTY - Super User
This did *not* work for me on 'down'.
Export NCURSES_NO_UTF8_ACS=1 to your environment, it should fix the problem by telling ncurses to always use Unicode box drawing characters when a UTF-8 locale is selected.
mc  screen  tmux  linedrawcharacters  annoyance  terminal 
february 2016 by kme
server - Changing shell colors: "dircolors -b command not found" - Ask Ubuntu
dircolors -p > ~/.dircolors

But what I actually ended up doing, since that didn't really work with tmux was to just alias 'less' to 'TERM=xterm-256color less'. I'm sure this will confuse me later.
screen  tmux  termcap  terminfo  annoyancesortof  solution  dircolors  colors  configfile 
november 2015 by kme
keymapping - mapping function keys in vim - Stack Overflow
Your problem is that vim does not know what does terminal emit when you press <F2>. On some terminals it emits something like <Esc>[12~, so the vim quits current mode (or just beeps if it can't) (<ESC>), does nothing ([1: there must be some key after [, but not 1, so it does nothing) and changes case of two letters (2~). So, you should open .vimrc and write there the following:

set <F2>=<C-v><F2>

where <C-v><F2> means that you must press <C-v> and then <F2>. This line should tell the Vim the exact sequence of codes which is emitted by terminal when you press <F2>. After that, use noremap <F2> whatever and it should work. If it is not the only terminal that you are using, then you may want to put if $TERM==#"<C-r>=$TERM<CR>" before this line and endif after.

NB: The <F2> mapping is fine with TERM=xterm-256color. It's 'screen-256color' (so, inside tmux) where I have the problem. This fixes that:
set <F2>=^[[12~
set <F3>=^[[13~
set <F4>=^[[14~

noremap <silent> <F2> :FufBuffer<CR>
noremap <silent> <F3> :FufMruFile<CR>
noremap <silent> <F4> :FufDir<CR>
noremap <silent> <F5> :FufFile<CR>
noremap <silent> <F6> :FufBuffer<CR>
xterm  screen  tmux  termcap  vim  functionkeys  keybinding  configfile  annoyance  solution 
october 2014 by kme
Getting 256 colors to work in tmux - Unix & Linux Stack Exchange
Here's what I use:

~$ which tmux
tmux: aliased to TERM=xterm-256color tmux

and in in my .tmux.conf:

set -g default-terminal "screen-256color"

Aliasing tmux to "tmux -2" should also do the trick.
tmux  screen  xtermcolors  colorscheme  configfile 
september 2014 by kme
Circuidipity | My tmux cheatsheet
This one has some information about creating custom layouts and storing them in a config file. Perfect for a 'multitail' session for monitornig log files.
tmux  terminal  multiplexor  cheatsheet  reference  alternativeto  screen  configfile 
september 2014 by kme
Emacs 256 colors not working using PuTTY and screen - Stack Overflow
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
term xterm-256color

#You may also need this line too.

defbce "on"

# Maybe I needed those, and maybe I needed this (although I *had* built screen from source already):

$ wget
$ tar -xf screen-4.0.3.tar.gz
$ cd screen-4.0.3
$ ./configure --prefix=$HOME --enable-colors256
$ make
$ make install
screen  theme  colorscheme  vim  xterm-256  solution  terminal  shell  putty  windows 
april 2013 by kme

Copy this bookmark:

to read