Files
nexus/wiki/concepts/caffeinate.md
weishen e62797a33a Batch 9: Obsidian插件/AI开源平替/Coze培训/TK面单/Ubuntu科学上网
- Sources: 5个新文档
- Concepts: ProxyChains, SOCKS5代理, Docker Daemon代理
- Index: 更新至 Batch 9
- 累计 sources: 108/182
2026-04-16 06:36:36 +08:00

34 lines
1.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: "caffeinate"
type: concept
tags: [macos, power-management, cli, server]
date: 2026-03-15
---
## Definition
caffeinatemacOS 内置工具,在指定命令执行期间临时阻止系统进入睡眠状态,不修改系统电源管理设置,执行完毕自动恢复睡眠行为。
## Key Commands
| 命令 | 作用 |
|------|------|
| `caffeinate -d` | 防止显示器睡眠 |
| `caffeinate -i` | 防止系统空闲时睡眠 |
| `caffeinate -s` | 防止系统睡眠 |
| `caffeinate -u` | 模拟用户活动(防止睡眠) |
| `caffeinate -d -i -s` | 全开,按 Ctrl+C 停止 |
## Comparison with pmset
- **pmset**:永久修改系统电源管理设置,重启后保持
- **caffeinate**:临时防止睡眠,进程结束即恢复,适合一次性任务
## Use Cases
- 执行备份、拷贝等长时间任务时临时防止睡眠
- 远程 SSH 会话中保持系统活跃
## Related Concepts
- [[pmset]]:永久电源管理配置
- [[WOL]]:配合 caffeinate 使用,长时任务后远程唤醒
## Source
[[Mac-Mini-服务器配置-防止自动锁屏与睡眠]]