Tags: linux

Help! I can’t delete phpMyAdmin’s setup.php

I’ve got a VPS server running Debian 5 “lenny” and recently attempted to perform several software upgrades to bring it up to speed (it had been longer than I care to admit). However, the upgrade for the phpMyAdmin package continually failed, stating that it was unable to remove /usr/share/phpmyadmin/scripts/setup.php. The file had apparently been given the file permissions mask of “000”, which essentially denies any sort of action being taken against the file. “No problem,” I thought, “I’ll just chmod it to allow deletion and be on my merry way!” Well… it was a problem. Read More →

Linux: Get size of sub-directores in current directory

Edit: Now that I’m more familiar with the Linux command line, I realize that I was trying to reinvent the wheel. I don’t know if I missed this part of the du manpage or what, but the functionality I was looking for is baked in:

du -hd 1

The h flag is for “human-readable format”, and d 1 tells the program to go “no deeper than 1 level from the given folder”. (With no folder specified, the current directory is used.)

The following string of commands can be used to not only list the immediate sub-directories of the current directory, but also print their size in human-readable format (kilobytes):

du -sh `ls -l | grep '^d' | awk '{print $9}'`

Here’s how it works: Read More →