Linux command
unison 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Sync directories
unison [dir1] [dir2]
Sync with SSH
unison [local/path] ssh://[user@host]/[path]
Batch mode
unison -batch [dir1] [dir2]
Use profile
unison [profilename]
Show differences
unison -diff [dir1] [dir2]
说明
unison is a file synchronization tool that propagates changes in both directions between two directory replicas. Unlike one-way sync tools like rsync, unison detects modifications on both sides and reconciles them, making it suitable for keeping directories in sync across multiple machines. When conflicts arise from both replicas being modified, unison detects the conflict and presents options for resolution rather than silently overwriting changes. It can synchronize over SSH for remote directories or work with local paths. The tool tracks file state between synchronizations, so it only transfers files that have actually changed. Unison supports profiles that save synchronization configurations for repeated use, including path filters, ignore patterns, and connection settings. It runs on Unix, macOS, and Windows, and requires the same version of unison on both sides of a synchronization.
参数
- -batch
- Non-interactive.
- -auto
- Accept defaults.
- -diff
- Show differences.
- -force _ROOT_
- Force from root.
- -ignore _PATTERN_
- Ignore pattern.
- -path _PATH_
- Sync specific path.
FAQ
What is the unison command used for?
unison is a file synchronization tool that propagates changes in both directions between two directory replicas. Unlike one-way sync tools like rsync, unison detects modifications on both sides and reconciles them, making it suitable for keeping directories in sync across multiple machines. When conflicts arise from both replicas being modified, unison detects the conflict and presents options for resolution rather than silently overwriting changes. It can synchronize over SSH for remote directories or work with local paths. The tool tracks file state between synchronizations, so it only transfers files that have actually changed. Unison supports profiles that save synchronization configurations for repeated use, including path filters, ignore patterns, and connection settings. It runs on Unix, macOS, and Windows, and requires the same version of unison on both sides of a synchronization.
How do I run a basic unison example?
Run `unison [dir1] [dir2]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -batch do in unison?
Non-interactive.