(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version



This article is from a FAQ concerning SCO operating systems. While some of the information may be applicable to any OS, or any Unix or Linux OS, it may be specific to SCO Xenix, Open Desktop or Openserver.

There is lots of Linux, Mac OS X and general Unix info elsewhere on this site: Search this site is the best way to find anything.

Unix, Xenix and ODT General FAQ

How do I solve an "arglist too long"?





Wildcard expansion (globbing) is performed by the shell. There is a limit of 5120 bytes (5k) for the environment and command line arguments put together, in all versions of SCO Xenix and SCO Unix versions prior to OpenServer 5; more on OSR5 later. See also TA 480563.

This is particularly likely to be a problem under X, as it has a habit of using a lot of environment space. It is also a problem when running a command such as ls *.c in a directory with a large number of files which match the filespec.

The general solution is to construct your command in such a way that it does not have to include all of the filenames on the command line. You can use the echo command, which is built into the shells and therefore is not subject to the 5k limit. For example, rather than rm V*, you might try echo V* | xargs rm. A similar, but somewhat more complex solution, might involve using the ls command to generate a list of filenames, and then using a command such as grep to filter them; ls | grep '^V' | xargs rm will perform the same task as the above example.

You may also find the find command to be useful in this; however, it works recursively so it may not be appropriate in a directory with subdirectories. Please consult the man pages for each of these commands to identify any unexpected side effects they may cause.

Another alternative, in cases where the environment is unnecessarily large, is to reduce its size. If you have some environment variables that you never use (be careful with this, as the system or some commands may use things you don't realize), you can permanently remove them in your .profile (or .login for C Shell users). You could also temporarily remove some manually. To run a subshell without any of the environment being passed to it, try running env - sh -c 'command'

OpenServer Release 5 makes two changes to cure this problem. The default limit has been increased substantially (to 100k), which should by itself fix almost all instances of "arglist too long". As well, it is now a tunable kernel parameter, ( http://aplawrence.com/cgi-bin/ta.pl?105076 MAXEXECARGS) so if the default isn't adequate, you can adjust it. One exception: /bin/csh still has a hard-coded limit to the length of a line. If you are using csh, you may wish to replace it with tcsh (discussed below).




Click here to add your comments



Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar


LOD Communications, Inc.


/SCOFAQ/FAQ_scotec1arglist.html copyright 1997-2003 (various) All Rights Reserved

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.


book graphic unix and linux troubleshooting guide

My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!



 I sell and support
 Kerio Mail server






More:
       - FAQ




Related Posts

Xargs test question

Xargs test question

Xargs

grep and ps

Grep awk example`

Grep -d --recurse

Grep in Depth

Wrapping scripts

How do I recursively grep through sub directories?



Unix/Linux Consultants

Skills Tests

Guest Post Here











My Favorites

Change Congress