Hi all,
I want to get only hidden files(which are start with '.' or '..') information in a current directory. I tried the below command,
$ find . -name "^." -exec ls -la '{}' \;
but it's not working. Can anyone give me your outputs.
Thanks in advance,
Raghu.
The way to find hidden file is
find . -name ".*"
It will find all files including dot(.) And if you do exec on this ls -l . will print all the files in the directory....
Try:
for i in $(find . -name ".*")
do
if [[ $i = "." || $i = ".." ]]; then
continue
fi
ls -l $i
done
---------- Post updated at 02:32 PM ---------- Previous update was at 02:32 PM ----------
This will give all the files... not ONLY hidden files.
pludi
4
No need for the caret, just use
$ find . -type f -name '.*' -exec ls -l {} \+
Thanks for your reply Saga.
But I want output with hidden files only..
ls -la will give us the all files information including hidden files.
You have any clue?
Thanks,
Raghu.
-type f did the trick...interesting.