Jump to content

Screen: Difference between revisions

1,677 bytes added ,  3 November 2012
No edit summary
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Basics ==
== Basics ==
'''Screen''' usually does not exist. This is the committee's general position on screen due to the disastrous and/or hilarious situations which often result from new members' attempts to get it working. However, for the purpose of this tutorial, screen '''does''' exist, and this is how you use it. (Blame coconut for this defiance.)
'''Screen''' usually does not exist; this <s>is the committee's</s> was a former committee's general position on screen due to the disastrous and/or hilarious situations which often result from new members' attempts to get it working. However, for the purpose of this tutorial, screen '''does''' exist, and this is how you use it. (Blame coconut for this defiance.)


=== Omg, what's screen? ===
=== Omg, what's screen? ===
Line 67: Line 67:


=== Detaching and reattaching screen ===
=== Detaching and reattaching screen ===
One of the most popular features of screen is that it can keep you logged in even when you're offline. This means you can leave programs running or even stay on IRC even when you're not online. To do this, you just detach from screen instead of exiting it. To detach from screen without exiting, use the following command:
 
One of the most popular features of screen is that it can keep you logged in even when you're offline. This means you can leave programs running or even stay on IRC even when you're not online. When you "minimise" screen or make it invisible, it is called detaching it.
 
To do this, you just detach from screen instead of exiting it. To detach from screen without exiting, use the following command:
  ctrl-a d
  ctrl-a d


Line 76: Line 79:




Later, you'll come back online and want to reattach to your screen session. To reattach a detached screen, use this command at the prompt:
Later, you'll come back online and want to reattach to your screen session. When you "maximise" screen or bring it back onto your terminal, this is known as attaching. To reattach a detached screen, use this command at the prompt:
  screen -dr
  screen -dr


The -d will detach any "attached" screens and -r will reattach your screen.
The -d will detach any attached screens and -r will reattach your screen.


If you have more than one screen session available, you will need to specify the screen id you wish to open. You'll be given a list of the currently available screens, so then you type:
If you have more than one screen session available, you will need to specify the screen id you wish to open. You'll be given a list of the currently available screens, so then you type:
Line 86: Line 89:


followed by the id listed above of the screen you want to reattach to.
followed by the id listed above of the screen you want to reattach to.
=== Moving windows ===
If are in a window, but want it to move it to another, just type these commands while attached to screen and in that window, and replace '''x''' with the destination you want:
Ctrl + a
:
number x
For example, if you are in window number 2, press '''Ctrl+a''', then type the colon symbol (''':'''), then '''number 4''', to move that window to window 4.


=== Start and stop signals ===
=== Start and stop signals ===
Line 142: Line 154:
  hardstatus string '%{= kg}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%? %?%= %{g}][%{Y}%l%{g}]%{=b C}[ %d %M %c ]%{W}'
  hardstatus string '%{= kg}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{=b kR}(%{W}%n*%f %t%?(%u)%?%{=b kR})%{= kw}%?%+Lw%? %?%= %{g}][%{Y}%l%{g}]%{=b C}[ %d %M %c ]%{W}'
  deflogin off
  deflogin off
startup_message off
  screen -t irc 1 irssi
  screen -t irc 1 irssi
  screen -t Email/slrn 2 mutt -Z
  screen -t Email/slrn 2 mutt -Z
Line 157: Line 170:


This sets windows logged out by default, which means that you won't have to "mesg n" windows to not receive heys
This sets windows logged out by default, which means that you won't have to "mesg n" windows to not receive heys
startup_message off
This turns the startup message thats displayed when you start a new screen session off.


  screen -t heys -L -l  3
  screen -t heys -L -l  3
Line 168: Line 185:
[[Image:screenrc.jpg]]
[[Image:screenrc.jpg]]


===More commands===
=== Reattaching Screen Automatically ===
 
So, you've made your screen, configured it, and you happily type screen -dr '''every time''' you login to RedBrick. But wouldn't it be nice if whenever you login your screen would reattach '''itself'''??? It can be done :D
 
Simply use your favorite text editor to edit your ~/.zlogin if you're using zsh (if you haven't changed your login shell, this is the one you're using) or ~/.bash_login if you're using bash and put the following in it
 
screen -dr
 
That should do the job. It'll try to reattach a screen whenever you login on any redbrick server
 
* Please note, if this in fact, does not work, you can edit it out by using winSCP and editing the file using it.
 
== Useful links ==
If you'd like to learn more about the program, a long list of screen commands can be found here: http://www.linuxdevcenter.com/linux/cmd/cmd.csp?path=s/screen
If you'd like to learn more about the program, a long list of screen commands can be found here: http://www.linuxdevcenter.com/linux/cmd/cmd.csp?path=s/screen
Help edited a screenrc: http://www.debian-administration.org/articles/560
A starting guide to screen: http://magazine.redhat.com/2007/09/27/a-guide-to-gnu-screen/
The Gentoo wiki article on screen (quite in depth) : http://www.gentoo-wiki.info/Screen


[[Category:Helpdesk]]
[[Category:Helpdesk]]
145

edits