find: ‘echo’: Permission denied











up vote
0
down vote

favorite












It is my os info:



sudo uname  -a 
Linux machine 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u6
(2018-10-08) x86_64 GNU/Linux


Files beginning at test in /tmp.



ls -al  test*
-rw-r--r-- 1 debian9 debian9 0 Nov 16 14:43 test1
-rw-r--r-- 1 debian9 debian9 0 Nov 16 14:43 test2
-rw-r--r-- 1 debian9 debian9 0 Nov 11 18:28 test.txt


I want to list them with find.



find /tmp -name  "test*" -type f  -exec echo  {} ;
find: ‘echo’: Permission denied
find: ‘echo’: Permission denied
find: ‘/tmp/snap.0_anbox_tzkdA1’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-apache2.service-J7vefp’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-colord.service-xtmKpt’: Permission denied
find: ‘echo’: Permission denied
find: ‘/tmp/pulse-PKdhtXMmr18n’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-rtkit-daemon.service-rVBMKE’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-dovecot.service-zTKk5O’: Permission denied


Why are so many find: ‘echo’: Permission denied?

It is no use to run with root



debian9@hwy:/tmp$ su root
Password:
root@hwy:/tmp# find /tmp -name "test*" -type f -exec echo {} ;
find: ‘echo’: Permission denied
find: ‘echo’: Permission denied
find: ‘echo’: Permission denied


find command can list all files beginning with test.



find /tmp -name "test*" -type f
/tmp/test2
/tmp/test.txt
/tmp/test1


Why -exec echo {} ; can't run?



Nothing wrong or something else as output of the below command.



debian9@hwy:~$ sudo find /tmp  -name "test*" -type f -exec /bin/echo  "{}" ;


Check the permission.



debian9@hwy:~$ sudo ls -al  /bin/echo
-rwxr-xr-x 1 root utmp 0 Nov 11 18:05 /bin/echo









share|improve this question
























  • Every file has a r permission,you can see the output of ls -al test*.
    – scrapy
    Nov 16 at 7:08










  • How to make it run then?
    – scrapy
    Nov 16 at 7:15










  • No use to run it with sudo,it encounter same error info.
    – scrapy
    Nov 16 at 7:18















up vote
0
down vote

favorite












It is my os info:



sudo uname  -a 
Linux machine 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u6
(2018-10-08) x86_64 GNU/Linux


Files beginning at test in /tmp.



ls -al  test*
-rw-r--r-- 1 debian9 debian9 0 Nov 16 14:43 test1
-rw-r--r-- 1 debian9 debian9 0 Nov 16 14:43 test2
-rw-r--r-- 1 debian9 debian9 0 Nov 11 18:28 test.txt


I want to list them with find.



find /tmp -name  "test*" -type f  -exec echo  {} ;
find: ‘echo’: Permission denied
find: ‘echo’: Permission denied
find: ‘/tmp/snap.0_anbox_tzkdA1’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-apache2.service-J7vefp’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-colord.service-xtmKpt’: Permission denied
find: ‘echo’: Permission denied
find: ‘/tmp/pulse-PKdhtXMmr18n’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-rtkit-daemon.service-rVBMKE’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-dovecot.service-zTKk5O’: Permission denied


Why are so many find: ‘echo’: Permission denied?

It is no use to run with root



debian9@hwy:/tmp$ su root
Password:
root@hwy:/tmp# find /tmp -name "test*" -type f -exec echo {} ;
find: ‘echo’: Permission denied
find: ‘echo’: Permission denied
find: ‘echo’: Permission denied


find command can list all files beginning with test.



find /tmp -name "test*" -type f
/tmp/test2
/tmp/test.txt
/tmp/test1


Why -exec echo {} ; can't run?



Nothing wrong or something else as output of the below command.



debian9@hwy:~$ sudo find /tmp  -name "test*" -type f -exec /bin/echo  "{}" ;


Check the permission.



debian9@hwy:~$ sudo ls -al  /bin/echo
-rwxr-xr-x 1 root utmp 0 Nov 11 18:05 /bin/echo









share|improve this question
























  • Every file has a r permission,you can see the output of ls -al test*.
    – scrapy
    Nov 16 at 7:08










  • How to make it run then?
    – scrapy
    Nov 16 at 7:15










  • No use to run it with sudo,it encounter same error info.
    – scrapy
    Nov 16 at 7:18













up vote
0
down vote

favorite









up vote
0
down vote

favorite











It is my os info:



sudo uname  -a 
Linux machine 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u6
(2018-10-08) x86_64 GNU/Linux


Files beginning at test in /tmp.



ls -al  test*
-rw-r--r-- 1 debian9 debian9 0 Nov 16 14:43 test1
-rw-r--r-- 1 debian9 debian9 0 Nov 16 14:43 test2
-rw-r--r-- 1 debian9 debian9 0 Nov 11 18:28 test.txt


I want to list them with find.



find /tmp -name  "test*" -type f  -exec echo  {} ;
find: ‘echo’: Permission denied
find: ‘echo’: Permission denied
find: ‘/tmp/snap.0_anbox_tzkdA1’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-apache2.service-J7vefp’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-colord.service-xtmKpt’: Permission denied
find: ‘echo’: Permission denied
find: ‘/tmp/pulse-PKdhtXMmr18n’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-rtkit-daemon.service-rVBMKE’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-dovecot.service-zTKk5O’: Permission denied


Why are so many find: ‘echo’: Permission denied?

It is no use to run with root



debian9@hwy:/tmp$ su root
Password:
root@hwy:/tmp# find /tmp -name "test*" -type f -exec echo {} ;
find: ‘echo’: Permission denied
find: ‘echo’: Permission denied
find: ‘echo’: Permission denied


find command can list all files beginning with test.



find /tmp -name "test*" -type f
/tmp/test2
/tmp/test.txt
/tmp/test1


Why -exec echo {} ; can't run?



Nothing wrong or something else as output of the below command.



debian9@hwy:~$ sudo find /tmp  -name "test*" -type f -exec /bin/echo  "{}" ;


Check the permission.



debian9@hwy:~$ sudo ls -al  /bin/echo
-rwxr-xr-x 1 root utmp 0 Nov 11 18:05 /bin/echo









share|improve this question















It is my os info:



sudo uname  -a 
Linux machine 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u6
(2018-10-08) x86_64 GNU/Linux


Files beginning at test in /tmp.



ls -al  test*
-rw-r--r-- 1 debian9 debian9 0 Nov 16 14:43 test1
-rw-r--r-- 1 debian9 debian9 0 Nov 16 14:43 test2
-rw-r--r-- 1 debian9 debian9 0 Nov 11 18:28 test.txt


I want to list them with find.



find /tmp -name  "test*" -type f  -exec echo  {} ;
find: ‘echo’: Permission denied
find: ‘echo’: Permission denied
find: ‘/tmp/snap.0_anbox_tzkdA1’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-apache2.service-J7vefp’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-colord.service-xtmKpt’: Permission denied
find: ‘echo’: Permission denied
find: ‘/tmp/pulse-PKdhtXMmr18n’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-rtkit-daemon.service-rVBMKE’: Permission denied
find: ‘/tmp/systemd-private-589e0bcc99cc438d9e12d06af643af76-dovecot.service-zTKk5O’: Permission denied


Why are so many find: ‘echo’: Permission denied?

It is no use to run with root



debian9@hwy:/tmp$ su root
Password:
root@hwy:/tmp# find /tmp -name "test*" -type f -exec echo {} ;
find: ‘echo’: Permission denied
find: ‘echo’: Permission denied
find: ‘echo’: Permission denied


find command can list all files beginning with test.



find /tmp -name "test*" -type f
/tmp/test2
/tmp/test.txt
/tmp/test1


Why -exec echo {} ; can't run?



Nothing wrong or something else as output of the below command.



debian9@hwy:~$ sudo find /tmp  -name "test*" -type f -exec /bin/echo  "{}" ;


Check the permission.



debian9@hwy:~$ sudo ls -al  /bin/echo
-rwxr-xr-x 1 root utmp 0 Nov 11 18:05 /bin/echo






linux permissions find echo






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 at 10:17

























asked Nov 16 at 6:59









scrapy

1765




1765












  • Every file has a r permission,you can see the output of ls -al test*.
    – scrapy
    Nov 16 at 7:08










  • How to make it run then?
    – scrapy
    Nov 16 at 7:15










  • No use to run it with sudo,it encounter same error info.
    – scrapy
    Nov 16 at 7:18


















  • Every file has a r permission,you can see the output of ls -al test*.
    – scrapy
    Nov 16 at 7:08










  • How to make it run then?
    – scrapy
    Nov 16 at 7:15










  • No use to run it with sudo,it encounter same error info.
    – scrapy
    Nov 16 at 7:18
















Every file has a r permission,you can see the output of ls -al test*.
– scrapy
Nov 16 at 7:08




Every file has a r permission,you can see the output of ls -al test*.
– scrapy
Nov 16 at 7:08












How to make it run then?
– scrapy
Nov 16 at 7:15




How to make it run then?
– scrapy
Nov 16 at 7:15












No use to run it with sudo,it encounter same error info.
– scrapy
Nov 16 at 7:18




No use to run it with sudo,it encounter same error info.
– scrapy
Nov 16 at 7:18










3 Answers
3






active

oldest

votes

















up vote
1
down vote



accepted










Kamil Maciorowski pointed you in the right direction (hence my +1 for him), but it appears there is something very wrong with your /bin/echo command: here is mine,



# ls -l echo
-rwxr-xr-x 1 root root 35000 gen 18 2018 echo


and here is yours (and I quote):



$ sudo ls -al  /bin/echo
-rwxr-xr-x 1 root utmp 0 Nov 11 18:05 /bin/echo


Can you see the differences? Your command belongs to the utmp group, instead of the root group. Also, and equally importantly, its size IS ZERO, while it is 35000 bytes in mine.



So, to be clear: your /bin/echo command is totally empty, and it belongs to the wrong group. This clearly indicates serious corruption of system tools. On the basis of the information provided, there is nothing else I can offer. A clean re-install might be your best option.






share|improve this answer





















  • There must be something more. In my Debian I created an empty file with exact the same ownership and permissions as the OP's /bin/echo. It executes successfully (mimics true). A clean re-install may indeed be the best option.
    – Kamil Maciorowski
    Nov 16 at 11:19




















up vote
2
down vote













echo is a builtin in many shells, so when you use it on a daily basis it just works. However find … -exec echo … ; uses an external executable like /bin/echo.



find: ‘echo’: Permission denied means there's something wrong with permissions of the executable. It may be your $PATH leads you to some "wrong" echo or permissions of the "right" echo are wrong. I'm assuming the latter.




  1. Locate the executable; whereis echo works on many systems.

  2. Check its permissions, like with ls -l /bin/echo.

  3. Fix the permissions with sudo chmod …. In my Debian they are rwxr-xr-x (755). Example command: sudo chmod 755 /bin/echo.






share|improve this answer





















  • Nothing wrong or something else as output of the below command.
    – scrapy
    Nov 16 at 10:18










  • sudo find /tmp -name "test*" -type f -exec /bin/echo "{}" ;
    – scrapy
    Nov 16 at 10:19










  • @scrapy How about if you run it without sudo but still with /bin/echo?
    – Kamil Maciorowski
    Nov 16 at 10:56










  • Pls read my answer too, perhaps you have something to add? Four eyes see better than just two.
    – MariusMatutiae
    Nov 16 at 11:04


















up vote
0
down vote













No need for -exec echo, in find you can use -print (or -ls if you want more info). In other words:



find $dir -print


and



find $dir -exec echo {} ;


have the same output. This is even the default, if you don't specify a -exec



find $dir -exec echo {} ;





share|improve this answer

















  • 1




    A subtlety: the code after the OP says "find command can list all files beginning with test" suggests they know. While -exec echo {} ; is not really useful, it should work. I read it as a basic example of -exec echo … ; which in general fails for the OP.
    – Kamil Maciorowski
    Nov 16 at 8:19











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1375899%2ffind-echo-permission-denied%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










Kamil Maciorowski pointed you in the right direction (hence my +1 for him), but it appears there is something very wrong with your /bin/echo command: here is mine,



# ls -l echo
-rwxr-xr-x 1 root root 35000 gen 18 2018 echo


and here is yours (and I quote):



$ sudo ls -al  /bin/echo
-rwxr-xr-x 1 root utmp 0 Nov 11 18:05 /bin/echo


Can you see the differences? Your command belongs to the utmp group, instead of the root group. Also, and equally importantly, its size IS ZERO, while it is 35000 bytes in mine.



So, to be clear: your /bin/echo command is totally empty, and it belongs to the wrong group. This clearly indicates serious corruption of system tools. On the basis of the information provided, there is nothing else I can offer. A clean re-install might be your best option.






share|improve this answer





















  • There must be something more. In my Debian I created an empty file with exact the same ownership and permissions as the OP's /bin/echo. It executes successfully (mimics true). A clean re-install may indeed be the best option.
    – Kamil Maciorowski
    Nov 16 at 11:19

















up vote
1
down vote



accepted










Kamil Maciorowski pointed you in the right direction (hence my +1 for him), but it appears there is something very wrong with your /bin/echo command: here is mine,



# ls -l echo
-rwxr-xr-x 1 root root 35000 gen 18 2018 echo


and here is yours (and I quote):



$ sudo ls -al  /bin/echo
-rwxr-xr-x 1 root utmp 0 Nov 11 18:05 /bin/echo


Can you see the differences? Your command belongs to the utmp group, instead of the root group. Also, and equally importantly, its size IS ZERO, while it is 35000 bytes in mine.



So, to be clear: your /bin/echo command is totally empty, and it belongs to the wrong group. This clearly indicates serious corruption of system tools. On the basis of the information provided, there is nothing else I can offer. A clean re-install might be your best option.






share|improve this answer





















  • There must be something more. In my Debian I created an empty file with exact the same ownership and permissions as the OP's /bin/echo. It executes successfully (mimics true). A clean re-install may indeed be the best option.
    – Kamil Maciorowski
    Nov 16 at 11:19















up vote
1
down vote



accepted







up vote
1
down vote



accepted






Kamil Maciorowski pointed you in the right direction (hence my +1 for him), but it appears there is something very wrong with your /bin/echo command: here is mine,



# ls -l echo
-rwxr-xr-x 1 root root 35000 gen 18 2018 echo


and here is yours (and I quote):



$ sudo ls -al  /bin/echo
-rwxr-xr-x 1 root utmp 0 Nov 11 18:05 /bin/echo


Can you see the differences? Your command belongs to the utmp group, instead of the root group. Also, and equally importantly, its size IS ZERO, while it is 35000 bytes in mine.



So, to be clear: your /bin/echo command is totally empty, and it belongs to the wrong group. This clearly indicates serious corruption of system tools. On the basis of the information provided, there is nothing else I can offer. A clean re-install might be your best option.






share|improve this answer












Kamil Maciorowski pointed you in the right direction (hence my +1 for him), but it appears there is something very wrong with your /bin/echo command: here is mine,



# ls -l echo
-rwxr-xr-x 1 root root 35000 gen 18 2018 echo


and here is yours (and I quote):



$ sudo ls -al  /bin/echo
-rwxr-xr-x 1 root utmp 0 Nov 11 18:05 /bin/echo


Can you see the differences? Your command belongs to the utmp group, instead of the root group. Also, and equally importantly, its size IS ZERO, while it is 35000 bytes in mine.



So, to be clear: your /bin/echo command is totally empty, and it belongs to the wrong group. This clearly indicates serious corruption of system tools. On the basis of the information provided, there is nothing else I can offer. A clean re-install might be your best option.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 at 11:03









MariusMatutiae

37.8k95195




37.8k95195












  • There must be something more. In my Debian I created an empty file with exact the same ownership and permissions as the OP's /bin/echo. It executes successfully (mimics true). A clean re-install may indeed be the best option.
    – Kamil Maciorowski
    Nov 16 at 11:19




















  • There must be something more. In my Debian I created an empty file with exact the same ownership and permissions as the OP's /bin/echo. It executes successfully (mimics true). A clean re-install may indeed be the best option.
    – Kamil Maciorowski
    Nov 16 at 11:19


















There must be something more. In my Debian I created an empty file with exact the same ownership and permissions as the OP's /bin/echo. It executes successfully (mimics true). A clean re-install may indeed be the best option.
– Kamil Maciorowski
Nov 16 at 11:19






There must be something more. In my Debian I created an empty file with exact the same ownership and permissions as the OP's /bin/echo. It executes successfully (mimics true). A clean re-install may indeed be the best option.
– Kamil Maciorowski
Nov 16 at 11:19














up vote
2
down vote













echo is a builtin in many shells, so when you use it on a daily basis it just works. However find … -exec echo … ; uses an external executable like /bin/echo.



find: ‘echo’: Permission denied means there's something wrong with permissions of the executable. It may be your $PATH leads you to some "wrong" echo or permissions of the "right" echo are wrong. I'm assuming the latter.




  1. Locate the executable; whereis echo works on many systems.

  2. Check its permissions, like with ls -l /bin/echo.

  3. Fix the permissions with sudo chmod …. In my Debian they are rwxr-xr-x (755). Example command: sudo chmod 755 /bin/echo.






share|improve this answer





















  • Nothing wrong or something else as output of the below command.
    – scrapy
    Nov 16 at 10:18










  • sudo find /tmp -name "test*" -type f -exec /bin/echo "{}" ;
    – scrapy
    Nov 16 at 10:19










  • @scrapy How about if you run it without sudo but still with /bin/echo?
    – Kamil Maciorowski
    Nov 16 at 10:56










  • Pls read my answer too, perhaps you have something to add? Four eyes see better than just two.
    – MariusMatutiae
    Nov 16 at 11:04















up vote
2
down vote













echo is a builtin in many shells, so when you use it on a daily basis it just works. However find … -exec echo … ; uses an external executable like /bin/echo.



find: ‘echo’: Permission denied means there's something wrong with permissions of the executable. It may be your $PATH leads you to some "wrong" echo or permissions of the "right" echo are wrong. I'm assuming the latter.




  1. Locate the executable; whereis echo works on many systems.

  2. Check its permissions, like with ls -l /bin/echo.

  3. Fix the permissions with sudo chmod …. In my Debian they are rwxr-xr-x (755). Example command: sudo chmod 755 /bin/echo.






share|improve this answer





















  • Nothing wrong or something else as output of the below command.
    – scrapy
    Nov 16 at 10:18










  • sudo find /tmp -name "test*" -type f -exec /bin/echo "{}" ;
    – scrapy
    Nov 16 at 10:19










  • @scrapy How about if you run it without sudo but still with /bin/echo?
    – Kamil Maciorowski
    Nov 16 at 10:56










  • Pls read my answer too, perhaps you have something to add? Four eyes see better than just two.
    – MariusMatutiae
    Nov 16 at 11:04













up vote
2
down vote










up vote
2
down vote









echo is a builtin in many shells, so when you use it on a daily basis it just works. However find … -exec echo … ; uses an external executable like /bin/echo.



find: ‘echo’: Permission denied means there's something wrong with permissions of the executable. It may be your $PATH leads you to some "wrong" echo or permissions of the "right" echo are wrong. I'm assuming the latter.




  1. Locate the executable; whereis echo works on many systems.

  2. Check its permissions, like with ls -l /bin/echo.

  3. Fix the permissions with sudo chmod …. In my Debian they are rwxr-xr-x (755). Example command: sudo chmod 755 /bin/echo.






share|improve this answer












echo is a builtin in many shells, so when you use it on a daily basis it just works. However find … -exec echo … ; uses an external executable like /bin/echo.



find: ‘echo’: Permission denied means there's something wrong with permissions of the executable. It may be your $PATH leads you to some "wrong" echo or permissions of the "right" echo are wrong. I'm assuming the latter.




  1. Locate the executable; whereis echo works on many systems.

  2. Check its permissions, like with ls -l /bin/echo.

  3. Fix the permissions with sudo chmod …. In my Debian they are rwxr-xr-x (755). Example command: sudo chmod 755 /bin/echo.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 at 7:57









Kamil Maciorowski

22.7k155072




22.7k155072












  • Nothing wrong or something else as output of the below command.
    – scrapy
    Nov 16 at 10:18










  • sudo find /tmp -name "test*" -type f -exec /bin/echo "{}" ;
    – scrapy
    Nov 16 at 10:19










  • @scrapy How about if you run it without sudo but still with /bin/echo?
    – Kamil Maciorowski
    Nov 16 at 10:56










  • Pls read my answer too, perhaps you have something to add? Four eyes see better than just two.
    – MariusMatutiae
    Nov 16 at 11:04


















  • Nothing wrong or something else as output of the below command.
    – scrapy
    Nov 16 at 10:18










  • sudo find /tmp -name "test*" -type f -exec /bin/echo "{}" ;
    – scrapy
    Nov 16 at 10:19










  • @scrapy How about if you run it without sudo but still with /bin/echo?
    – Kamil Maciorowski
    Nov 16 at 10:56










  • Pls read my answer too, perhaps you have something to add? Four eyes see better than just two.
    – MariusMatutiae
    Nov 16 at 11:04
















Nothing wrong or something else as output of the below command.
– scrapy
Nov 16 at 10:18




Nothing wrong or something else as output of the below command.
– scrapy
Nov 16 at 10:18












sudo find /tmp -name "test*" -type f -exec /bin/echo "{}" ;
– scrapy
Nov 16 at 10:19




sudo find /tmp -name "test*" -type f -exec /bin/echo "{}" ;
– scrapy
Nov 16 at 10:19












@scrapy How about if you run it without sudo but still with /bin/echo?
– Kamil Maciorowski
Nov 16 at 10:56




@scrapy How about if you run it without sudo but still with /bin/echo?
– Kamil Maciorowski
Nov 16 at 10:56












Pls read my answer too, perhaps you have something to add? Four eyes see better than just two.
– MariusMatutiae
Nov 16 at 11:04




Pls read my answer too, perhaps you have something to add? Four eyes see better than just two.
– MariusMatutiae
Nov 16 at 11:04










up vote
0
down vote













No need for -exec echo, in find you can use -print (or -ls if you want more info). In other words:



find $dir -print


and



find $dir -exec echo {} ;


have the same output. This is even the default, if you don't specify a -exec



find $dir -exec echo {} ;





share|improve this answer

















  • 1




    A subtlety: the code after the OP says "find command can list all files beginning with test" suggests they know. While -exec echo {} ; is not really useful, it should work. I read it as a basic example of -exec echo … ; which in general fails for the OP.
    – Kamil Maciorowski
    Nov 16 at 8:19















up vote
0
down vote













No need for -exec echo, in find you can use -print (or -ls if you want more info). In other words:



find $dir -print


and



find $dir -exec echo {} ;


have the same output. This is even the default, if you don't specify a -exec



find $dir -exec echo {} ;





share|improve this answer

















  • 1




    A subtlety: the code after the OP says "find command can list all files beginning with test" suggests they know. While -exec echo {} ; is not really useful, it should work. I read it as a basic example of -exec echo … ; which in general fails for the OP.
    – Kamil Maciorowski
    Nov 16 at 8:19













up vote
0
down vote










up vote
0
down vote









No need for -exec echo, in find you can use -print (or -ls if you want more info). In other words:



find $dir -print


and



find $dir -exec echo {} ;


have the same output. This is even the default, if you don't specify a -exec



find $dir -exec echo {} ;





share|improve this answer












No need for -exec echo, in find you can use -print (or -ls if you want more info). In other words:



find $dir -print


and



find $dir -exec echo {} ;


have the same output. This is even the default, if you don't specify a -exec



find $dir -exec echo {} ;






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 16 at 8:07









xenoid

3,5083618




3,5083618








  • 1




    A subtlety: the code after the OP says "find command can list all files beginning with test" suggests they know. While -exec echo {} ; is not really useful, it should work. I read it as a basic example of -exec echo … ; which in general fails for the OP.
    – Kamil Maciorowski
    Nov 16 at 8:19














  • 1




    A subtlety: the code after the OP says "find command can list all files beginning with test" suggests they know. While -exec echo {} ; is not really useful, it should work. I read it as a basic example of -exec echo … ; which in general fails for the OP.
    – Kamil Maciorowski
    Nov 16 at 8:19








1




1




A subtlety: the code after the OP says "find command can list all files beginning with test" suggests they know. While -exec echo {} ; is not really useful, it should work. I read it as a basic example of -exec echo … ; which in general fails for the OP.
– Kamil Maciorowski
Nov 16 at 8:19




A subtlety: the code after the OP says "find command can list all files beginning with test" suggests they know. While -exec echo {} ; is not really useful, it should work. I read it as a basic example of -exec echo … ; which in general fails for the OP.
– Kamil Maciorowski
Nov 16 at 8:19


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1375899%2ffind-echo-permission-denied%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Plaza Victoria

In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...