lost connection to linux server while running tar command

Posted on 2012-04-07
Last Modified: 2012-08-13
I'm stumbling my way through managing a linux server and have a question..

I have to connect via VPN and then use Putty to open a terminal to the server. I was running the tar command on a massive directory to create a backup, then the VPN connection was terminated and the putty connection went inactive. Which brings up three questions:
Did this interrupt the tar command?
If not, is there a way to verify it completed successfully or if it's still running?
And lastly, is there a better way to accomplish this task that isn't dependent on a persistent connection to the server?
Question by:musickmann
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
LVL 78

Expert Comment

ID: 37820379
Usually a break n the connection terminates all running commands in that shell unless screen is used or nohup precedes running of any commanding the background.
While the tar process may have been interrupted, the space used for the partial file wll not be freed.

Expert Comment

ID: 37821382
I generally connect with remote systems using VNC.  This gives me an X display, just like running on a local system.  But I can disconnect (or have the connection fail) without the X session and remote login disappearing.   When I reconnect, the session is still live and I can check on status.   Take a look at

Author Comment

ID: 37821945
Hmmm. I haven't considered using VNC. I inherited the servers from the previous person who was managing them, and so far nothing has seemed to be standard in their configuration.
It's a CentOS system, would that have a X display installed automatically, or will I have to install something else?
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 78

Accepted Solution

arnold earned 500 total points
ID: 37821967
You can run rpm -qa | grep -i xorg
If you are comfortable with text/terminal access, install screen.
Screen provides the option to have multiple terminal windows from a single connection while preserving the session in the even of dropped connection

I.e after you connect. You will run screen

Then you can do screen new command which will create a new screen that you can use Carl-a screen_number.
When you loose connection you would use screen -D -RR to resume the running screen.
screen -list will display a list of screen session the user has had and you can use this information to resume the session from the list.

Author Closing Comment

ID: 37842325
Wow, I couldn't have asked for a more perfect answer, this is exactly what I Was looking for all this time! I feel like such a derp with always have been creating multiple Putty sessions. DOH!

Author Comment

ID: 37860746
I've been using screen, and it's been very helpful. I just had a connection drop again in the middle of the session, but when I logged in again, the previous screen sessions weren't there.

I entered a screen session, began an FTP upload of a very large file
When the connection dropped, I reactivated the session (I use Putty), and went to list screen sessions and there were none, there should have been 2.

Did I misunderstand that screen would allow session recovery after connection drop?
LVL 78

Expert Comment

ID: 37861096
No, screen is supposed to keep running on disconnect.  could you make sure did not reboot, uptime?
last | more

Author Comment

ID: 37861136
Uptime is 5 days running.
I connect VPN to the network, then use Putty to connect to the server if that makes a difference.

Author Comment

ID: 37861220
I just tried again to see if it would maintain. I started several screen sessions. Closed the Putty window, when I next login I type screen hit enter, then pull up a list of screens and only 1 is listed.
Is there a special method to reactivate existing screens upon re-logging in?
LVL 78

Expert Comment

ID: 37861423
screen -list

screen -RDD <session_id> will resume that session.

Lets try to follow your steps. After you login to the server using putty you issue
screen (this is the main session, screen 0 though any remaining active screen means additional windows can be opened using the ctrl-c-ctrl a.)
you then want to access to server2 so you run
screen ssh user@server2 (this will not be opened as the next numerical screen, screen 1 crtl-a w will tell you how many sub sessions exist within this main screen  session. ctrl-a SHift-A will let you change the name of the individual screen sub session so it would be easier similar to using screen -t 'name of sub session')

If the systems to which you were connected reboot, the screen sub session to those will terminate as well.

To detach from your screen session, ctrl-c ctrl-d.

Author Comment

ID: 37862247
screen list provides
There are screens on:
        31273.pts-4.localhost   (Detached)
        14431.pts-0.localhost   (Detached)
        28313.pts-4.localhost   (Detached)
        29573.test      (Detached)
        30347.pts-4.localhost   (Detached)
        28880.test      (Attached)
        30978.pts-0.localhost   (Detached)
7 Sockets in /var/run/screen/S-root.

Once I login through putty to this server, I only stay in this server, I dont ssh to any other servers.
When I attempt to reconnect to 30347.pts4 putty closes.

I'm going to reboot the server when I can to clear out the screens and then try it again, I wasn't using the screen -list command before, so that might be what I was missing. I will let you know.

I really appreciate the follow up!
LVL 78

Expert Comment

ID: 37863490
screen -DRR <scketid from the list to resume that session>

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Palo Alto site-to-site vpn monitoring 5 64
Shrink Linux Swap File Size CentOS 10 66
VPN - Site to Site  not decapsulating (ASA-Sophos XG85) 1 28
phpmyadmin memory error 55 87
If you use NetMotion Mobility on your PC and plan to upgrade to Windows 10, it may not work unless you take these steps.
Fine Tune your automatic Updates for Ubuntu / Debian
After creating this article (, I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question