I had a need today to batch-change a lot of database connection strings in Drupal installations. You might need to do this if you have a lot of sites and are switching from webserver-and-database-server-on-the-same-box to Drupal with a separate database server. Here were some handy shell commands that I used.
Find all the settings.php files in this directory tree:
find /var/www/html -name settings.php -print
Show all the current database connection strings (make sure no one's looking over your shoulder!):