Command Line Magic

A fairly common problem with monitors under Linux is that the screen resolutions supported by a particular monitor are not transmitted correctly to the operating system, thus resulting in less-than-ideal resolutions. To rectify this problem, one has to look up the monitor's supported resolutions in the manual, and then to manually set up these resolutions under Linux. Unfortunately, the last step is still far from straightforward in recent Ubuntu releases. Furthermore, many of the HOWTOs you find with Google only work for older Ubuntu releases (e.g. those using the now obsolete /etc/X11/xorg.conf), or they dig unnecessarily deep under the hood and might break things. In a nutshell, the correct way to do things these days is to use the xrandr command and to save the correct settings to the .xprofile file in the home directory. Superuser rights are not needed at all!

In this article I'll describe some Linux command-line tools to analyze and convert text files between different character encodings. I'll also touch on the different newline encodings of the major operating systems. Finally, we'll have a look at "forensics" on files with corrupted character encodings and how to repair them.

Imagine we have a Linux-based web server using MySQL, but phpMyAdmin is not available for maintaining the databases. In that case we can log into the server via SSH and use the command line instead. For a brief summary of basic MySQL commands see e.g. here.

Individual tables or entire databases can be easily removed using the drop command, but there is no straightforward way to delete a large number of tables from a database. I encountered this problem when attempting to upgrade a Joomla installation from v1.5 to v2.5. When I wasn't happy with the result of an upgrade attempt, I would first make tabula rasa by deleting the newly created mysql tables before making another attempt. Let's say the database in question looks like this:

Occasionally I perform time-intensive tasks on the command line like compiling, downloading or shuffling around large files. It would be nice to know when a task has been completed, so why not use GNOME's integrated notification system for this? The screenshot below shows what it can look like: