- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- chmod command on long list of files
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2008 09:54 AM
тАО07-23-2008 09:54 AM
chmod command on long list of files
I want to do a chmod command to change the permissions on all 99,999 files. When I do the chmod command I get:
sh: /usr/bin/chmod: The parameter list is too long.
Do you know how to get me around this?
- Tags:
- Arg list too long
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2008 09:58 AM
тАО07-23-2008 09:58 AM
Re: chmod command on long list of files
chmod -R xxx /my/directory
This will change the directory and all files in it.
Or.
find /my/directory -type f -exec chmod xxx {} \;
- Tags:
- find
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2008 09:59 AM
тАО07-23-2008 09:59 AM
Re: chmod command on long list of files
Thanks
SKR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2008 10:05 AM
тАО07-23-2008 10:05 AM
Re: chmod command on long list of files
This is where it would have been helpful to
reveal the actual failing chmod command.
> do chmod permissions * (inside that
> directory)
That might help, but other non-"*" methods
would be safer. (And, for all we know,
that's exactly what you did to get the
original failure.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2008 10:15 AM
тАО07-23-2008 10:15 AM
Re: chmod command on long list of files
If you want to only act on the files in the directory and not any of the subdirectories, another way is:
# find /path -xdev -type f -print|xargs chown newuser:newgroup
This avoids the potential for an "argument list too long" and avoids forking a separate task for every argument processed.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2008 10:17 AM
тАО07-23-2008 10:17 AM
Re: chmod command on long list of files
Oh, sorry 'chmod' not 'chown':
# find /path -xdev -type f -print|xargs chmod 644
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2008 05:21 PM
тАО07-23-2008 05:21 PM
Re: chmod command on long list of files
Now you see the really big problems in managing massively large collections of files in a single directory. You cannot use simple * characters but must think carefully how to make sweeping changes to the files. You must use commands that can find the filenames without shell expansion. A good sysadmin will never allow this type of directory structure to be put into production.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-23-2008 09:27 PM
тАО07-23-2008 09:27 PM
Re: chmod command on long list of files
Where does a system manager get to make a
decision like that?
I'd say that a good system manager would
explain to the users the known problems
associated with such a directory structure,
including the easily anticipated "parameter
list is too long" complaints, and what to do
to avoid them ("find", "xargs", ...).
This allows the system manager to get a good
laugh whenever some
points to the published FAQ document
containing the explanation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-24-2008 01:04 AM
тАО07-24-2008 01:04 AM
Re: chmod command on long list of files
I'm surprised your 1950 vintage cloudy crystal ball can't figure this one out. ;-)
>JRF: # find /path -xdev -type f -print|xargs chmod 644
Or use -exec +:
# find /path -xdev -type f -exec chmod 644 {} +
>Tim: chmod -R xxx /my/directory
Good trick!
If you don't want to change the directory, save the permissions and then put them back later.