sync Command Cheat Sheet
sync synchronizes cached writes to persistent storage. It forces the kernel to write data buffered in memory out to disk.
Synopsis
sync [OPTION] [FILE]...
Basic Usage
Sync Everything
Flushes all file system buffers.
sync
Sync Specific File
Only sync data related to specific files.
sync big_database.db
Sync File System (-f)
Sync the file system containing the file.
sync -f /mnt/usb/
Notes
- Shutdown: valid
shutdown,reboot, andhaltcommands automatically runsync. - Time: If you copy a massive file and run
sync, the command prompt will hang until the write is physically complete.