Using screen automagically
A few days back I blog'd about my .screenrc and what it could do etc, something to get people interested in screen and start using it. But in order to really use 'screen' properly, dont forget the 'screen -xRR' in your .bash_profile.
That will make sure that when you ssh to a remote machine, it auto joins an existing screen - and if none exists then creates a new screen instance and drops you inside it. Try it, most people like it :)
- KB
8 comments
Comment from: tale [Visitor]
Could you explain the -xRR option a little better? Ubuntu doesn't have .bash_profile by default. Do you just run that command or do you create an alias with it?
18/Feb/2010 @ 13:01
Comment from: Foscarini [Visitor]
foscarini@storage:~$ cat .bash_profile
screen -xRR && exit
This looks more effective to me.
Detach and logoff automatically.
screen -xRR && exit
This looks more effective to me.
Detach and logoff automatically.
18/Feb/2010 @ 21:44
Foscarini,
The only issue with that is not being able to get out of the screen session should you want to.
Within a trusted network, I tend to just close the terminal rather than going through the mechanics of logging off the remote machine.
The only issue with that is not being able to get out of the screen session should you want to.
Within a trusted network, I tend to just close the terminal rather than going through the mechanics of logging off the remote machine.
19/Feb/2010 @ 05:02
tale,
There are a couple of scripts that are executed by bash automatically when it starts up, .bashrc, .bash_profile, .bash_login etc. In brief:
.bash_profile is only executed when you start bash with a login shell. eg. you ssh into the machine with a terminal.
.bashrc gets executed when you start bash off in a non-login, interactive mode. eg. when you ssh to a host and run a fixed command like 'ssh remotehost.com /bin/ls /tmp'
Neither of these two scripts are run when you startup bash in a non-interactive shell. eg when using the runuser -c command
You might want to dig up details on what these files are and what they do in a more bash specific place.
There are a couple of scripts that are executed by bash automatically when it starts up, .bashrc, .bash_profile, .bash_login etc. In brief:
.bash_profile is only executed when you start bash with a login shell. eg. you ssh into the machine with a terminal.
.bashrc gets executed when you start bash off in a non-login, interactive mode. eg. when you ssh to a host and run a fixed command like 'ssh remotehost.com /bin/ls /tmp'
Neither of these two scripts are run when you startup bash in a non-interactive shell. eg when using the runuser -c command
You might want to dig up details on what these files are and what they do in a more bash specific place.
19/Feb/2010 @ 05:42
Comment from: Corey Henderson [Visitor] · http://cormander.com/
I've been using screen like this for about a year now. This is what I have at the bottom of my bash profile:
if [ -n "$SSH_TTY" ]; then
exec screen -xRR
fi
Be aware; doing this remembers all your exported variables but not your aliases. Put your aliases in your .bashrc file.
if [ -n "$SSH_TTY" ]; then
exec screen -xRR
fi
Be aware; doing this remembers all your exported variables but not your aliases. Put your aliases in your .bashrc file.
19/Feb/2010 @ 10:43
The only bad thing when using screen is 'Ctrl-PgUp & Ctrl-PgDn' stop working (scrollback)...
The only work-around I've found so far is to use Ctrl-A [ (copy) and the move the cursor up..
The only work-around I've found so far is to use Ctrl-A [ (copy) and the move the cursor up..
19/Feb/2010 @ 17:49
Comment from: Jason Launer [Visitor]
Much appreciated :) And I also prefer Foscarini's additiona of && exit to close the terminal on exit.. Saves that half a second to exit again.
11/Mar/2010 @ 09:19
This post has 2 feedbacks awaiting moderation...
18/Feb/2010 10:45:02 am, 