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

Re: The ls command



Am Donnerstag, 30. Oktober 2025, 16:18:59 Mitteleuropäische Normalzeit schrieb 
Michael:

Hi Michael, 

I am not sure, if ls is the right tool for your needs.
Maybe you want to try the find command, just for testing.

For example, finding all pdf, you can do a command like this:

find /your/directory/ -type f -name "*.pdf" -not name "*789*.pdf" -print

means

find all files with name anything.pdf but none with "789" somewhere in its 
name.pdf and shows the result.

So you can just eliminate all files with some weired character in its name lke 
"--K" or similar. In this case the command would be 

find /your/directory/ -type f -name "*.pdf" -not name "*--K*.pdf" -print.

The command find is very usefull for massive files as you can find, move, copy or 
delete the found files. For mor info see the manual.

It is just an idea, maybe it helps.

Best

Hans


> I have a Debian 12 setup running on a desktop PC.
> 
> I am trying to list my PDF files using the ls command.
> 
> I ran
> 
> ls  *.pdf
> 
> and received the error message
> 
> Invalid option '--K'
> 
> No files were listed.
> 
> I subsequently ran other ls commands such as
> 
> ls *.doc
> 
> ls *.txt
> 
> and those commands ran as expected.
> 
> Why are my PDF files not listed ?





Reply to: