用 open -R 在访达中显示文件
open 命令的 -R 标志会打开访达窗口并选中、高亮目标文件——相当于"在访达中显示",即使路径位于访达通常隐藏的位置也有效。
运行 `open -R path/to/file` 即可打开所在文件夹并选中该文件。
01命令
命令
$ open -R ~/Library/Preferences/com.apple.dock.plist
open -R ~/Projects02作用说明
不带 -R 时,open 会用默认应用打开文件;加上 -R 后,访达改为打开父文件夹并高亮该条目。对于 ~/Library 这类手工导航非常麻烦的深层资源库路径特别有用;对文件夹同样有效(会在其父级中选中该文件夹)。
03风险
!注意: 对点开头的文件(如 .zshrc),访达会显示该文件,但父文件夹中其他内容可能不可见;选中状态仍会出现。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- open — open files and directories (macOS)依据: Documents the -R flag: reveal the file in Finder instead of opening it.
- Quickly locate a file or folder on Mac依据: Covers locating items in Finder, the behavior that open -R automates.
最后验证: 2026-09-17 · 分类: 文件与文件夹