Tags: shell

Send XMPP messages with Perl (from the command line, too!)

I had been looking for a small, simple utility for Windows that could send XMPP messages from the command line for use in various automated tasks and notification processes. I came across sendxmpp as part of the CygWin installation, but could not successfully install its dependencies with CygWin’s CPAN port. I’ve been playing around with the Net::XMPP Perl library, and in spite of its poor documentation, I decided that I was going to hack away with it until I got something usable. I’m a programmer, after all—if a utility I need doesn’t exist, why not make it myself? Read More →

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 →