[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: The ls command



On 2025-10-30 at 13:33, Michael wrote:

> The command
> 
> ls -- *.pdf
> 
> has been run and a very large number of PDF files has been listed.
> 
> It is very difficult to spot any strangely named PDF files.
> 
> What command should be issued to easily list any strangely named PDF
> file ?

Try:

$ ls -- *.pdf | grep ' -'

This should show you any files whose name include a space followed by a
dash. The space would be treated as a token separator, and the dash
would be treated as the beginning of a new argument to ls.

If you want to look only for things that might be parsed as "long-form"
options, try the same command except with two dashes in a row rather
than just the one.

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: