gnu-screen

Using GNU Screen completely transparently and automatically

浪子不回头ぞ 提交于 2019-11-29 20:30:30
Screen is amazing, of course, but I don't want to have to think about it. I often ssh to a machine, start doing a bunch of stuff, and then think "gosh, I wish I had thought to start a screen session before doing all that so I could reconnect to this from home later". I'd like to have screen automatically started whenever I log in to a machine. And when I get disconnected, I want to be able to immediately and simply reconnect without fussing with "screen -ls" and "screen -dr". I have a script that implements one solution to this problem which I'll post as an answer. I'm interested to see other

Unable to use Screen efficiently in Mac's Terminal

泪湿孤枕 提交于 2019-11-29 19:54:57
The post summarizes problems in using Screen in Mac's terminal when you have the following in your .zshrc if [[ $STY = '' ]] then screen -xR; fi Solution #1 is not working but Solution #2 works : Clipboard programs: pbcopy, pbpaste and xsel do not work at all Bug in Vim when used in Mac: Unable to have no scattered windows in Screen by .Xresources. Solved : Ctrl A stops working in terminal. This suggests me that Screen's keyboard bindings need to be changed slightly. Solved : The scrolling with touchpad does not work. By editing your .screenrc the scrollback works normally (including touchpad)

Strange behavior of vim color inside screen with 256 colors

放肆的年华 提交于 2019-11-29 19:43:17
I was trying to make the syntax highlighting (with 256 colors) of vim work inside screen , which is running inside gterm . It works quite fine in the beginning. What I mean by "in the beginning" is, after I start screen , and enter vim , the colors look fine, and there are really 256 colors. But after a while (I don't know exactly how long) the colors automatically change back to an appearance as if there are only 8 (or 16?) colors. For example, after this has already occurred, if I enter the command hi Comment ctermfg=68 inside vim , the comments appear to be "pure" green; however, if I open

Bash: Getting PID of daemonized screen session

眉间皱痕 提交于 2019-11-29 19:42:36
问题 If I start a GNU screen session as a daemon, how would I retrieve its PID programmatically? I don't know how consistent the output of screen -ls is, so I'd like to know how to do this with one of bash's constants, $$ , $! or a better alternative. I am starting the screen with screen -dmS screenname . How would I get the PID of a screen right before or immediately after starting the screen session? 回答1: This show the pid for a screen named nameofscreen : $ screen -ls There are screens on:

How to list running screen sessions?

强颜欢笑 提交于 2019-11-29 19:14:42
I have a bunch of servers, on which I run experiments using screen . The procedure is the following : ssh to server XXX launch screen start experiments in a few tabs detach screen disconnect from the server While the experiments are running, I can easily find on which servers they are by ssh ing to all servers and listing my running processes (using top or ps ). However, once the experiments are finished, how could I find on which servers I have a screen session opened (so that I can have a look at the output, relaunch them, etc.) ? PS: my experiments do print their output to files, too... but

How to assign name for a screen? [closed]

半世苍凉 提交于 2019-11-29 18:31:17
I'm using the screen multiplexer tool on the command shell and open a lot of screens. I then forget which process ID associates with which task. I would like to set a name for a screen but can't find an option in the manpage. Currently, listing the screens looks like this: There are screens on: 5422.pts-1.aws1 (Detached) 5448.pts-1.aws1 (Detached) 5027.pts-1.aws1 (Detached) 3 Sockets in /var/run/screen/S-sb. And I would like to see something like this: There are screens on: 5422.logCleanWorker (Detached) 5448.overNightLongTask(Detached) 5027.databaseOverNightLongTask (Detached) 3 Sockets in

Gnu-Screen: Run script that sends commands to the screen session it is being run in

强颜欢笑 提交于 2019-11-29 13:57:28
问题 Is it possible to write a script to change the name and turn on monitoring for the current tab assuming that it is being run in screen? Thanks. 回答1: I think this works: if [-n "$STY"]; then screen -X title "foo" screen -X monitor on fi 回答2: From the screen manpage: -X Send the specified command to a running screen session. You can use the -d or -r option to tell screen to look only for attached or detached screen sessions. Note that this command doesn't work if the session is password

To have Vim-like K in Screen for MySQL

依然范特西╮ 提交于 2019-11-29 13:16:28
This question is based on this thread . Problem: to access MySQL's manual when the cursor is at the beginning of the word by Ctrl-A Esc Ctrl-m where m reminds about M ysql. How can you build a Vim-like K in Screen for MySQL's manuals? Assuming you've installed the man pages from MySQL's documentation site : Put the following in /path/to/mysql-help.screen : # mysql-help.screen # prevent messages from slowing this down msgminwait 0 # copy term starting at cursor copy stuff " e " # write term to a file writebuf /tmp/screen-copied-term # open that file in man in a new screen window # (use `read`

Vim background with gnu screen

折月煮酒 提交于 2019-11-29 10:24:08
I am having trouble with my colorscheme in vim . When editing a file using a vim session started in GNU screen, the text background is not rendered correctly. In a session outside screen, the entire background is gray (how it should be). For a vim window inside screen, only the background directly behind the text appears gray. The rest is black. I have TERM set to xterm-256color in both my .cshrc and .screenrc . My .vimrc has set t_Co=256 I am using csh . Edit: I am connecting through cygwin . [filling in for the OP, see the comment] The OP found the issue: I needed to have this set: defbce

How to start a new process in a new window in an existing GNU screen session, from outside the session

好久不见. 提交于 2019-11-29 07:47:14
I asked a similar question here and got pretty close to what I'm looking for How to start a process from another application and then open a terminal to that process in gnu screen ...but, this doesn't quite get to what I'm after, which is starting a process in a new window (not an existing window) in an existing screen session (not a new screen session). If you are at a command prompt in a screen session, you can do this: screen [screen options] command param1 param2 But, how do you do it if you are outside the session? For example, if you want to run this as a cronjob? When you aren't in a