如何在 Finder 中查看隐藏文件?
例如,如果我有一个名为:.something
is is not listing.
现在我必须打开终端并输入ls -la
。
答案1
打开终端并输入:
defaults write com.apple.finder AppleShowAllFiles TRUE
然后,输入以下命令重新启动 Finder:
killall Finder
要反转该操作,只需输入:
defaults write com.apple.finder AppleShowAllFiles FALSE
答案2
答案3
您可以使用此脚本在状态之间切换:
# check if hidden files are visible and store result in a variable
isVisible=”$(defaults read com.apple.finder AppleShowAllFiles)”
# toggle visibility based on variables value
if [ "$isVisible" = FALSE ]
then
defaults write com.apple.finder AppleShowAllFiles TRUE
else
defaults write com.apple.finder AppleShowAllFiles FALSE
fi
# force changes by restarting Finder
killall Finder
您还可以在此处下载可切换隐藏文件可见性的 Automator 应用程序:
答案4
将此 applescript 保存到服务中,以便从 Finder 菜单中使用。它将允许您打开或关闭隐藏文件,当您重新启动 Finder 时,它将重新打开到您之前所在的目录:
tell application "Finder"
set windowTargets to target of Finder windows
quit
end tell
set OnOff to do shell script "defaults read com.apple.finder AppleShowAllFiles"
if OnOff = "NO" or OnOff = "OFF" then
set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles ON"
else
set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles OFF"
end if
do shell script OnOffCommand
delay 1
tell application "Finder" to launch
tell application "Finder"
repeat with aTarget in windowTargets
make new Finder window at aTarget
end repeat
end tell