1. 程式人生 > 實用技巧 >如何與Ubuntu One同步配置檔案

如何與Ubuntu One同步配置檔案

Ubuntu One lets you easily synchronize files and folders, but it isn’t clear how to sync configuration files. Using Ubuntu One’s folder synchronization options or some symbolic links, you can synchronize configuration filesacrossall your computers.

Ubuntu One使您可以輕鬆地同步檔案和資料夾,但是不清楚如何同步配置檔案。 使用Ubuntu One的資料夾同步選項或某些符號連結,您可以在所有計算機之間同步配置檔案。

The same method should work with other cloud storage synchronization programs, including Dropbox. It also creates an online backup of your important files, so it’s useful even if you don’t have multiple Ubuntu systems.

相同的方法應適用於其他雲端儲存同步程式,包括Dropbox。 它還會建立重要檔案的線上備份,因此即使您沒有多個Ubuntu系統,它也很有用。

Ubuntu One安裝 (
Ubuntu One Setup)

If you haven’t set up Ubuntu One yet, you’ll have to set it up before synchronizing files. Click the mail icon on the panel and select “Ubuntu One.”

如果尚未設定Ubuntu One,則必須在同步檔案之前進行設定。 單擊面板上的郵件圖示,然後選擇“ Ubuntu One”

Click the “Join Now” button and create an account.

點選“立即加入”按鈕並建立一個帳戶。

On your other computers, click the “I already have an account!” link and sign in with your existing account.

在其他計算機上,單擊“我已經有一個帳戶! ”連結並使用您現有的帳戶登入。

After you do this, you’ll get a “Ubuntu One” folder in your home folder. All files in this folder areautomaticallysynchronized between your computers.

完成此操作後,您將在主資料夾中找到一個“ Ubuntu One”資料夾。 此資料夾中的所有檔案將在計算機之間自動同步。

同步配置資料夾 (Synchronizing Configuration Folders)

Configuration folders are hidden by default, so you’ll have to click the View menu in the file manager and select “Show Hidden Files” to see them.

預設情況下,配置資料夾是隱藏的,因此您必須單擊檔案管理器中的“檢視”選單,然後選擇“顯示隱藏的檔案”以檢視它們。

Once you have, you’ll see yourconfigurationfiles. Each begins with a . — this is how files and folders are hidden on Linux.

擁有之後,您將看到您的配置檔案。 每個以開頭 —這就是在Linux上隱藏檔案和資料夾的方式。

Right-click the folder you want to synchronize, point to the Ubuntu One submenu and click “Synchronize This Folder.”

右鍵單擊要同步的資料夾,指向Ubuntu One子選單,然後單擊“同步此資料夾”

A green check mark appears on each folder you’re synchronizing.

一個綠色的複選標記出現在您正在同步的每個資料夾上。

From the Ubuntu One window, you can view all your synchronized folders.

在Ubuntu One視窗中,您可以檢視所有同步的資料夾。

Before the folder will synchronize, you’ll have to open the Ubuntu One configuration window on your other computers.

在資料夾同步之前,您必須在其他計算機上開啟Ubuntu One配置視窗。

You must enable the “Sync locally?” check box on each other computer.

您必須啟用“本地同步? 對方計算機上的”複選框。

Ubuntu One will keep the configuration folder in syncacrossall your computers.

Ubuntu One將使配置資料夾在所有計算機上保持同步。

Of course, you can use this method to synchronize any folder.

當然,您可以使用此方法來同步任何資料夾。

同步單個檔案 (Synchronizing Individual Files)

Ubuntu One won’t let you synchronize a single file from the right-click menu. If you try, you’ll see all the options grayed out.

Ubuntu One不允許您從右鍵單擊選單同步單個檔案。 如果嘗試,您會看到所有選項均灰顯。

To synchronize a specific configuration file, you’ll have to move it to your Ubuntu One folder. You can do this with the cut and paste option from the file manager or with the mv command in the terminal.

要同步特定的配置檔案,您必須將其移動到Ubuntu One資料夾。 您可以使用檔案管理器中的剪下和貼上選項或終端中的mv命令來執行此操作。

Here, we’ve moved our .bashrc file to the Ubuntu One folder. It no longer exists in our home folder.

在這裡,我們已將.bashrc檔案移至Ubuntu One資料夾。 它不再存在於我們的主資料夾中。

We can use the ln -s command to create a symbolic link from the file in the Ubuntu One directory to the file’s original location. For our .bashrc example, we’d use the following command:

我們可以使用ln -s命令建立從Ubuntu One目錄中的檔案到檔案原始位置的符號連結。 對於我們的.bashrc示例,我們將使用以下命令:

ln -s /home/howtogeek/Ubuntu\ One/.bashrc /home/howtogeek

ln -s / home / howtogeek / Ubuntu \ One / .bashrc / home / howtogeek

In other words, the syntax is:

換句話說,語法為:

ln -s /path/to/file /original/location

ln -s /路徑/到/檔案/原始/位置

Note that you can’t create a symlink and place it in the Ubuntu One directory. Ubuntu One ignores symlinks.

請注意,您無法建立符號連結並將其放置在Ubuntu One目錄中。 Ubuntu One忽略符號連結。

If you check your home folder after this, you’ll see that there’s now a symbolic link to the file in the Ubuntu One folder.

如果在此之後檢查您的主資料夾,您將看到在Ubuntu One資料夾中現在有一個指向該檔案的符號連結。

On your other computers, you’ll have to delete the original configuration file and run the same command to create the appropriate symlink.

在其他計算機上,您將必須刪除原始配置檔案並執行相同的命令來建立適當的符號連結。

You can use this method to synchronize any file at any location. Most of the time it will make more sense to copy the file to the Ubuntu One folder, though.

您可以使用此方法在任何位置同步任何檔案。 不過,在大多數情況下,將檔案複製到Ubuntu One資料夾更有意義。

翻譯自: https://www.howtogeek.com/108000/how-to-synchronize-your-configuration-files-with-ubuntu-one/