On my remote, I have a recursive directory 'dir'. I try to copy all the files in 'dir' into a folder in another location on the remote on Linux. It copies and an hour later or so on the terminal I get;

Session stopped
    - Press <return> to exit tab
    - Press R to restart session
    - Press S to save terminal output to file

Network error: Software caused connection abort

This happens each time. I don`t know if it stopped after it copied everything or before. I compared the size of the two files using;

du -sh file_path

They are 71G and 70G.Does anyone know why this network error occurs, and how can I prevent it? I use mobaXterm, and although I didn`t watch every minute of it but I didn't see internet disconnection during the copying. thanks

  • Try turning on the Enable SSH keepalive setting on mobaxterm. – Mark Plotnick Jan 30 at 20:56
  • I had no idea such an option exist, thank you very much, i just checked, it was unchecked in settings. – kutlus Jan 30 at 20:59

I can't really help you on the disconnection issue, but if the problem still exists and/or annoys you, you could copy the files with the nohup command. This would keep the copy process alive even if you get disconnected.

To synchronize your source and destination directory using rsync, you could use

nohup rsync -av /path_to/source_directory/ /path_to/destination_directory &

This would copy all remaining files and directories (if any) from the source to the destination directory and would also make sure that no "partly" copied files are left in the destination directory.

Another possibility to check if both directories contain the same files is the use of diff:

# compare dirs and watch result in terminal
diff -r /path_to/source_directory /path_to/destination_directory
# compare dirs and write result to diff.log (disconnection failsafe)
nohup diff -r /path_to/source_directory /path_to/destination_directory > diff.log &

The second command would create a logfile diff.log of all files only existing in one of both directories as well as all files with differences (partly copied) and thus help you find out at which point the copy process was aborted.

  • I was searching how I could use rsync instead and got your answer, very helpful, many thanks! – kutlus Jan 30 at 18:52
  • Thanks! Make sure you add the trailing slash "/" to the source directory, otherwise you will copy your source directory as subdirectory to the destination dir. If you previously did a cp -r /home/user/dir1 /tmp/dir2 you will need rsync -av /home/user/dir1/ /tmp/dir2. – Freddy Jan 30 at 18:57
  • Hi, yes, I do put "/". Also I have just tried 'diff -r command and saw the difference between two folders. Learned two things today from you, thank you! – kutlus Jan 30 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.