2

Using commands within the terminal how can I check to see if a specific file is visible or hidden for a user?

6

There are two ways to hide files from OS X Finder (unless it's set up to show hidden files, or the user wants to see these files in a file dialog):

  • Rename so the name starts with a period (.), e.g. .bash_profile. This is common with software with Unix roots.
  • Set the hidden file flag. Some system folders, notable ~/Library, have this flag by default.

The former is easy to see by running ls -A (-A showing files whose names start with a period), for the latter you need to use ls -lO and look for the value hidden in the column between owning group name and file size.

1

Simply…

file.doc is visible

.file.doc is hidden

The user can choose to view invisibles, so a hidden flag is not sufficient to make any file 'unobtainable' to the user, if they are resourceful enough.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.