> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man1/fsync.1.md).

# fsync.1

`fsync` — 将文件在内存中的状态与磁盘上的状态同步

## 名称

`fsync`

## 概要

`fsync file`

## 描述

`fsync` 实用程序会将命令行上所列出的全部文件已修改的数据和元数据写入永久存储设备。

`fsync` 实用程序使用 fsync(2) 函数调用。

## 退出状态

如果发生错误，`fsync` 实用程序会继续处理下一个文件，并以大于 0 的值退出。否则以 0 退出。

## 参见

fsync(2), sync(2), [syncer(4)](https://github.com/FreeBSD-Ask/freebsd-man-sc/blob/main/man4/syncer.4.md), [halt(8)](https://github.com/FreeBSD-Ask/freebsd-man-sc/blob/main/man8/halt.8.md), [reboot(8)](/man/man8/reboot.8.md)

## 历史

`fsync` 命令首次出现于 FreeBSD 4.3。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man1/fsync.1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
