Cleaning up log and cache files with BleachBit
Many Linux services and applications create a continuous log of their activities. BleachBit cleans up the resulting log files conveniently and efficiently.
On Linux systems, most system-relevant processes keep logfiles that record what the software has been doing. Although this feature is fantastic for forensics experts and system analysts, users normally hate it. The verbosity of the various daemons and applications leads to continuous growth of logfiles that are not actually needed on a working system in normal circumstances. At the same time, some services also create rotating archives and backup copies of the logs, thus consuming even more disk space.
But that's not all: Among the ranks of these relics, which I am sure are saved with the user's best interests in mind, you will also find the cache files that many applications use to improve hard disk access speed. Web browsers are the major culprits here; besides storing a history of the websites a user visits, they also include content such as images and graphics to provide a faster load time the next time the user visits a page. Firefox and other browsers also save website cookies by default.
Even multimedia applications like Rhythmbox, the proprietary RealPlayer, and most Chat programs hoard tons of user data, causing even computers with a minimum of usage to build up considerable data collections in the course of time. Apart from the fact that these files waste a lot of space, keeping a detailed record of your usage is quite dangerous for your privacy: the files, many of them in clear text, reveal a comprehensive record of the user's behavior.
Linux offers a number of onboard tools to stem this flood of logs: For example, a cron job lets you delete logfiles at regular intervals, and logrotate allows you to compress, rotate, and delete the system log. However, you do need to work at the command line to configure this option.
BleachBit  it is a small graphical helper that reliably removes cached file relics from your most sensitive applications. The program is available in the repositories of Debian and Ubuntu derivates. If you have a distribution such as CentOS, Fedora, Mandriva, Slackware, or the Red Hat and Novell Enterprise variants, prebuilt packages are available for easy installation; for all other Linux flavors, you will need to build BleachBit manually from the source.
In Gnome, the BleachBit installation routine creates two entries in the Applications | System tools menu: The first gives you access to the program in user mode. You need to be an administrator to launch the program in the second mode. No matter which operating mode you are using, you will see the same two-part program window when you launch BleachBit. On the left-hand side, you can choose which of the predefined cache and logfiles belonging to various applications and services you would like to delete. When you make a selection, BleachBit displays detailed information on the deletion steps (Figure 1).
Above the two-part window is a button bar. Preview lets you find the obsolete data without actually deleting it. This gives you an overview of how much memory you could free up by deleting the files. Clicking Delete will irrevocably remove the files after a security prompt. If you attempt to delete in user mode, BleachBit only deletes those files that you are entitled to remove. Files that need root privileges are highlighted in red; thus, if you want to get rid of the ballast on your system, it makes sense to become root before launching BleachBit.
BleachBit uses a context-sensitive approach when deleting files. For example, it will remove the rotating, and typically compressed, files from the central log directory on any Linux distribution, but it will not remove the system logfile that is currently in use by the X Server or the kernel (Figure 2).
Although BleachBit will clean up a typical Linux system fairly effectively, you can't expect it to know just any old application out of the box. This is why the software gives you the additional option of adding programs to the list of services you want to monitor. You can add modules in the form of XML files .
Designing Your Own Modules
To customize BleachBit for your own needs, you don't need professional programming skills. If you have some experience with HTML tagging, you will soon feel at home with the XML language syntax used by BleachBit. Individual, typically application-specific, modules comprise various structured texts, each of which is delimited by a tag at its start and end. Angle brackets enclose the tags, with a slash before the closing tag. Between the tags, you can have descriptive text or variables. Various characters are available for tagging comments that you do not want to interpret.
Because the modules are written in clear text, it makes sense to look at one of BleachBit's internal applications to get to know the syntax. The program stores its global cleaner modules in /usr/share/bleachbit/cleaners, so you can store your own cleaning instructions in the same place.
The first line of each module comprises a version and codepage declaration. This defaults to <?xml version="1.0" encoding="UTF-8"?>; you can replace the UTF-8 codepage if you use, for example, one of the many ISO 8859 variants on your system instead of the UTF-8 character set. (To discover which character set your Linux system uses, simply enter the locale command in a terminal window.)
After these introductory details, the prebuilt modules will have a fairly lengthy copyright comment. Comments are not parsed when the software runs. Although there is no need for you to add comments to your own modules, it makes sense to insert explanations before the various cleaning instructions in longer and more complex modules to improve readability and remind yourself, or help others understand, how the module actually works. Each line of comment starts with a <!-- string and end with a --> string.
A simple cleaning instruction is shown in Figure 3. The cleaner module starts in the following line: <cleaner id= "<unique ID>". Instead of <unique ID>, enter an intuitive name for the module. This line will not appear in the program window when the module runs; however, it is used to improve readability and serve as an internal ID. The <label> tag in the following line is used to define an arbitrary designator for the cleaning action you want to perform; this name will appear in the BleachBit program window. The line ends with a </label> tag.
The description of the cleaning process in the next line is enclosed in <description>…</description> tags. The generic description of the cleaning action appears on the right-hand side of the BleachBit program window.
The <option id="<option>"> tag starts the cleaning function itself. This ID tag and its content are not published in the BleachBit program window but serve to identify the various cleaning instructions in the program individually. This explains why each option ID is terminated by an </option> tag, which allows you to use different option IDs to delete the browsing history, the cache, and the cookies in a web browser individually.
To allow the user to check a box in the BleachBit program window to control each of these functions individually, each instruction needs an option ID. Three tags are typically relevant within a cleaning instruction identified by an option ID: <label>, <description>, and <action>. The <label> tag serves to visualize the entries in the BleachBit program window's two frames. The <description> tag posts an explanation of the cleaning action described in the option ID section on the right-hand side of the application window. Both tags are closed in the usual way with a closing tag, which is identical to the opening tag, with the exception of the slash in the angle brackets.
The cleaning action is described by the <action> tags. Various parameters are predefined here to let you specify the cleaning target in a highly granular way. The type="<type>" parameter describes what kind of target to delete. If you specify, say, the file function here, the cleaning action will delete exactly one specified file.
The children function combined with the directories="false" parameter deletes all the files in the specified directory, but without deleting the subdirectories in the filesystem tree. If you additionally want to delete the subdirectories, you need to change the directories= "false" option to directories="true". The children instruction thus requires a directories parameter definition. The glob option supports the use of wildcards in the cleaning function and removes any files that match the definition.
Of course you can group multiple cleaning functions with a single option ID. This approach makes sense if applications use various locations in various directories to store their cache or temporary files. Additionally, all cleaning actions can be grouped in a single program with a single option ID, if you do not need a more granular approach.
You need to close each <action> tag with a matching </action> tag, just as with the <label> and <description> tags. You cannot have a succession of <action> tags with a single closing tag.
After defining all the required cleaning actions, you need to identify the various sections and the whole module with closing functions. </option> closes the sections, and </cleaner> terminates the whole module.
The <warning> tag is a special case. You can insert a <warning> tag inside an option ID to issue a warning to the user when they select a specific option in the BleachBit program window. Arbitrary text can be inserted between the opening and closing (</warning>) tags. A warning function always makes sense if a user takes drastic action, such as deleting a complete directory tree; the user could appreciate being notified of the potential danger of deleting what might be valuable data.
When BleachBit deletes a file, it does not completely overwrite the content, and it is typically possible to restore the files if the need arises. If you prefer to delete files without a restore option, BleachBit can overwrite files to give you this assurance. Just enable the overwrite function in the Edit | Preferences menu by checking the box for Overwrite files to hide contents. Then you can select one or multiple files in the File | Shred Files menu for complete removal. If you confirm the prompt, the files are then irrevocably deleted from your disk, which can take considerable time if the files contain large amounts of data.
Both projects help organizations build their own containerized systems.
Mark Shuttleworth has resumed the position of CEO of Canonical.
Microsoft's open source code hosting platform CodePlex will come to an end after a more than 10-year stint.
Comes with Gnome 3.24
The bug was introduced back in 2009 and has been lurking around all this time.
The new release deprecates the sshd_config UsePrivilegeSeparation option.
Lives on as a community project
Five new systems join Dell XPS 13 Developer Edition that come with Ubuntu pre-installed.
The Skype Linux client now has almost the same capabilities that it enjoys on other platforms.
At CeBIT 2017, OpenStack Day will offer a wide range of lectures and discussions.