<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: 'ls' command showing argument too long !! in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066098#M139680</link>
    <description>Hi,&lt;BR /&gt;there is a limit, i think 1256 bytes.&lt;BR /&gt;&lt;BR /&gt;When you issue an&lt;BR /&gt;&lt;BR /&gt;ls -R /a/b/c/*&lt;BR /&gt;&lt;BR /&gt;the shell expands the * to the list of names. If they are, in lenght, more than XXX, you get argument too long.&lt;BR /&gt;&lt;BR /&gt;ls -R /a/b/c/&lt;BR /&gt;&lt;BR /&gt;do not cause the expansio, because there are no wildcard.&lt;BR /&gt;&lt;BR /&gt;  &lt;BR /&gt;&lt;BR /&gt;    Massimo&lt;BR /&gt;</description>
    <pubDate>Mon, 08 Sep 2003 16:39:23 GMT</pubDate>
    <dc:creator>Massimo Bianchi</dc:creator>
    <dc:date>2003-09-08T16:39:23Z</dc:date>
    <item>
      <title>'ls' command showing argument too long !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066095#M139677</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I just encountered a problem when running the 'ls -R /a/b/c/*' command .....and the system complained argument too long....&lt;BR /&gt;&lt;BR /&gt;However, if I just use 'ls -F /a/b/c' and it works fine......also two different accounts run the first command will have different results....one was alright while the other complains argumen too long...&lt;BR /&gt;&lt;BR /&gt;I am just wondering what's wrong with 'ls'...is there any buffer or environment variable I can set to get rid of this problem ??&lt;BR /&gt;&lt;BR /&gt;FYI, I am using KSH&lt;BR /&gt;&lt;BR /&gt;Many thanks,&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Mon, 08 Sep 2003 16:34:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066095#M139677</guid>
      <dc:creator>Chris Fung</dc:creator>
      <dc:date>2003-09-08T16:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: 'ls' command showing argument too long !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066096#M139678</link>
      <description>Chris,&lt;BR /&gt;&lt;BR /&gt;When using the wild card, the shell attempts to expand the file name using file name completion and the list simply ends up being too long.  There is no way to change this shell behaviour, however, you can work around it using find:&lt;BR /&gt;&lt;BR /&gt;find /a/b/c |xargs ll&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Sep 2003 16:38:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066096#M139678</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2003-09-08T16:38:14Z</dc:date>
    </item>
    <item>
      <title>Re: 'ls' command showing argument too long !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066097#M139679</link>
      <description>My system posix and korn shell(ksh) has no problem with that command.&lt;BR /&gt;&lt;BR /&gt;You may want to look and see if you have ls alias of some sort.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 08 Sep 2003 16:39:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066097#M139679</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-09-08T16:39:12Z</dc:date>
    </item>
    <item>
      <title>Re: 'ls' command showing argument too long !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066098#M139680</link>
      <description>Hi,&lt;BR /&gt;there is a limit, i think 1256 bytes.&lt;BR /&gt;&lt;BR /&gt;When you issue an&lt;BR /&gt;&lt;BR /&gt;ls -R /a/b/c/*&lt;BR /&gt;&lt;BR /&gt;the shell expands the * to the list of names. If they are, in lenght, more than XXX, you get argument too long.&lt;BR /&gt;&lt;BR /&gt;ls -R /a/b/c/&lt;BR /&gt;&lt;BR /&gt;do not cause the expansio, because there are no wildcard.&lt;BR /&gt;&lt;BR /&gt;  &lt;BR /&gt;&lt;BR /&gt;    Massimo&lt;BR /&gt;</description>
      <pubDate>Mon, 08 Sep 2003 16:39:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066098#M139680</guid>
      <dc:creator>Massimo Bianchi</dc:creator>
      <dc:date>2003-09-08T16:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: 'ls' command showing argument too long !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066099#M139681</link>
      <description>This has been discussed in these old threads:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x106937f45ef7d4118fef0090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x106937f45ef7d4118fef0090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x5749c4c76f92d611abdb0090277a778c,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x5749c4c76f92d611abdb0090277a778c,00.html&lt;/A&gt;</description>
      <pubDate>Mon, 08 Sep 2003 17:06:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066099#M139681</guid>
      <dc:creator>Helen French</dc:creator>
      <dc:date>2003-09-08T17:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: 'ls' command showing argument too long !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066100#M139682</link>
      <description>Hi Chris,&lt;BR /&gt;&lt;BR /&gt;The difference between the -R &amp;amp; -F are as follows:&lt;BR /&gt;&lt;BR /&gt;-R =&amp;gt; list subdir contents as well as files.&lt;BR /&gt;&lt;BR /&gt;-F =&amp;gt; list subdir name &amp;amp; a symbol (/) that the entry is a subdir&lt;BR /&gt;&lt;BR /&gt;The former will obviously have more entries, hence the "arg too long" msg&lt;BR /&gt;&lt;BR /&gt;The account differences, I suspect, have something to do with ulimit differences.&lt;BR /&gt;The solution is to use the xargs (extended arguments) command.&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Jeff</description>
      <pubDate>Mon, 08 Sep 2003 17:07:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066100#M139682</guid>
      <dc:creator>Jeff Schussele</dc:creator>
      <dc:date>2003-09-08T17:07:42Z</dc:date>
    </item>
    <item>
      <title>Re: 'ls' command showing argument too long !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066101#M139683</link>
      <description>This will ALWAYS occur if the number of files in the /a/b/c/ directory is very large OR the names of the files or directories are extremely long. As mentioned, the * character is very special. It is *NOT* passed to the ls command at all (under default conditions that is). Instead, the shell replaces the entire string /a/b/c/* with a full listing of all the names in that directory. To see this happen, change your command from:&lt;BR /&gt;&lt;BR /&gt;ls -R /a/b/c/*&lt;BR /&gt;&lt;BR /&gt;to&lt;BR /&gt;&lt;BR /&gt;echo ls -R /a/b/c/*&lt;BR /&gt;&lt;BR /&gt;and you'll see the same error. To see what the ls command sees in a smaller directory, do this:&lt;BR /&gt;&lt;BR /&gt;echo ls /etc/*&lt;BR /&gt;&lt;BR /&gt;Now tell the shell to stop expanding the * by escaping it's special meaning:&lt;BR /&gt;&lt;BR /&gt;echo ls /etc/\*&lt;BR /&gt;&lt;BR /&gt;and:&lt;BR /&gt;&lt;BR /&gt;ls /etc/\*&lt;BR /&gt;&lt;BR /&gt;The \ removes the special meaning of the * character. All this is covered in the manpages: man 5 regexp (the 5 is required, see man man)&lt;BR /&gt;&lt;BR /&gt;So the error has nothing to do with ls but instead is a function of what the shell finds to match. For instance:&lt;BR /&gt;&lt;BR /&gt;cd /a/b/c&lt;BR /&gt;ls -R&lt;BR /&gt;&lt;BR /&gt;may work just fine because the expanded expanded list of matching filenames no longer contains the fullpath to this directory. However, add a few thousand more files to this directory and again you'll get the same error. When in doubt, use echo to see what your command line will look like after the shell finishes it's preprocessing.&lt;BR /&gt;&lt;BR /&gt;---------------------------&lt;BR /&gt;&lt;BR /&gt;For extra credit, here's a script that you can use to create 10,000 files to demonstrate the problem:&lt;BR /&gt;&lt;BR /&gt;mkdir /var/tmp/dummy&lt;BR /&gt;cd /var/tmp/dummy&lt;BR /&gt;&lt;BR /&gt;typeset -Z20 NUM=10000&lt;BR /&gt;while [ $NUM -gt 0 ]&lt;BR /&gt;do&lt;BR /&gt;touch IamAveryLONGfileNAMEtoSHOWcommandLINElimits_$NUM&lt;BR /&gt;let NUM=$NUM-1&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;Then use the * with either echo * or ls *&lt;BR /&gt;&lt;BR /&gt;Warning: This will create a very large directory structure and will take a long time to create and also to remove.</description>
      <pubDate>Tue, 09 Sep 2003 02:41:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066101#M139683</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2003-09-09T02:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: 'ls' command showing argument too long !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066102#M139684</link>
      <description>Hi Bill,&lt;BR /&gt;&lt;BR /&gt;I still got one more questions.....!!  Since different accounts (with different profiles) will produce different results for the "ls /a/b/c/*" command.&lt;BR /&gt;&lt;BR /&gt;e.g. an account with a few lines .profile and environment variable defined will be able to execute the above command&lt;BR /&gt;&lt;BR /&gt;While an other account with hundreds of environment variable defined are unable to execute the above command.&lt;BR /&gt;&lt;BR /&gt;I am just wondering whether the environment variables set to the user account (i.e. the .profile) will affect the behaviour of the command or should say affect the maximum argument length of the Unix command.  and Why ?  Is that the shell environment has been assigned with a limited amount of buffer or some structures that both the environment variables and the command line share ?&lt;BR /&gt;&lt;BR /&gt;Appreciated for your advice and input.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Chris,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Sep 2003 04:30:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066102#M139684</guid>
      <dc:creator>Chris Fung</dc:creator>
      <dc:date>2003-09-10T04:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: 'ls' command showing argument too long !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066103#M139685</link>
      <description>Hi Bill,&lt;BR /&gt;&lt;BR /&gt;I still got one more questions.....!!  Since different accounts (with different profiles) will produce different results for the "ls /a/b/c/*" command.&lt;BR /&gt;&lt;BR /&gt;e.g. an account with a few lines .profile and environment variable defined will be able to execute the above command&lt;BR /&gt;&lt;BR /&gt;While an other account with hundreds of environment variable defined are unable to execute the above command.&lt;BR /&gt;&lt;BR /&gt;I am just wondering whether the environment variables set to the user account (i.e. the .profile) will affect the behaviour of the command or should say affect the maximum argument length of the Unix command.  and Why ?  Is that the shell environment has been assigned with a limited amount of buffer or some structures that both the environment variables and the command line share ?&lt;BR /&gt;&lt;BR /&gt;Appreciated for your advice and input.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Chris,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Sep 2003 04:31:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066103#M139685</guid>
      <dc:creator>Chris Fung</dc:creator>
      <dc:date>2003-09-10T04:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: 'ls' command showing argument too long !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066104#M139686</link>
      <description>Hi Bill,&lt;BR /&gt;&lt;BR /&gt;I still got one more questions.....!!  Since different accounts (with different profiles) will produce different results for the "ls /a/b/c/*" command.&lt;BR /&gt;&lt;BR /&gt;e.g. an account with a few lines .profile and environment variable defined will be able to execute the above command&lt;BR /&gt;&lt;BR /&gt;While an other account with hundreds of environment variable defined are unable to execute the above command.&lt;BR /&gt;&lt;BR /&gt;I am just wondering whether the environment variables set to the user account (i.e. the .profile) will affect the behaviour of the command or should say affect the maximum argument length of the Unix command.  and Why ?  Is that the shell environment has been assigned with a limited amount of buffer or some structures that both the environment variables and the command line share ?&lt;BR /&gt;&lt;BR /&gt;Appreciated for your advice and input.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Chris,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Sep 2003 04:32:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066104#M139686</guid>
      <dc:creator>Chris Fung</dc:creator>
      <dc:date>2003-09-10T04:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: 'ls' command showing argument too long !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066105#M139687</link>
      <description>Hi Bill,&lt;BR /&gt;&lt;BR /&gt;I still got one more questions.....!!  Since different accounts (with different profiles) will produce different results for the "ls /a/b/c/*" command.&lt;BR /&gt;&lt;BR /&gt;e.g. an account with a few lines .profile and environment variable defined will be able to execute the above command&lt;BR /&gt;&lt;BR /&gt;While an other account with hundreds of environment variable defined are unable to execute the above command.&lt;BR /&gt;&lt;BR /&gt;I am just wondering whether the environment variables set to the user account (i.e. the .profile) will affect the behaviour of the command or should say affect the maximum argument length of the Unix command.  and Why ?  Is that the shell environment has been assigned with a limited amount of buffer or some structures that both the environment variables and the command line share ?&lt;BR /&gt;&lt;BR /&gt;Appreciated for your advice and input.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;&lt;BR /&gt;Chris,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Sep 2003 04:33:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066105#M139687</guid>
      <dc:creator>Chris Fung</dc:creator>
      <dc:date>2003-09-10T04:33:49Z</dc:date>
    </item>
    <item>
      <title>Re: 'ls' command showing argument too long !!</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066106#M139688</link>
      <description>The "line too long" error is not from Unix (HP-UX), it is a shell error message. So the situation is depends on the shell. Most shells will use ARG_MAX (use the command: getconf ARG_MAX) to size their internal buffers. The user environment does not (normally) change this value (ie, no particular env param will change this limit or occupy this space).&lt;BR /&gt;&lt;BR /&gt;What may be happening is that the argument list is different because of the specific directory permissions or (more likely) the ls command itself is not really the default built-in. For example:&lt;BR /&gt;&lt;BR /&gt;alias ll='/usr/bin/ls -alF'&lt;BR /&gt;&lt;BR /&gt;might be in a user's .profile so to see what a user 'really' is running, do this:&lt;BR /&gt;&lt;BR /&gt;type ls&lt;BR /&gt;&lt;BR /&gt;(type is an alias for whence -v) Unlike which and whereis, the type/whence command tells you exactly what will happen when you type a particualr string. Here are some examples:&lt;BR /&gt;&lt;BR /&gt;type pwd ls ll for fc passwd&lt;BR /&gt;&lt;BR /&gt;The ls -a option will return more filenames (ie, 'hidden' or dot-files). Do this in each user environment:&lt;BR /&gt;&lt;BR /&gt;echo * | wc&lt;BR /&gt;&lt;BR /&gt;This will tell you what * will return for a psecific user. Differences will be due to what the user is allowed to see based on user and group permissions.</description>
      <pubDate>Wed, 10 Sep 2003 10:57:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/ls-command-showing-argument-too-long/m-p/3066106#M139688</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2003-09-10T10:57:10Z</dc:date>
    </item>
  </channel>
</rss>

