ENTRIES
Welcome to Eric Cheng's online journal! You are not logged in. [ Log in ]
« Stephen Prutsman plays Tchaikovsky in Santa Cruz :: index :: Underwater abstracts from Komodo, Indonesia »

Shell parameter size limitation: Argument list too long

:: Tuesday, January 29th, 2008 @ 12:21:48 pm

:: Tags:

I just came across the very-common Argument list too long parameter size issue when running some shell commands during the Wetpixel server migration (currently underway!).

chmod 777 *
-bash: //bin/chmod: Argument list too long

I did a bunch of searches in teh Google, and because it took more than 5 minutes to find a good solution, I’m posting more information here.

My goal was to change the permissions of every jpg starting with “post.” At first, I did this (which was recommended by one site):

chmod 777 post*.jpg
-bash: //bin/chmod: Argument list too long
chmod 777 post-[1-5]*.jpg
-bash: //bin/chmod: Argument list too long
chmod 777 post-[1-3]*.jpg
-bash: //bin/chmod: Argument list too long
chmod 777 post-0*.jpg

(etc. etc. etc.)

But then, I found another hint (the comments are the useful part), and tried:

ls post*.jpg | xargs chmod 777

Much cleaner!

Command-line stuff is hard when you’re not in that environment a lot.

Popularity: 1% | Oakland, CA | link | trackback | posted @ Jan 29, 2008 12:21:48

:: 6 comments (rss)

  1. posted by kenny liu on Tue, January 29, 2008 @ 1:34 pm

    dude, eric, i could have told you that. next time, just ask me.

  2. posted by echeng on Tue, January 29, 2008 @ 1:39 pm

    Kenny - with your journal output of 1-2 images per month, I’m sure you run into this problem once every, oh… 50-100 years or so.

    But you’re right — I should have thought of you.

  3. posted by Aaron on Tue, January 29, 2008 @ 6:38 pm

    Fuck me. Kenny’s alive.

  4. posted by wayne on Wed, January 30, 2008 @ 9:35 am

    some tools (but not chmod) only take a single argument. for those you need “xargs -n 1 command” or use find:

    find . -type f -name ‘post*.jpg’ -exec chmod 777 {} \; -print

    find has the added benefit that it will traverse directory structures and apply the command to all matched files.

  5. posted by wayne on Wed, January 30, 2008 @ 9:36 am

    should both be single quotes around post*.jpg. for some reason the first got changed into a back-tick.

  6. posted by echeng on Wed, January 30, 2008 @ 10:56 am

    It’s Wordpress, trying to be “smart.” For that reason, I always wrap my code in PRE and CODE tags.

:: leave a reply

Use: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

RECENT MICROBLOG ACTIVITY
  • Crap. It is 10 deg cooler in the outer Mission. Not prepared! 4 hrs ago
  • Diving with sixgill sharks in Seattle: http://is.gd/23oQ 5 hrs ago
  • Finding it hard to be productive today. 8 hrs ago
  • Out with baby. And I mean a real baby. (not a pet name) :) 10 hrs ago
  • Pleased with my new Facebook profile pic. 1 day ago
  • "I am taking belly dance class." -Mom / "What?!" -Eric / "I'll dance for you on your birthday." -Mom. I am really confused. 1 day ago
  • Dave keeps trying to get me to go to German food (always followed by "BEER!"). I told him it was off the list -- permanently! 1 day ago
  • Vienna Teng is continuing to produce wonderful work. Really looking forward to the next album! 1 day ago
  • Dear email: if you'd only stop nagging me, I'd be able to start checking off the TODO list! 1 day ago
  • @MacMoov I read that. It's useless. 1 day ago
  • More updates...

Posting tweet...

ARCHIVES
Journal Home
Where is Eric? (password)
Stuff for Sale
August 2008 (34)
July 2008 (34)
June 2008 (32)
May 2008 (26)
April 2008 (15)
March 2008 (19)
February 2008 (31)
January 2008 (43)
December 2007 (33)
November 2007 (29)
October 2007 (29)
September 2007 (9)
August 2007 (19)
July 2007 (10)
June 2007 (17)
May 2007 (26)
April 2007 (38)
March 2007 (39)
February 2007 (13)
January 2007 (35)
December 2006 (35)
November 2006 (14)
October 2006 (6)
September 2006 (20)
August 2006 (24)
July 2006 (32)
June 2006 (17)
May 2006 (23)
April 2006 (16)
March 2006 (16)
February 2006 (26)
January 2006 (34)
December 2005 (17)
November 2005 (21)
October 2005 (18)
September 2005 (17)
August 2005 (5)
July 2005 (15)
June 2005 (20)
May 2005 (25)
April 2005 (7)
March 2005 (22)
February 2005 (20)
January 2005 (38)
December 2004 (6)
November 2004 (24)
October 2004 (16)
September 2004 (22)
August 2004 (12)
July 2004 (17)
June 2004 (15)
May 2004 (11)
April 2004 (35)
March 2004 (40)
February 2004 (29)
January 2004 (36)
December 2003 (20)
November 2003 (18)
October 2003 (10)
September 2003 (18)
August 2003 (10)
July 2003 (34)
June 2003 (12)
May 2003 (49)
April 2003 (42)
March 2003 (42)
February 2003 (15)
January 2003 (7)
December 2002 (17)
November 2002 (19)
October 2002 (24)
September 2002 (22)
August 2002 (20)
July 2002 (21)
June 2002 (14)
May 2002 (15)
April 2002 (11)
March 2002 (13)
February 2002 (20)
January 2002 (17)
December 2001 (16)
Even Older Journal
Travel Journals

VIENNA TENG
Support my friend and favorite singer-songwriter, Vienna Teng!

--- Next Show ---

Schedule coming soon.
[ discography ]

Eric Cheng's RSS Journal Journal RSS
Eric Cheng's RSS Journal Comments RSS

Rice Bowl Journals

proudly powered by wordpress
script exec time: 0.61s
i hate computers.