May I ask you how many files are in that directory?
I may be you reached the maximum argument a command (here ls) can take
A workaround is to use | xargs
The problem is not a filesystem limit, the problem is a commandline limit: when you enter a command with a (shell-)variable or wildcard, like you entered "ls -l *sh" then the shell will expand the wildcard to all the filenames it is representing. Only then it will call the binary (ls in this case) and feed it whatever the wildcard has expanded to.
Example:
# ls -l
total 55
-rwxr-xr-- 1 root system 20455 Jan 08 12:03 a.sh
-rw------- 1 root system 2527 Dec 08 2006 b.sh
-rwxr-xr-- 1 root system 5617 Feb 20 13:24 c.sh
We enter a command:
# ls -l *sh
Now, before giving the command to ls, the shell looks up what "*sh" represents and expands that to "a.sh b.sh c.sh". The command line now looks like:
# ls -l a.sh b.sh c.sh
Only now "ls" is called and fed the rest of the command line.
Alas, command lines cannot grow ad infinitum. POSIX has a limit of 4k characters and exactly this limit is exceeded in your case as the last value in your output of wc (the number of characters) shows. This is a pretty common gotcha in shell scripting and the common solution is to avoid constructions like that and use "find" instead. Your command above could be safely written this way:
Thank for your detail explanation. I have two more questions hope you can give me some clue as well.
if using ls with wildcard , it is quite easy to exceed the limit as only allow for 4k of characters?
For the same case as my initial question, once i use "root" to perform
ls *sh, the result can output on the screen without any error. What root diff from a normal user in this case?