> 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/man7/sticky.7.md).

# sticky.7

`sticky` — 粘滞文本和仅追加目录

## 名称

`sticky`

## 描述

一种特殊的文件模式，称为*粘滞位*（mode S\_ISTXT），用于指示对目录的特殊处理。对于常规文件，它会被忽略。有关文件模式的说明，请参见 chmod(2) 或文件

`#include <sys/stat.h>`

## 粘滞目录

设置了粘滞位的目录将成为仅追加目录，或更准确地说，是其中文件删除受到限制的目录。粘滞目录中的文件只能由用户在以下情况下删除或重命名：该用户对该目录具有写权限，且该用户是文件的所有者、目录的所有者或超级用户。此功能可有效地应用于诸如 **/tmp** 之类的目录，这些目录必须公开可写，但应禁止用户随意删除或重命名彼此的文件。

任何用户都可创建粘滞目录。有关修改文件模式的详细信息，请参见 [chmod(1)](/man/man1/chmod.1.md)。

## 历史

`sticky` 命令首次出现于 Version 32V AT\&T UNIX。

## 缺陷

open(2) 和 mkdir(2) 都不会创建设置了粘滞位的文件。


---

# 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/man7/sticky.7.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.
