LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-08-2016, 12:52 PM   #1
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 278

Rep: Reputation: Disabled
Find / xargs, changing permissions


Change permissions to 666 for all *.tpl files in /templates folder recursively. Will this work?

Code:
find /template -type f \( -iname "*.tpl" \) | xargs chmod -R 666
This looks like a correct command, but I added the -R and I am not sure about that part. Files recursively? What would they mean? I guess it will all the files with *.tpl extension and chmod them to 666. Why would I need to do it recursively and what does it mean? Is this not what I need to do?

Code:
find /template -type f \( -iname "*.tpl" \) | xargs chmod 666
 
Old 01-08-2016, 01:01 PM   #2
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 278

Original Poster
Rep: Reputation: Disabled
This does not work anyway:

Code:
find /template -type f \( -iname "*.tpl"\) | xargs chmod 666
find: paths must precede expression: (-iname
chmod: missing operand after '666'
 
Old 01-08-2016, 01:13 PM   #3
AdultFoundry
Member
 
Registered: Jun 2015
Posts: 278

Original Poster
Rep: Reputation: Disabled
Would this be good?

Code:
find template -type f -iname "*.tpl" | xargs chmod 666
This would be run from the directory in which the template directory is in. I run it and it seemed to work.
 
Old 01-08-2016, 02:12 PM   #4
Tim Abracadabra
Member
 
Registered: May 2014
Location: USA, Wherever I may Roam
Distribution: Debian w/Xfce, LFS 7.9, ++
Posts: 117

Rep: Reputation: Disabled
Not knowing what files and/or subdirectories you may have, It may be a bit "safer" and more specific to use -name in place of -iname and limit subdirectory recursion with -maxdepth 1.

Code:
find template -maxdepth 1 -type f -name "*.tpl" | xargs chmod 666
Hope that helps,
Tim
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing data format using sed and Xargs command Hariesh08 Linux - Newbie 3 07-29-2013 03:17 AM
[SOLVED] Xargs with output of find thund3rstruck Programming 6 07-17-2011 08:26 AM
[SOLVED] Backup One Liner find xargs cp metallica1973 Linux - Server 7 05-30-2011 08:50 PM
find | xargs | shred seems really slow Bertical Linux - Software 3 11-19-2010 09:36 AM
error with find . | xargs cbonar Linux - Newbie 7 12-09-2004 11:22 AM


All times are GMT -5. The time now is 11:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration