Show only hidden files or directories under a directory
This article is for learning only:
Show all hidden files and directories
[root@localhost] # ls-ad. *
Ls: displaying list information
-a: shows that all files under the current directory or path contain hidden files
D: show only the contents of the current directory itself
The effect diagram is attached below.
Show all hidden directories
[root@localhost] # ls-d. * /
/ identified as a catalog file
The following is the effect picture
Show all hidden files
[root@localhost ~] # ll-ad. * | grep "^ -"
Ll: displaying in long format
. *: all files in the current directory that begin with a dotted star
"^ -": (-) means to reverse an ordinary document (^).
Meaning: show all hidden files that begin with a dot in the current directory in a long format and filter out files that are not ordinary file types.
The following is the effect picture
Or
[root@localhost] # find / root/-type f-name ". *"
Find all files under root that are normal files of type f and whose names begin with a dot.