Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

find exec ls : No such file or directory

Tags:

find

bash

shell

ls

I tried to execute:

find ~/ -name "*foo*" -exec "ls -la {}" \;

And it printed:

find: 'ls -la /home/users/MyUser/fooBar': No such file or directory

find: 'ls -la /home/users/MyUser/Barfoo': No such file or directory

Also ls is aliased to ls --color.

What kind of tricky trick happened here?

like image 737
A. Gille Avatar asked Oct 16 '25 04:10

A. Gille


1 Answers

The arguments of -exec should not be quoted. Remove the quotes after -exec. And -exec does not detect aliases so you need to pass the --color option to exec.

like image 134
builder-7000 Avatar answered Oct 17 '25 18:10

builder-7000