Re: The ls command
On Fri, 31 Oct 2025 at 03:44, Greg Wooledge <greg@wooledge.org> wrote:
> On Fri, Oct 31, 2025 at 04:26:06 +0100, Vincent Lefevre wrote:
> > On 2025-10-30 17:39:33 +0000, alain williams wrote:
> This whole thread is insane.
True.
I'm surprised your capslock stayed off. :D
[..]
> To find the file(s) whose name begins with a hyphen, just use this:
>
> ls -- -*
Anyone who thought 'grep' was a good idea in this thread would benefit from
thinking about why the above works and why reaching for 'grep' to solve the
OP's problem is an unecessary increase in the number of processes and
pitfalls and knowlege necessary to avoid them.
This is a good example of how the shell can be your friend if you
understand some basics of how to use it. We dont even need 'ls'. The shell
can show the filename that caused the original error message without
needing any help from other utilities like 'ls' or 'grep'.
Demo:
$ >--Fexample # create a file named --Fexample
$ echo --F* # use builtin shell pathname expansion to
--Fexample # show matching filenames
Reply to: