The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Arg List too Long in SCP chris1234 UNIX for Dummies Questions & Answers 5 02-27-2008 08:40 AM
ls -t arg list too long CSU_Ram UNIX for Dummies Questions & Answers 4 05-05-2005 11:19 AM
arg list too long encrypted UNIX for Advanced & Expert Users 8 11-12-2004 06:38 AM
command find returned bash: /usr/bin/find: Argument list too long yacsil Shell Programming and Scripting 1 12-15-2003 06:38 PM
arg list too long vingupta UNIX for Dummies Questions & Answers 5 08-03-2001 12:43 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-02-2006
dad5119 dad5119 is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 4
Question Argument list too long - Shell error

Trying to tar specific files from a directory causes problems when the number of files is too large.

ls ~/logs | wc -l
5928

In the logs directory - I have 5928 files

If I want to include all files with today's date - I run the following command

tar cf ~/archive/LoadLogs_20060302.tar ~/logs/LoadLog_20060302_*.log

However, I get the following error:

/usr/bin/tar: Argument list too long

Any suggestions on how to correct this would be appreciated.

Thanks,

Rick

Last edited by dad5119; 03-02-2006 at 04:31 PM..
  #2 (permalink)  
Old 03-02-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,122
Your tar command doesn't look right. You need something like:
tar cf ~/archive/LoadLogs_20060302.tar ~/logs/LoadLog_20060302_*.log
  #3 (permalink)  
Old 03-03-2006
hegemaro hegemaro is offline
Registered User
  
 

Join Date: Feb 2006
Location: Schenectady, NY
Posts: 134
You can specify an "include file" usually with a -I option. To use, create a directory listing into the include file:

ls -1 ~/logs/LoadLog_20060302_*.log > /tmp/tar.include

Then run the tar command

tar -cf ~/archive/LoadLogs_20060302.tar -I /tmp/tar.include
  #4 (permalink)  
Old 03-03-2006
dad5119 dad5119 is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 4
Argument list too long for multiple commands

Thanks for the suggestions - however when I use an asterisk in my matching criteria (even for the "ls" command) - I get the same error.

I guess the default limit for an argument list is used for ALL commands.
Commands like "ls" "gzip" "tar" "cp" "mv" "cat" - all complain when I try to limit the argument list.

I was hoping there was some shell configuration setting that would increase the allowable size - but I'm beginning to think that it's the programs problem - not the shell environment.

Rick
  #5 (permalink)  
Old 03-03-2006
hegemaro hegemaro is offline
Registered User
  
 

Join Date: Feb 2006
Location: Schenectady, NY
Posts: 134
Quite right, I should have seen that coming. Use the find command to generate the include file:

find ~/logs/ -name "LoadLog_20060302_*.log" > /tmp/tar.include

This isn't AIX by chance is it?
  #6 (permalink)  
Old 03-03-2006
bigearsbilly bigearsbilly is offline
Registered User
  
 

Join Date: Feb 2006
Location: Southern England
Posts: 104
not c shell by any chance?
  #7 (permalink)  
Old 03-03-2006
dad5119 dad5119 is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 4
Not C shell.
Running ksh on Unix and Linux - same results on both.

Thanks
Closed Thread

Bookmarks

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:42 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0