~~~really useful info about screen~~~~

here's what I do

Create a .screenrc text file in your home directory, with this as the contents:

hardstatus alwayslastline '%{= kg}[ %{G}%H %{g}][%= %{= kB}%?%-Lw%?%{+b r}(%{G}%n*%f %t%?(%u)%?%{r})%{-b B}%?%+Lw%?%?%= %{g}%]'
escape ^Jj
screen -t wall 1
select 1
stuff "mesg y^M"
screen -t nowall 2
select 2
stuff "mesg n^M"
screen -t irc 0 irssi -c irc
That will create a new screen session with the following characteristics (roughly in above order): Save/close that file, and then run screen -U at the command prompt. With a config file like this, it takes a few seconds for all that to happen when you start screen, so be patient.

How to switch to the next/prev window:
Ctrl-a n and Ctrl-a p

How to detach from screen session (and leave it running):
Ctrl-a d
(or if your connection to the server dies, the screen session will automatically detach and continue running)

How to reattach to (re-enter) the screen session:
screen -DR
This was ~pepper's suggestion, and it works well for me. If there are multiple sessions running, it will show you a list of PIDs so you can connect to a specific one using the method for connecting to a named session below.

How to scroll up/down:
Ctrl-a [
Then:
Ctrl-u or Ctrl-d or Ctrl-b or Ctrl-f
Make sure you are in "Copy mode" ( Ctrl-a [ ) before doing Ctrl-d, because otherwise it will end your session. Hit ESC to exit Copy mode.

How to search within scrollback:
Ctrl-a [
Then:
Ctrl-s (or Ctrl-r for searching backwards, which I tend to find more useful)
Then type your search term and hit Enter. Then hit Ctrl-s or Ctrl-r again to find next/previous occurrence. Hit ESC to exit Copy mode.


More info, but I pretty much stick to the above things

How to create a new screen session:
screen -U
(the -U is for utf-8)

How to create a new window within that session:
Ctrl-a c

How to rename the current window:
Ctrl-a A
then delete the current name, type the new name, and hit Enter

How to change Ctrl-a to something else:
Put this in your .screenrc file in your home directory (create .screenrc file if you don't have one yet):
escape ^Jj
That changes it to Ctrl-j, which means instead of Ctrl-a in all these, you'd use Ctrl-j.

How to apply new changes in .screenrc while in a screen session:
Ctrl-a :
That's Ctrl-a then colon
Then type:
source ~/.screenrc
Hit Enter.

How to know what window you're in:
Put this in your .screenrc file in your home directory:
hardstatus alwayslastline '%{= kg}[ %{G}%H %{g}][%= %{= kB}%?%-Lw%?%{+b r}(%{G}%n*%f %t%?(%u)%?%{r})%{-b B}%?%+Lw%?%?%= %{g}%]'
That makes it show the active/inactive window names at the bottom of your terminal, and some other info.

How to create a new screen session named xyz:
screen -U -S xyz

How to reattach to (re-enter) the xyz screen session:
screen -DR xyz
(the -D is just in case it hasn't detached from your last session, but it works even if it's already detached)

How to see a list of all running screen sessions:
screen -ls


Stuff I hope to add in the future:


How I learned this stuff:


[home]

Real Time Web Analytics