1

I don't want to list recursively the sub directory as well. I have tried following but it did not worked correctly.

ls -lad ~/.* 
ls -la ~/.* 
Rinzwind
  • 293,910
  • 41
  • 570
  • 710
Life rocks
  • 33
  • 3

1 Answers1

0

Try:

$ ls -lA | grep ' \.'

The -A option to ls includes all hidden files, except . and ...
grep, as used above finds . (space, dot) and filters away lines that do not have that.

$ ls -lA | grep -E '^d.* \.
... lists only dirs.

$ ls -lA | grep -Ev '^d.*' | grep ' \.'
... lists only files.

... and that last can be used as alternative for files-only
$ ls -lA | grep -E '^d.*' | grep ' \.'
just remove the -v flag on grep

Hannu
  • 4,968
  • 1
  • 23
  • 40