Questions tagged [synchronization]

Use this tag when the topic is related to coordinating systems to have the same data or state or time. It can be part of redundancy.

Use this tag when the topic is related to coordinating systems to have the same data or state or time. It can be part of redundancy.

361 questions
255
votes
9 answers

scp without replacing existing files in the destination

How do I copy an entire directory into a directory of the same name without replacing the content in the destination directory? (instead, I would like to add to the contents of the destination folder)
biznez
151
votes
8 answers

How to sync two folders with command line tools?

Having migrated to Linux from Windows, I would like to find an alternative software to Winmerge or rather learn command line tools to compare and sync two folders on Linux. I would be grateful if you could tell me how to do the following tasks on…
user21417
51
votes
7 answers

How can I do a "copy if changed" operation?

I would like to copy a set of files from directory A to directory B, with the caveat that if a file in directory A is identical to a file in directory B, that file should not be copied (and thus its modification time should not be updated). Is…
Brooks Moses
  • 615
  • 1
  • 5
  • 7
43
votes
8 answers

Real-time file synchronization

Is there any tool available to sync files between two or more linux servers immediately after writing the file in the disk? The rsync command does not suit me on this, because if I set rsync in cron, the minimum time I can set is 1 minute, but I…
Sourav
  • 1,253
  • 2
  • 11
  • 16
33
votes
3 answers

Is there truth to the philosophy that you should sync; sync; sync; sync?

When I was first introduced to Linux, working at Cisco Systems in 2000, I was taught the merits of the sync command, used to flush buffers to disk to prevent filesystem corruption / data loss. I was told not only by coworkers there, but by friends…
Josh
  • 8,311
  • 12
  • 54
  • 73
31
votes
6 answers

Syncing directories in both directions with rsync

I happen to know about rsyn, and I use rsync to sync between my mac and a linux server as follows. rsync -r -t -v MAC LINUX rsync -r -t -v LINUX MAC I expected to run the first command to sync, but I needed the second command also when a change is…
prosseek
  • 8,418
  • 16
  • 47
  • 43
29
votes
2 answers

Is it safe to move a file that's being appended to?

I have a node.js process that uses fs.appendFile to add lines to file.log. Only complete lines of about 40 chars per lines are appended, e.g. calls are like fs.appendFile("start-end"), not 2 calls like fs.appendFile("start-") and…
Fluffy
  • 2,047
  • 3
  • 15
  • 18
28
votes
1 answer

Best way to sync files - copy only EXISTING files and only if NEWER than target

I'm doing this sync locally on Ubuntu 12.04. The files are generally small text files (code). I want to copy (preserving mtime stamp) from source directory to target but I only want to copy if the file in target already exists and is older than the…
MountainX
  • 17,168
  • 59
  • 155
  • 264
27
votes
9 answers

Any way to sync directory structure when the files are already on both sides?

I have two drives with the same files, but the directory structure is totally different. Is there any way to 'move' all the files on the destination side so that they match the structure of the source side? With a script perhaps? For example,…
Dan
  • 827
  • 2
  • 9
  • 17
27
votes
10 answers

How do I copy all files and directories, except certain ones over ssh?

Using the Linux command line, I use the scp command, to copy all the files and folders from a certain directory. However, I don't like to consume bandwidth, for copying things I rarely change like my tiny_mce folder. What's the trick to copy…
Mike McKee
26
votes
2 answers

How to sync terminal session command history in bash?

I've tried to search in ~/.bash_history for my recent commands while in a terminal session but they just weren't there. I guess this is because I have multiple terminal sessions open. Is there a way that I can sync (ie. sync-push or…
n611x007
  • 957
  • 3
  • 11
  • 21
23
votes
2 answers

Sync a folder between 2 computers, with a filesystem watcher so that each time a file is modified, it is immediately replicated

I have: a Linux server that I connect via SSH on IP 203.0.113.0 port 1234 a home computer (behind a router), public IP 198.51.100.17, which is either Debian or Windows+Cygwin What's the easiest to have a folder /home/inprogress/ synchronized (in…
Basj
  • 2,351
  • 9
  • 37
  • 70
22
votes
2 answers

Move files and delete directories with rsync?

Recently I needed to delete a large number of files (over 1 million) and I read that doing: rsync -av --delete `mktemp -d`/ ~/source && rmdir ~/source Was one of the most optimized ways to do that, and I can vouch that it's faster than rm -rf. I'm…
Alix Axel
  • 2,879
  • 4
  • 17
  • 13
21
votes
3 answers

bi-directional sync with rsync

I am trying to setup bi-direction or two way sync with rsync. In my case I only need to delete the files when syncing from B to A. So, I was thinking of running rsync twice as follow : rsync -rtuv ./A/ ./B/ rsync -rtuv --delete ./B/ ./A/ This…
Raza
  • 4,059
  • 7
  • 28
  • 33
19
votes
4 answers

sharing or synchronizing history between Zsh and Bash

I often find myself switching between Bash and Zsh, and using the history search functionality to recover a command. However, since Bash and Zsh have different history files, I often find that the command I'm searching for has been executed in the…
Andrei
  • 1,713
  • 1
  • 15
  • 18
1
2 3
24 25