Files
nexus/wiki/concepts/SymbolicLink.md
2026-04-27 16:26:34 +08:00

46 lines
1.7 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: "SymbolicLink"
type: concept
tags: [filesystem, macos, linux, unix]
sources: [macos-创建与解除-symbolic-link-openclaw-目录映射]
last_updated:
---
## Definition
Symbolic Link符号链接简称 Symlink是 Unix/Linux/macOS 文件系统中的一种特殊类型文件,它指向另一个文件或目录的路径。访问符号链接时,系统会自动重定向到目标路径。
## Core Mechanism
```
~/openclaw -> ~/.openclaw
```
符号链接本身只存储目标路径字符串(轻量),不存储实际文件内容。删除符号链接不会影响目标文件/目录。
## Common Use Cases
| 场景 | 命令 |
|------|------|
| 创建目录符号链接 | `ln -s /path/to/target /path/to/link` |
| 删除符号链接 | `rm /path/to/link` |
| 验证链接存在 | `ls -l ~ \| grep linkname` |
| 查看链接目标 | `readlink /path/to/link` |
## Key Properties
- **非复制**:符号链接不复制数据,只存储路径引用
- **可跨文件系统**:可以指向任意位置的文件或目录
- **可链接目录**:目录也可以创建符号链接
- **透明访问**:应用程序访问符号链接时无感知重定向
- **危险操作**`rm -rf` 指向目录的符号链接会删除目标数据(注意区分)
## Relationship to Related Concepts
- [[目录映射]]:符号链接是实现目录映射的常用手段
- [[软链接策略]]:(如存在)符号链接的应用策略层
- [[ObsidianVault]]Obsidian 可通过符号链接访问非标准位置的笔记目录
## Related Entities
- [[OpenClaw]]:通过符号链接将隐藏目录 `~/.openclaw` 映射为可见目录 `~/openclaw`