Linux Commands Examples

A great documentation place for Linux commands


flush file system buffers


sync [OPTION]

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!



Google Calendar / Exchange / Outlook Web Access sync

Try davmail - it allows access to your exchange calendar via ical. The way I use it :

  • configure davmail with my corporate outlook
  • In thunderbird (I am to TB3 beta) , create a calendar (iCal) which points to the davmail configuration

Now, I can access outlook via thunderbird.

Not sure if this solves your problem, as it does not by default "syncs" to google etc.


How to synchronize the home folder between multiple computers?

PowerFolder - Sync Files, Sync Folders, Remote Storage, Backup and Private File Sharing. Sync home and office PC, share holiday pictures or work together on documents. PowerFolder's secure peer-to-peer technology works over the Internet or in LAN.


Sync Android phone with Linux PC

You would need to write a Sync Adapter to synchronize your changes with your PC and other applications.

Android provides an example:


How can I automatically copy files to a USB drive when I connect it to my computer?

Edit: it turns out SyncBack SE has a trigger action:

Open Profile, go to “When†tab, then “Insertâ€. It lets you specify by drive letter, label, or serial number.

However the SE version is not free and Windows only (I think)

Or you could try adding an Autorun event for your syncing program (example for SyncToy) using TweakUI

  • Open TweakUI
  • Go to my computer –> autorun–> handlers
  • Click create
  • Find where Synctoy is located (program files as default)
  • Double click the program launcher logo
  • Select all the media radio buttons on the list below.
  • Click ok
  • Click apply.

  • Now plug in your pen drive.

  • In my computer right click the drive and select properties.
  • Click the autoplay tab
  • Select music from the drop down menu.
  • Click the radio button “select action to performâ€
  • Now select the sync with SyncToy logo
  • Repeat for the other options given by the drop down menu
  • Click apply then ok.
  • Remove and reinsert your drive to see if it has worked

I can't seem to find any (other) program that will start automatically when you connect your USB device.

They all rely on scheduling to start syncing. You could decide to have it scheduled every our, it will simply fail if the USB device is not connected and run if it is.

But too be honest it would be easier if you simply clicked on the sync button, you have to plug in your USB device manually as well.

Anyway I also found a synchronization tool that runs on both Linux and Windows: DirSync Pro which is completely free, runs on Java and has a nice GUI:

*  Synchronization
      o Powerful synchronization algorithm.
      o Bidirectional (Two way) and Unidirectional (One way) synchronization mode.
      o Option for various behavior of conflict resolution for Bidirectional Synchronization.
      o Synchronizes unlimited number of folders.
      o Large number of options to change the synchronization behavior.
      o Option to synchonise subdirectories recursively.
      o Synchronizes files/folders any file system (FAT, FAT16, FAT32, NTFS, WinFS, UDF, Ext2, Ext3, ...).
      o Synchronizes files from/to network drives
      o Synchronizes files from/to any mounted devices (Harddisks, USB-Sticks, Memory cards, External drives, CD/DVD's, ...).
      o Synchronization could be used for making incremental backups.
      o Option to create up to 50 backups from the modified/changed files before synchronization.
      o Option to define a backup folder.
      o Option for handling symbolic links.
      o Option for handling time-stamps.
* General
      o Easy, clear and user-friendly graphical user interface, no unnecessary gadget you never use.
      o Runs on every modern operating system including Windowsâ„¢, Linuxâ„¢ and Macintoshâ„¢
      o It is Portable! It does not need any installation. Just run the application!
      o Open source, it is 100% free of charge, 100% free of commercial text, 100% free of advertisements and 100% free of spyware.
      o No time/function limitations
      o Uses no local database, so no overhead
      o Does not need any installation. Just download and run it. You can put it on you USB-stick en you can run it on any computer/any platform.
* Logging
      o Advanced logging/reporting facilities. Just select a log level and define where to write the log.
      o Option to log on application level (default log)
      o Option to log on each directory level (dir log)
      o Option to define the log leven (how much to log)


Which twitter client can synchronize unread tweets?

I haven't tried it for myself, but Echofon claims to sync your unread/read-status between all their different clients and platforms. There is a Firefox-Plugin (Windows, Mac, Linux) and a Windows client is "coming soon", but unfortunately there's no Android client (yet?).


How can I permanently fix my date synchronize problem in linux?

I had the same problem yesterday but under Slackware 8. To make a long story short, I read a lot on google to finally reimage the computer. My manager sent me that link but it did not fixed my issue.

I changed the local to UTC time. I changed the timezome to have the good one I ln both.

Hope this will help you!

Also, you can try this:

hwclock --systohc


Syncing dropbox folder accross dual boot

I just symlink my dropbox folder to the windows version or something to that effect

Yes, you can do so.

but is there a way to do this and still have the daemon running and syncing correctly?

I'm not sure I understand, mount the Windows partition, install Dropbox in linux and symlink the Dropbox directory to the Windows directory and it will work fine.


Syncronizing files over FTP

Sure, and it is called wput


How to use unison's path option with multiple paths?

Yes, I am confirming what I stated in the question is correct.


How to use RSYNC to get unchanged files hard-linked and appended files copied locally + appended?

Well, I didn't think I was going to be able to accomplish this until I recently discovered a nifty trick you can do with rsync, and since nobody has answered in a while I'll present my solution.

The trick is when you use the following arguments:

rsync --suffix "" --backup-dir "." ...

This causes rsync to backup files before modifying them, but the backups turn out to be in-place, so you're actually making copies of the files before modifying them. This allows you to change files that were hard-linked with out changing the originals.

Then, the sequence to accomplish the desired behavior could be the following:

# locally hard-link the mutable files
rsync -ahv --link-dest C --include-from MUTABLE_FILES.filter C/* B

# copy locally + append remotely changed files 
# (also delete mutable files that disappeared at remote location A)
rsync -ahbv --suffix "" --backup-dir "." --append-verify \
      --include-from MUTABLE_FILES.filter --delete A/* B 

# now hard-link locally + transfer immutable files
rsync -ahv --link-dest C --include-from IMMUTABLE_FILES.filter A/* B

This probably could be solved with the first two steps without using filters but in my particular use case to guarantee coherence in the final destination I need the mutable files transfered before the immutable ones, and the default alphabetic ordering done by rsync does not guarantee this in my case. The reason why I need that is that the mutable files may get deleted and replaced by an immutable file. If I didn't transfer the immutable file because it didn't exist at the moment, but the mutable disappears before I get to it, I'm left with neither and I loose data.


Force changed blocks to disk, update the super block.


display this help and exit


output version information and exit


Copyright © 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <>.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

reporting bugs

Report sync bugs to bug-coreutils[:at:]gnu[:dot:]org
GNU coreutils home page: <>
General help using GNU software: <>
Report sync translation bugs to <>

see also


The full documentation for sync is maintained as a Texinfo manual. If the info and sync programs are properly installed at your site, the command

info coreutils 'sync invocation'

should give you access to the complete manual.


Written by Jim Meyering.

How can this site be more helpful to YOU ?

give  feedback