How to display only hidden files in UNIX?
-
ls -a
-
ls -a|grep "^."
-
ls -a|grep "^."
-
ls -ltra
C
Correct answer
Explanation
To display only hidden files (files starting with a dot), you use 'ls -a' to list all files including hidden ones, then pipe to grep with pattern '^.\' which matches lines starting with a dot. Option A shows all files including non-hidden ones. Option B uses '^.\' which incorrectly excludes hidden files. Option D shows all files in long format with time reversed, not just hidden files. The grep filter in option C correctly isolates the dot-prefixed entries.