Google Answers Logo
View Question
 
Q: UNIX program "screen" and using Ctrl-SomethingElse instead of Ctrl-A ( Answered 5 out of 5 stars,   0 Comments )
Question  
Subject: UNIX program "screen" and using Ctrl-SomethingElse instead of Ctrl-A
Category: Computers > Software
Asked by: happie-ga
List Price: $5.00
Posted: 14 Oct 2002 20:19 PDT
Expires: 13 Nov 2002 19:19 PST
Question ID: 76663
I'm using screen (3.07.02) on UNIX, which uses Ctrl_A as the
attention/command key.  Since Ctrl_A is used by emacs to jump to the
start of a line, I'd prefer to have screen use a more obscure Ctrl key
(say Ctrl_\) instead of Ctrl_A.

I'm looking for an example configuration setting to do this that I can
add to my .screenrc file (assuming it's possible to do).
Answer  
Subject: Re: UNIX program "screen" and using Ctrl-SomethingElse instead of Ctrl-A
Answered By: leep-ga on 14 Oct 2002 22:54 PDT
Rated:5 out of 5 stars
 
One way of doing this is via a switch when you start screen.  I think
this section of the Screen man pages applies to what you are asking
about:
---------------------
-e xy

specifies the command character to be x and the character generating a
literal command character to y (when typed after the command
character). The default is «C-a» and `a', which can be specified as
«-e^Aa". When creating a screen session, this option sets the default
command character. In a multiuser session all users added will start
off with this command character. But when attaching to an already
running session, this option changes only the command character of the
attaching user. This option is equivalent to either the commands
«defescape» or «escape» respectively.
----------------------

I invoked screen by using:  screen -e ^Ww  and confirmed that ^W was
the command character.   So I could, for example, do ^W-? and get the
Help screen. Ctrl-A and then ? no longer worked.

You can also add the escape command to the .screenrc file, as
explained in the man pages:

---------------------

escape xy

     Set the command character to x and the character  generating
     a  literal  command character (by triggering the "meta" com-
     mand) to y (similar to the -e  option).   Each  argument  is
     either  a  single character, a two-character sequence of the
     form "^x" (meaning "C-x"), a backslash followed by an  octal
     number  (specifying  the  ASCII code of the character), or a
     backslash followed by a second character, such  as  "\^"  or
     "\\".  The default is "^Aa".
---------------------

I put:   escape escape ^Wq into my .screenrc and confirmed that it
took ^W as the command character instead of ^A.   In your case, the
important thing is to put a blackslash in front of your desired
backslash character.   Also, you will need to type the carat (^) and
not simply hit the control key when initially defining these new
command characters.

To be honest though, I haven't used Screen in a long time and I'm not
exactly certain what the second character (the y variable) in the
above cases do.

It looks like screen does an awful lot nowadays and you might want to
skim through the screen man pages by typing:  man screen   at a prompt
or by visiting this web page:
http://software.oit.pdx.edu/cgi-bin/hman-local?ManSection=1&ManTopic=screen

The manual pages describe a lot of the customization you can do to it.

It's possible that the version you are using (3.07.02) does not allow
you to change the default command character.  In that case you might
look into getting a newer version installed.

I hope this information is helpful.  If you would like for me to
clarify any part of my answer or further research your question,
please let me know before issuing a rating. Thanks!


leep-ga
happie-ga rated this answer:5 out of 5 stars
Thanks, exactly what I was looking for.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy