Files
nexus/wiki/concepts/Symbolic-Link.md
2026-04-17 08:38:12 +08:00

39 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: "Symbolic Link"
type: concept
tags: [filesystem, macos, linux]
last_updated: 2025-01-14
---
## Definition
符号链接Symbolic Link又称软链接是一种特殊类型的文件它包含指向另一个文件或目录的路径引用。符号链接类似于 Windows 中的快捷方式或 macOS 中的替身Alias
## Technical Details
- 通过 `ln -s` 命令创建
- 符号链接文件大小仅为目标路径的字节数
- 删除符号链接不影响原始文件/目录
- 可以跨文件系统创建
## Use Cases
- 将隐藏目录映射为可见目录(如 OpenClaw 的 ~/.openclaw → ~/openclaw
- 在不同位置访问同一文件
- 创建项目结构的符号链接以方便访问
## Commands
```bash
# 创建符号链接
ln -s <target> <link_name>
# 验证符号链接
ls -l ~ | grep <link_name>
# 查看符号链接目标
readlink <link_name>
# 删除符号链接(仅删除链接,不删除目标)
rm <link_name>
```
## Related
- [[OpenClaw]] — 使用符号链接将隐藏目录映射为可见目录
- [[Obsidian]] — 通过符号链接访问非标准路径的文件