From owner-freebsd-fs@FreeBSD.ORG Thu Mar 7 16:35:02 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 1BAACBC9 for ; Thu, 7 Mar 2013 16:35:02 +0000 (UTC) (envelope-from cross+freebsd@distal.com) Received: from mail.distal.com (mail.distal.com [IPv6:2001:470:e24c:200::ae25]) by mx1.freebsd.org (Postfix) with ESMTP id DA1CB3FB for ; Thu, 7 Mar 2013 16:35:01 +0000 (UTC) Received: from zalamar.mm-corp.net (static-66-16-13-46.dsl.cavtel.net [66.16.13.46]) (authenticated bits=0) by mail.distal.com (8.14.3/8.14.3) with ESMTP id r27GYthh008702 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Thu, 7 Mar 2013 11:34:57 -0500 (EST) Subject: Re: Argument list too long Mime-Version: 1.0 (Apple Message framework v1283) From: Chris Ross In-Reply-To: <20130307161546.GV47829@e-new.0x20.net> Date: Thu, 7 Mar 2013 11:34:48 -0500 Message-Id: <0CABF9B0-5274-44B3-984E-54CCD5C2F687@distal.com> References: <82112.1362671436.13776555968178880512@ffe17.ukr.net> <20130307161546.GV47829@e-new.0x20.net> To: Lars Engels X-Mailer: Apple Mail (2.1283) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-fs@freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2013 16:35:02 -0000 On Mar 7, 2013, at 11:15 AM, Lars Engels wrote: > On Thu, Mar 07, 2013 at 05:50:36PM +0200, Vladislav Prodan wrote: >> Why 12K small files from one directory to cause problems? >>=20 >> # ll | wc -l >> 11467 >>=20 >> # grep X-PHP-Script * | more >> /sbin/grep: Argument list too long. >>=20 >> # egrep X-PHP-Script *.ua | more >> /usr/sbin/egrep: Argument list too long. >>=20 >> # cat *.ua | grep X-PHP-Script | more >> /sbin/cat: Argument list too long. >>=20 >=20 > Your shell can't process that many arguments. Use this: >=20 > grep -R "X-PHP-Script" . >=20 > or if you don't want to descent into subdirectories: >=20 > find . -type -f -name '*.ua' -maxdepth 1 -exec grep "X-PHP-Script" {} = \+ Those solutions will work, but the problem is actually the inability = of the shell to start a process with that long of an argument list. = (ARG_MAX bytes). The shell can process them, just not hand them off to = another process via the argument vector. echo * | xargs grep X-PHP-Script | more will also work. (man xargs for more information) Sorry to be a bit pedantic. - Chris