Auto-sync: 2026-04-17 08:37
This commit is contained in:
39
wiki/concepts/Symbolic-Link.md
Normal file
39
wiki/concepts/Symbolic-Link.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
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]] — 通过符号链接访问非标准路径的文件
|
||||
Reference in New Issue
Block a user