Is there a way to list all files and directories including .
and ..
but without listing hidden files in this folder?
Asked
Active
Viewed 5,345 times
3

Vlastimil Burián
- 28,462

yossico
- 141
2 Answers
11
First ensure that dotglob is off:
shopt -u dotglob
Then just ask ls
for those two directories and everything else:
ls -ld . .. *

Jeff Schaller
- 67,283
- 35
- 116
- 255
3
I think it could be easy to define the following as an alias for instance:
ls -ld \. \.\. *

Vlastimil Burián
- 28,462
-
4You don't need the backslashes, the dot isn't special to the shell. (It is in regexes, but shell filename patterns aren't regexes.) – ilkkachu Feb 06 '18 at 16:38
ls
, which is a shell faux pas. – gardenhead Feb 06 '18 at 16:30stat
on each file in afor
loop. – gardenhead Feb 06 '18 at 17:30stat --format=%A .
– Izkata Feb 06 '18 at 19:06