linux help

HI,

pls tell me what this comand exactly will do step by step

find  /etc/  -name docecot.pem  -exec  rm { }  \;


Thanks
mastdesiAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
TintinConnect With a Mentor Commented:
find /etc  (start searching from the /etc directory and descend to all subdirectories)

-name docote.pem  (match any file called docote.pem

-exec rm {} \;  (exec the rm command, ie: delete any matched files, where the {} is substituted by the current matched filename)

\;  (terminate the exec argument)
0
 
fosiul01Commented:
from my understanding
it will find dovecot.pem in /etc/ directory and will delete this file
0
 
mastdesiAuthor Commented:
TY

even i guess this too but what does  { }  \; means at the end of line
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
fosiul01Commented:
omm i just tested this command , it delete the file

but i dont know exactly what {} \; do, let me have a look on net
0
 
mastdesiAuthor Commented:
k..bro :-)
0
 
ozoCommented:
man find
     -exec utility [argument ...];
             True if the program named utility returns a zero value as its
             exit status.  Optional arguments may be passed to the utility.
             The expression must be terminated by a semicolon (``;'').  If the
             string ``{}'' appears anywhere in the utility name or the argu-
             ments it is replaced by the pathname of the current file.
             Utility will be executed from the directory from which find was
             executed.  Utility and arguments are not subject to the further
             expansion of shell patterns and constructs.
0
 
fosiul01Commented:
ok this could be true

-exec  rm { }  \;  = its executing rm command ....
0
 
mastdesiAuthor Commented:
So may i know final thoughts from u experts about
-exec  rm { }  \;

i still didnt get it properly ;-(
0
 
TintinCommented:
What part of it don't you get?  Was my explanation useful at all?
0
 
fosiul01Commented:
I think @tintin gave a proper solution which is


find  /etc/  -name docecot.pem    = is finding the file

 -exec  rm   = executing the rm command

{ }  \;   = what this command  (find  /etc/  -name docecot.pem )  find the output, its deleting that file

normaly we use

rm -rf somedirectory
here some directory is replacing by  { } \;

0
 
mastdesiAuthor Commented:
Thanks all
so that means if i put {}  \: at the end of any line like find /  -name .bash*  -exec {}  \;  it will remove any output of find command?..it looks very cool
0
 
mastdesiAuthor Commented:
ty bro :-)
0
 
ozoCommented:
no, -exec {}  \; would try to execute the filename as a command
-exec rm {}  \; would try to execute the rm command with the filename as the argument
0
 
mastdesiAuthor Commented:
thank u very much ozo for explanation :-)
0
 
TintinCommented:
Note that the {} \; syntax is specific to the find command.  The only other command I can think of that has a similar construct is xargs.
0
 
mastdesiAuthor Commented:
ok kindly all expert reply to my this question too if possible
http://www.experts-exchange.com/OS/Linux/Q_24322530.html

thanks all
0
 
mastdesiAuthor Commented:
sorry i just solved that question myself...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.