I'm trying to find all the files in my home directory with a specific extension. If I only have one instance of the file extension, the ls command works perfectly fine, but as soon as I touch a new file with the same extension the ls command returns nothing.
I'm really not sure what's going on, and if someone could help point me to the right direction, that would be great.
*.java
expands tohello2.java
, and there is no such file in/home/gabriel/
. You don't even need grep here - justls /home/gabriel/*.java
– steeldriver Feb 04 '24 at 18:25ls
. – Nasir Riley Feb 04 '24 at 18:26ls /home/gabriel/* | grep *.java
. And yes, the file has to exist inDesktop/
. But of course/home/gabriel/*
matches/home/gabriel/Desktop
, andls
prints the contents of that, so the file only needs to exist inDesktop/
, not also their home (as I mistakenly implied before). – ilkkachu Feb 04 '24 at 21:12