I gave the command rm *, but I got the following error:
/bin/rm: Argument list too long.

The directory has lots files that I want to delete. How can I do it?
- Rob

The reason for the error is that in shell when you mention a *, your shell actually expands that * and puts all the filenames there and since length of the command line is limited, you end up getting argument list too long error.

To remove all the files, you can do any one of the following:

  • You can remove the whole directory and recreate the directory.
  • Use find . -exec rm {} \;
  • Use find . -name '*' | xargs rm

Monkey gets the banana :)

Webmonkey used to be a great resource for web developers long back. It’s back now as a wiki :)

The original web developer’s resource has returned. Webmonkey has been completely redesigned, and we’re ready to rock once more. Also, our entire content library is now hosted on a wiki, so every tutorial, reference page and code example is open for editing. Come on in and show us what you’ve got!

Go check it out.

Elsewhere:

I am new to Linux. I have remote root SSH access to the machine. I will like to know the amount of free storage space on the drives in various partitions. Is there any command or utility to know this?
- Mikin

We can use the “df” command at the terminal prompt to get a report on the available space. The output will look similar to this:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda5            111148100   1575952 103926108   2% /
/dev/sda1               101086      8471     87396   9% /boot
none                    517428         0    517428   0% /dev/shm
/dev/sda3              2063536     36936   1921776   2% /tmp
/dev/scd0               593958    593958         0 100% /cdrom

(The information shown above if from a machine at my place of study.)

To check the syntax of all files ending with ‘.php’ file extension and execute the syntax check of php for every found file, we can use:

find ./ -type f -name \*.php -exec php -l {} \;

It is quite useful when you want to quicly see if any php file in a project/bunch of files, contains a parse error. Note: This command is for Linux/ Unix based systems. This will not work on a Windows system.