cPanel Config

Welcome to cPanelConfig the fastest growing cPanel configuration and troubleshooting guide on the internet. Please take the time and register. We would love to have your contribution to this completely free cPanel resource. We are updating this daily so be sure to visit us on a regular basis.

Using the screen command

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Posted by yolau

What is the screen command?


First of all I will start by telling you what you can do using the “screen” command.
Many times as a linux sysadmin you will need to run multiple commands at once. You are probably doing this by opening multiple ssh sessions but there is a better way to do it !
Also as a sysadmin you probably had to run a command or script that is taking hours to finish like a rsync. This usually requires you to keep the ssh session open as if you close it the command or script will also be closed.

If you ever faced any of those problems then it’s probably time to learn about the screen command.

Screen - makes it possible to run multiple full-screen pseudo-terminals from one real terminal, and lets you manipulate and save your screen input and output, copy and paste between windows.

In this tutorial I will only present how you can run a command that is taking hours to complete in a screen.

First of all make sure that you have screen installed. If you don’t you can install it using yum, apt-get or any other package manager that you might have on your server.

yum install screen

Now type in:

screen

This will start a new screen for you. You could also name you screen using the -S option. Something like:

screen -S 1

In this case I named the screen “1″.

The screeen will look like any other ssh window.
You can now type in your command that you want to run.

If you want to detach from the screen and still keep the command running you can do this by pressing:

Ctrl-a d (that is press Ctrl-a, release and press d)

If you want to reatach to a screen you simply type in:

screen -r

Other options that you have when you are in a screen are:

  1. To create a new screen:
  2. Ctrl-a c

  3. To switch between screens:
  4. Ctrl-a n

  5. And many others.

For more help on this you can use:

man screen


Hope it helps!
If you have any questions just leave a comment.

Share this: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • del.icio.us
  • Slashdot
  • StumbleUpon
  • Netvouz
  • description
  • ThisNext
  • MisterWong
  • Wists
  • De.lirio.us
  • Furl
  • MyShare
  • Smarking
  • Technorati
  • YahooMyWeb

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

Leave a Reply