The Basic working of the screen is already explained in my previous article and if you are not really looking for advanced screen features, you should look at my previous screen article. The link for the same is: Basics of GNU Screen

But there are a lot of advanced features which screen provides which might come handy in a lot of scenarios. I will be explaining them under.

Info: The key bindings given in this tutorial are all case sensitive, so Ctrl+c is not equal to Ctrl+C

ScreenShots:

Instead of using the OS utility for taking screenshots, you can use the screen feature to take the snapshot of the current text in the window. Use “Ctrl+a” followed by “h“, will have a text file in your home directory with the name “hardcopy.n“, which will contain all the text from the console.

Logging:

The best thing what I like about screen is that you can have logs of anything you have done on screen, which can be used in lot of things in future. To enable logging, use “Ctrl+a” followed by “H“. This will create a file with name “screenlog.0” in your home directory, which will contain anything or everything you have done on the screen. If you want to stop logging, use the same, “Ctrl+a” & “H“.

You can also enable logging while starting your screen session, which can be done by using “-L” switch:

$ screen -L -S napster

Split Screen:

If you are really geeky (or you want to show that you are geeky :) ), then screen split is something you must be using. With that you can have move than one screens in just one display.

You can split your terminal windows horizontally and vertically (for vertical split, you need to patch your screen).

To Split the screen horizontally: Ctrl+a & S

To split the screen vertically: Ctrl+a & |

To switch between windows: Ctrl+a & Tab

To kill your current window: Ctrl+a & X

Sharing:

There are scenarios when different people login to a machine with different usernames and you would like to share your screen session with all of them, which normally is not possible as one user can’t attach to a screen of other user. To achieve this, you need to do some tweaking.

First, setuid root on screen binary.

$ sudo chmod +s `which screen`

Then create a  screen session:

$ screen -S napster

Turn multiuser mode “on” in the screen session:

Ctrl+q then :multiuser on

Then give permission to other users to attach to the screen

Ctrl+a -> :acladd student

Then ask them to attach to the screen

$ screen -x username/session

Sometimes you want others to watch and not to interfere, for that you need to make them read-only.

Ctrl+a -> :aclchg student -w “#”

This will make student as read-only, and student won’t be able to write anything in the screen.

To write something on the screen wall so that everyone could look at that:

Ctrl+a -> :aclchg student -w “#”

If you enjoyed this post, make sure you subscribe to my RSS feed!!!!