June 1, 2009 · Networking, Server ·

Sponsored Link
This tutorial explain how to use screen and screen profiles in your ubuntu server.

Screen is a program that allows you to have multiple logins on one terminal. It is useful in situations where you are telnetted into a machine or connected via a dumb terminal and want more than just one login.
screen-profiles includes a set of profiles for the GNU screen window manager. These profiles are quite useful on server machines which are not running a graphical desktop. The ‘screen' command provides a number of advanced features are not necessarily exposed in the default profile. These profiles provide features such as status bars, clocks, notifiers (reboot-required, updates-available), etc. The profile-switcher allows users to quickly switch their .screenrc to any of the available profiles.

update-notifier-common provides a more efficient and standard mechanism for calculating the number of updates available in the status panel.

Install screen on Ubuntu server

sudo apt-get install screen screen-profiles screen-profiles-extras

This will complete the installation.

Note:- If you are using Jaunty all the above packages already installed in your server

Using Screen

From your ssh login prompt enter the following command

screen

or

screen -S 1

and select your profile option.

-S sessionname -- When  creating a new session, this option can be used to specify a meaningful name for the session. This name identifies the  session for "screen  -list" and "screen -r" actions.

Once it opens you should see similar to the following screen

Now in this screen we are using top command

If you want to open another session Ctrl a c -- Creates a new screen session so that you can use more than one screen session at once.

Once it opens you should see similar to the following screen

If you want to move between windows press CTRL+a followed by n key (first hit CTRL+a, releases both keys and press n).

To list all windows use the command CTRL+a followed by " key (first hit CTRL+a, releases both keys and press " ).

To switch to window by number use the command CTRL+a followed by ‘ (first hit CTRL+a, releases both keys and press ‘ it will prompt for window number).

Ctrl a p -- Switches to the previous screen session (if you use more than one).

Ctrl a d -- Detaches a screen session (without killing the processes in it -- they continue).

To close a screen session where all tasks are finished you can type

exit

If you want to know more available options check screen manpage using

the following command

man screen

Customise Screen-profiles

If you look in the bottom right corner you'll see there's an "F9 Menu" you can press F9 to reconfigure your screen profiles.Once it opens you should see similar to the following screen here you can see list of changes you can do

Sample screenshots for screen-profile options


Sponsored Link

10 Comments to “Screen – Manages multiple sessions on one terminal”

  1. steve123 says:

    apt-get can’t find screen-profiles or screen-profiles-extras i’m i missing something here?

    i’m on ubuntu server 8.10

  2. steve123 says:

    if anyone needs them you can get them here:

    wget http://ftp.us.debian.org/debian/pool/main/s/screen-profiles/screen-profiles_1.48-1_all.deb

    wget http://ftp.us.debian.org/debian/pool/main/s/screen-profiles/screen-profiles-extras_1.48-1_all.deb

    and to install them both:

    sudo dpkg -i screen-profiles_1.48-1_all.deb
    sudo dpkg -i screen-profiles-extras_1.48-1_all.deb

  3. Henry says:

    I’m a daily screen user.

    I don’t get the status bars at the bottom or the F9 menu. How can I enable them?

  4. steve123 says:

    @Henry please read my commend above yours it tells you how to download screen-profiles and how to install them 🙂

  5. Henry says:

    I had the necessary packages. I’m guessing some older configs I had were interfering, I got it working by deleting ~/.screen-profiles and ~/.screenrc

  6. Screen is a vital tool for the systems administrator. The author barely mentions the most powerful and important aspect of screen: I can be connected to any number of servers, start a task, detatch from the task, and the task keeps running. I can reattach later and see the results or the progress and intervene of needed. I can attach and detatch as often as I like. So long as I use the same login (same username) I can reattach from a different location as well, i.e.: start a job at the office and pick it up at home.

    I can’t believe the author used telnet as an example in this day and age. Don’t people understand that telnet passes the username and password in clear text? It’s an archaic security nightmare that should have been replaced by ssh everywhere years ago. I am amazed it still lingers on.

  7. Karl O. Pinc says:

    To use screen with emacs you must redefine the screen control key. (You could instead reconfigure emacs and rewire your nervous system to the new key sequences, but that’d be silly.)

    For instructions on using screen with emacs see:
    http://www.emacswiki.org/emacs/GnuScreen

  8. Mary Riley says:

    I absolutely love Screen! I use it on a daily basis, and it makes the CLI much more friendly.

  9. Peter Kelly says:

    Certainly a useful tool, especially if your connection is likely to drop as you can reconnect to your sessions. Only thing that annoys me is putty doesn’t play nice with it in terms of the screen buffer, but ctrl-a-[ mostly solves that issue.

  10. TWCrap says:

    Screen is indeed an nice program, but does somebody knows how can continue with your screen session after an reboot?

Leave a Reply

  • Recent comments