sync命令 – 刷新文件系统缓冲区

sync命令用于强制被改变的内容立刻写入磁盘,更新信息速度非常快, 在Linux/Unix系统中,在文件或数据处理过程中一般先放到内存缓冲区中,等到适当的时候再写入磁盘,以提高系统的运行效率。

sync命令则可用来强制将内存缓冲区中的数据立即写入磁盘中。用户通常不需执行sync命令,系统会自动执行update或bdflush操作,将缓冲区的数据写 入磁盘。只有在update或bdflush无法执行或用户需要非正常关机时,才需手动执行sync命令。

语法格式:sync [参数]





[root@linuxcool ~]# sync --help
 Usage: sync [OPTION] [FILE]…
 Synchronize cached writes to persistent storage
 If one or more files are specified, sync only them,
 or their containing file systems.
 -d, --data             sync only file data, no unneeded metadata
   -f, --file-system      sync the file systems that contain the files
       --help     display this help and exit
       --version  output version information and exit
 GNU coreutils online help:
 Full documentation at:
 or available locally via: info '(coreutils) sync invocation'


[root@linuxcool ~]# sync --version
 sync (GNU coreutils) 8.30
 Copyright (C) 2018 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.
 Written by Jim Meyering and Giuseppe Scrivano.
Red Hat | 睿氪OS » sync命令 – 刷新文件系统缓冲区


立即查看 了解详情