The first example is super super bad here. Never pipe `ls`. When you feel like you need to pipe `ls`, then you know you want to use `find`.
I understand that you don't want to be mean but this post is neither. It's like a bad gun safety video where the alleged instructor points a loaded gun at school children and then looks down the barrel while polishing the trigger...
[1] https://unix.stackexchange.com/questions/128985/why-not-pars...
The find would be something like
find . -not -path '*/\.*' -type f -depth 1
What advantages does that have over 'ls' for that case?The gp was talking about issues with piping from "ls |" and your particular case of "find" being more convoluted than "ls" isn't comparing that.
Example of the topic that gp was warning about:
http://mywiki.wooledge.org/ParsingLs
https://unix.stackexchange.com/questions/128985/why-not-pars...
[Also fyi... you may have meant "-maxdepth" instead of "-depth" in your example.]
echo ^.*
will show all non-dotfiles in the current directory. echo *
does not expand dotfiles. I guess there's some setopt for that. echo (*)#.*
This prints all dot files and regular files in the current directory. You do need to have `setopt EXTENDED_GLOB` somewhere in your zsh config. rg 'MySearchString' **/*.js[x]#~*spec*
Voila. Note that this is for zsh, and you need to set the EXTENDED_GLOB option. But once you do you'll find yourself rarely needing to reach for `find`.ls |less