个人工具

“UbuntuHelp:Unison”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/Unison}}
 
{{From|https://help.ubuntu.com/community/Unison}}
 
{{Languages|UbuntuHelp:Unison}}
 
{{Languages|UbuntuHelp:Unison}}
#title Unison
+
Unison is a GUI and terminal-based tool which allows files and directories to be kept in sync with each other, between different local directories and drives or on a network, which could be on different operating systems. The application is available for Unix operating systems (Linux and Mac OS X) and Windows. Changes can be made on the different places, and Unison will update the machines with the correct versions of files and folders, copying, deleting, renaming or deleting files and directories as necessary.
Parent: [[UbuntuHelp:Software]]
+
== Examples of uses ==
== Unison - A File Synchronization Tool ==
+
Heres a few scenarios on which Unison would be useful:
From the [http://www.cis.upenn.edu/~bcpierce/unison/ Unison website]: ''Unison is a file-synchronization tool for Unix and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other.''
+
* Justine has a lot of music and would want to back it up to another drive in case her main drive fails. Unison can synchronize any new music she has added on her main hard drive, and will delete any music she has deleted from her main drive.
 +
* Ryan has a laptop and a desktop computer. He works on both regularly and wants to be able to have his latest work available on the computer he wants to use. Unison will be able to syncronise both computers over the network using SSH so that work he has done on his desktop will appear on his laptop, and when he wants to use his desktop again, he can sync the files to they are updated there.
 
== Installation ==
 
== Installation ==
Unison can be found in Ubuntu's Universe software repository, in the ''unison'' package. See [[UbuntuHelp:InstallingSoftware|InstallingSoftware]] for information about installing software, and [[UbuntuHelp:Repositories|Repositories]] if you need help enabling Universe.
+
Unison can be found in Ubuntu's Universe software repository, in the ''unison'' package. Many users will also want the ''unison-gtk'' package as well for a GTK GUI. See [[UbuntuHelp:InstallingSoftware|InstallingSoftware]] for information about installing software, and [[UbuntuHelp:Repositories]] if you need help enabling Universe.
In order to use Unison with Ubuntu and Microsoft Windows, you will need to have Samba installed and setup. For instructions on setting up Samba in Ubuntu, visit the [[UbuntuHelp:SettingUpSamba|SettingUpSamba]] wiki page.
+
In order to use Unison with Ubuntu and Microsoft Windows, you will need to have Samba installed and setup. For instructions on setting up Samba in Ubuntu, see [[UbuntuHelp:SettingUpSamba|SettingUpSamba]].
== GUI Configuration ==
+
== GUI usage ==
Unison uses ''Profiles'', this refers to the two ''root'' (directories) that are to be synchronized. On starting Unison via the Applications menu you will be presented with a window that allows you to select an existing profile or create a new one.  
+
Unison includes a GUI interface that allows you to graphically work with the application. You can access it by going to '''Applications -> Accessories -> Unison''' or by pressing Alt+F2 and typing ''unison''.
On selecting '''Create New Profile''' you will be asked to enter a profile name, such as "USB Stick". Once named the profile can be selected.  
+
=== Profiles ===
As the profile is new Unison will guide you though the steps of setting the roots. The first root should be a local directory for example ''/home/[Username]/work/''. The second root can be local or on a target machine. Unison allows synchronization to be carried out over a network using SHH (Further information at [[UbuntuHelp:SSHHowto|SSHHowto]]), RSH or a specific port on the target machine. Notice the '''Help''' button, this gives more information on setting up of remote access. Once this is complete Unison will scan the two locations and show the differences.
+
Different sync jobs in Unison are called 'Profiles'. For example, you may have a profile that synchronizes your music folder between two computers on a network, and another profile that synchronizes files between two drive. On starting Unison you will be presented with a window that allows you to select an existing profile or create a new one.
== Command Line usage ==
+
==== Choosing a profile ====
Unison can be invoked from the command line. This makes it a useful program for writing backup scripts  that clone two directories.
+
When you start Unison, you will be asked which profile you would like to use.
The following is a simple example to synchronize a music directory between two PC's.  
+
To change the profile you are using while inside Unison, go to '''Synchronization -> Select a new profile from the profile dialog''', or press P.
 +
==== Making a new profile ====
 +
On selecting Create New Profile you will be asked to enter a profile name. This name will represent the sync job when the Profile list appears when starting Unison.
 +
As the profile is new Unison will guide you though the steps of setting the root directories, which are the directories to be synced as part of the profile. The first root should be a local directory for example ''/home/[Username]/Music/''. The second root can be local or on a target machine. Unison allows synchronization to be carried out over a network using SSH (further information at [[UbuntuHelp:SSHHowto]]), RSH or a specific port on the target machine.
 +
Once this is complete Unison will scan the two locations and show the differences. You can then use the buttons '''Right to Left''', '''Merge''', '''Left to Right''' and '''Skip''' to tell Unison what it should do about each difference listed. Unison will guess which to do, but you will likely want to change it's guesses. Finally press '''Go''' to get Unison to perform all of your actions.
 +
== Terminal usage ==
 +
Unison can be used from the terminal.  
 +
The following is a simple example to synchronize a music directory between two folders.  
 
<pre><nowiki>
 
<pre><nowiki>
unison /home/[Username]/MyMusic /location_of_samba_directory
+
unison /home/[Username]/Music /location_of/other_directory
 
</nowiki></pre>
 
</nowiki></pre>
 
Or if a profile has been created.  
 
Or if a profile has been created.  
第26行: 第34行:
 
Unison can be setup to run on a schedule. This can be done by utilizing the "cron" scheduler. Further information regarding cron can be found at the [[UbuntuHelp:CronHowto|CronHowto]] wiki page.
 
Unison can be setup to run on a schedule. This can be done by utilizing the "cron" scheduler. Further information regarding cron can be found at the [[UbuntuHelp:CronHowto|CronHowto]] wiki page.
 
== Further Help ==
 
== Further Help ==
Included in Unison is a great help section, it can be found via the GUI under ''Help''. Its topics include the different interfaces, the basic concepts and ways of running Unison. I would highly recommend reading this for more detailed information.
+
Included in Unison is a great help section, it can be found via the GUI under Help. Its topics include the different interfaces, the basic concepts and ways of running Unison. I would highly recommend reading this for more detailed information.
Unison has many command line options available, for more information type
+
To access Unison's help from the terminal, use:
 
<pre><nowiki>
 
<pre><nowiki>
 
man unison
 
man unison
第35行: 第43行:
 
unison --help
 
unison --help
 
</nowiki></pre>
 
</nowiki></pre>
[[category:CategoryDocumentation]] [[category:CategoryCleanup]]
+
[[category:CategoryDocumentation]] [[category:CategoryApplications]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2008年10月19日 (日) 17:51的版本

Unison is a GUI and terminal-based tool which allows files and directories to be kept in sync with each other, between different local directories and drives or on a network, which could be on different operating systems. The application is available for Unix operating systems (Linux and Mac OS X) and Windows. Changes can be made on the different places, and Unison will update the machines with the correct versions of files and folders, copying, deleting, renaming or deleting files and directories as necessary.

Examples of uses

Heres a few scenarios on which Unison would be useful:

  • Justine has a lot of music and would want to back it up to another drive in case her main drive fails. Unison can synchronize any new music she has added on her main hard drive, and will delete any music she has deleted from her main drive.
  • Ryan has a laptop and a desktop computer. He works on both regularly and wants to be able to have his latest work available on the computer he wants to use. Unison will be able to syncronise both computers over the network using SSH so that work he has done on his desktop will appear on his laptop, and when he wants to use his desktop again, he can sync the files to they are updated there.

Installation

Unison can be found in Ubuntu's Universe software repository, in the unison package. Many users will also want the unison-gtk package as well for a GTK GUI. See InstallingSoftware for information about installing software, and UbuntuHelp:Repositories if you need help enabling Universe. In order to use Unison with Ubuntu and Microsoft Windows, you will need to have Samba installed and setup. For instructions on setting up Samba in Ubuntu, see SettingUpSamba.

GUI usage

Unison includes a GUI interface that allows you to graphically work with the application. You can access it by going to Applications -> Accessories -> Unison or by pressing Alt+F2 and typing unison.

Profiles

Different sync jobs in Unison are called 'Profiles'. For example, you may have a profile that synchronizes your music folder between two computers on a network, and another profile that synchronizes files between two drive. On starting Unison you will be presented with a window that allows you to select an existing profile or create a new one.

Choosing a profile

When you start Unison, you will be asked which profile you would like to use. To change the profile you are using while inside Unison, go to Synchronization -> Select a new profile from the profile dialog, or press P.

Making a new profile

On selecting Create New Profile you will be asked to enter a profile name. This name will represent the sync job when the Profile list appears when starting Unison. As the profile is new Unison will guide you though the steps of setting the root directories, which are the directories to be synced as part of the profile. The first root should be a local directory for example /home/[Username]/Music/. The second root can be local or on a target machine. Unison allows synchronization to be carried out over a network using SSH (further information at UbuntuHelp:SSHHowto), RSH or a specific port on the target machine. Once this is complete Unison will scan the two locations and show the differences. You can then use the buttons Right to Left, Merge, Left to Right and Skip to tell Unison what it should do about each difference listed. Unison will guess which to do, but you will likely want to change it's guesses. Finally press Go to get Unison to perform all of your actions.

Terminal usage

Unison can be used from the terminal. The following is a simple example to synchronize a music directory between two folders.

unison /home/[Username]/Music /location_of/other_directory

Or if a profile has been created.

unison "USB Stick"

Notice you do not need to specify a path, Unison searches in /home/[Username]/.unison/ for a corresponding profile. Depending on the size of the directories and the amount of files, a good amount of time may be needed. Unison can be setup to run on a schedule. This can be done by utilizing the "cron" scheduler. Further information regarding cron can be found at the CronHowto wiki page.

Further Help

Included in Unison is a great help section, it can be found via the GUI under Help. Its topics include the different interfaces, the basic concepts and ways of running Unison. I would highly recommend reading this for more detailed information. To access Unison's help from the terminal, use:

man unison

or

unison --help