- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to flushes file system buffers in the Linux operating system?
To synchronize cached writes to persistent storage, we use the sync command in the Linux operating system.
The sync command is used to synchronize corresponding file data in volatile memory and persistent storage.
Syntax
The general syntax of the sync command is as follows −
sync [OPTION] [FILE]...
A brief description of options available in the sync command
Sr.No. | Option & Description |
---|---|
1 | -d, --data Synchronize only file data, no unneeded metadata. |
2 | -f, --file-system Synchronize the file systems that contain files. |
3 | --help Displays a help message and then exits. |
4 | --version It gives info about the version and then exits. |
Note - If one or more files are specified, synchronize only them, or their containing file systems.
To synchronize all cached files of the current user in the Linux operating system, we use the sync command with sudo privilege as shown below.
$ sudo sync
The sync command works silently without displaying anything on the terminal.
To synchronize only file data, no unneeded metadata in the Linux operating system, we use -d option with the sync command as shown below
$ sync -d shadow/file.txt
In the above example, a file ‘file.txt’ available in the shadow directory.
To synchronize only file systems that contains the files in the Linux operating system, we use -f or --file-system with the sync command as shown below.
$ sync -f shadow/file.txt
To display the version information of the sync command in the Linux operating system, we use the --version option with the sync command as shown below.
$ sync --version
To check more information about the sync command in the Linux operating system, we use the --help option with the sync command as shown below.
$ sync --help
- Related Articles
- How to find out linux operating system system is 32 bit or 64 bit
- Difference Between Linux and Windows Operating System
- How are system calls connected to the operating system?
- How to Create a New Ext4 File System in Linux?
- How to remove files and directories in the Linux operating system using the terminal?
- What are the differences between Unix and Linux Operating System?
- How to Create a File in the Linux/Unix system using terminal?
- How to format contents of a text file in the Linux system?
- How to display the first part of the file in the Linux system?
- How to display the last part of the file in the Linux system?
- How to Determine the File System Type in Linux (Ext2, Ext3 or Ext4)?
- Difference Between Network Operating System and Distributed Operating System
- What are system calls in Operating System?
- What are the different system calls in the operating system?
- Semaphores in Operating System
