how can i display only and only hidden file in the current directory.
ls -a|grep "^\."
With zsh:
for all type of files:
print -l .*
for regular files only:
print -l *(.D)
P.S. . and .. are not matched per default.
ls -a|grep "^\."
is not working does grep supports regulaexepession ?
Are you sure it does not work ? That command worked just fine for me. Try this
ls -a | grep -e "^\."
See man grep for other flags. -e allows you to mention a pattern.
g/re/p
re stands for Regular Expression ...
Much easier:
ls -ad .*
Or I prefer:
ls -lad .*
1 Like
Or even without external commands (assuming builtin printf):
printf "%s\n" .*