Argument list too long

Any of you encountered “Argument list too long” problem when trying to mass delete files in a folder? Today I want to erase more than a million files in a folder. So I ran “rm -rf *.jpg” and the “Argument list too long” error was returned. What the hell???

So I quickly google this Argument bla bla bla thinggy.

This is what I understand so far:

The reason for this annoyance is that Linux kernel has a limitation of bytes it can process through as arguments in exec() commands. [http://netweblogic.com/linux/linux-commands-argument-list-too-long/]

The system could not handle the number of arguments given to a command or program when it combined those arguments with the environment’s exported shell variables. The argument list limit is the size of the argument list plus the size of the environment’s exported shell variables.

The easiest solution is to reduce the size of the parent process environment by unsetting extraneous environment variables. (See the man page for the shell you’re using to find out how to list and change your environment variables.) Then run the program again.

An argument list longer than ARG_MAX bytes was presented to a member of the exec() family of system calls.

Moral of the story: Everythings has its own limitation. 😉

How to solve this?

According to Alessandre S. Naro in “Argument list too long”: Beyond Arguments and Limitations, he points out 4 ways to overcome this problem.

Method #1: Manually split the command line arguments into smaller bunches.
Method #2: Use the find command.
Method #3: Create a function. and
Method #4: Recompile the Linux kernel.

So I choose method #2. Easier and faster. You can run this in single command. Example:

find /opt/library/images/bookcovers_tiny/ -name ‘*.jpg’ -print0 | xargs -0 rm -f

Done. All files deleted. Yeay!!

 

Ubuntu 8.10RC is coming

Good Evening,

Ubuntu the best Linux Distro (me thinks) is releasing the next version 8.10 Intrepid Ibex soon. As of now, Release Candidate is available here. Shall I be upgrading to the latest version? I don’t think so. Am feeling lazy to re-install Ubuntu. Hear me when I say, I don’t like upgrading Ubuntu or any other Operating System. There’s nothing better than the fresh installation of an Operating System. Furthermore, being on LTS now. Why should I upgrade? I would if I have the time. Heh. /rolling eyes.

Let’s see, what Ubuntu 8.10 is offering. Usually, the new release has better applications and a new kernel. However, one will never know what lurks behind. /sinister smile. Upgrading is not for the fainted heart. Save it for the bold. Let the experienced users test and conclude it in the future. Well, we will know. Okay, on the new features now.

  • GNOME 2.24
  • X.Org 7.4
  • Kernel 2.6.27
  • Encrypted private directory (nice feature for the paranoid)
  • New Guest session
  • Network Manager 0.7
  • DKMS
  • Samba 3.2
  • PAM authentication framework
  • Totem BBC Plugin
  • Server Virtualization and many more

As promised by Canonical Foundation, every 6 months, a new version of Ubuntu will be released. The new 8.10 Intrepid Ibexis is scheduled to be released on 30th October 2008.

Do you believe in Ubuntu? Well, I believe. What about you?