LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-29-2008, 02:30 AM   #1
mashcaster
Member
 
Registered: Dec 2008
Posts: 67

Rep: Reputation: 15
chown on 206,682 items


Using Ubuntu 8.10, I have tried chown on 206,682 items in a specific folder but it does not allow it:

Quote:
mashcaster@mashcaster-desktop:~$ sudo chown -R mashcaster /home/mashcaster/Desktop/new/*
[sudo] password for mashcaster:
sudo: unable to execute /bin/chown: Argument list too long
mashcaster@mashcaster-desktop:~$
How do I get around this problem?
 
Old 12-29-2008, 03:20 AM   #2
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 61
Quote:
2. To change the owner and group of all files in the directory /tmp/src
to owner john and group build:

chown -R john:build /tmp/src
Taken from the chown man pages.
 
Old 12-29-2008, 03:39 AM   #3
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Please read: http://www.linuxjournal.com/article/6060
And remember, most linux error messages can be fed directly into an internet search engine to discover both what they mean and how to avoid them.
 
Old 12-29-2008, 04:28 AM   #4
mashcaster
Member
 
Registered: Dec 2008
Posts: 67

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by tredegar View Post
Please read: http://www.linuxjournal.com/article/6060
And remember, most linux error messages can be fed directly into an internet search engine to discover both what they mean and how to avoid them.
I know, but what if the solution found does not work? A beautiful example is the link in your post.
 
Old 12-29-2008, 05:08 AM   #5
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
What "does not work" ? Please give an example.
 
Old 12-29-2008, 05:13 AM   #6
mashcaster
Member
 
Registered: Dec 2008
Posts: 67

Original Poster
Rep: Reputation: 15
sudo cannot handle more than 200,000 items apparently. I've found the solution, thanks for the help.
 
Old 12-29-2008, 05:17 AM   #7
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Try
Code:
sudo chown -R mashcaster /home/mashcaster/Desktop/new
as implied by JH
 
Old 12-29-2008, 05:48 AM   #8
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
In these cases find and/or xargs can be useful.

Code:
find /path/to -exec chown john:doe '{}' \;
Code:
find /path/to | xargs chown john:doe
Either way it should work. The second one will require less iterations and should be faster and less resource intensive. There are many more ways: recursion, loops, etc. All of them are probably more inefficient.
 
Old 12-29-2008, 06:48 AM   #9
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Be sure to read the xargs manpage. There are options such as `-L' to limit the number of arguments handled at once.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
chown bkcreddy17 Linux - Newbie 1 04-22-2008 08:59 AM
chown lsu420luv Linux - Newbie 3 04-18-2006 05:08 PM
2005/206: How to install GRUB over LILO? registering Mandriva 2 10-17-2005 09:12 AM
chown -R ujotne Programming 3 02-25-2004 12:02 PM
chown Sathe Linux - General 13 10-14-2002 11:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 10:09 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
Open Source Consulting | Domain Registration