/ finder-show-hidden-files
finder-show-hidden-files
 1  #!/bin/sh
 2  #
 3  # finder-show-hidden-files - Toggle visibility of hidden files in macOS Finder
 4  #
 5  # Sets the AppleShowAllFiles preference and restarts Finder to show/hide hidden files.
 6  # Defaults to showing hidden files if no argument is provided.
 7  #
 8  # Usage: finder-show-hidden-files [true|false]
 9  #
10  # Examples:
11  #   finder-show-hidden-files        # Show hidden files
12  #   finder-show-hidden-files false  # Hide hidden files
13  
14  if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
15    echo "Usage: $(basename "$0") [true|false]"
16    echo "Toggle visibility of hidden files in Finder"
17    echo "Defaults to 'true' (show hidden files) if no argument provided"
18    exit 0
19  fi
20  
21  status=${1:-true}
22  defaults write com.apple.finder AppleShowAllFiles $status
23  killall Finder