Search

moreutils: A collection of useful command-line tools

April 15th, 2007 edited by Tincho

Entry submitted by John Beisley. DPOTD needs your help, please contribute !

Moreutils contains a suite of utilities for command-line users. Written by multiple authors, they are individually quite modest, and perhaps too limited in scope to exist in a package in their own right, but together they form a useful accompaniment to existing command-line tools.

Following are a few examples of the utilities in moreutils, and how they can be used.

Sponge - Soaking file redirects

Many users of the command line have made a mistake such as the following:

$ grep -v someuser /etc/passwd > /etc/passwd

As the shell runs this command it will immediately truncate the destination file, and then run the grep command on it. The end result is an empty file - certainly not what was intended! After learning from their mistake, the user might instead redirect the output to a temporary file, then move the file on top of the original:

$ grep -v someuser /etc/passwd > /etc/passwd.tmp
$ mv /etc/passwd.tmp /etc/passwd

Sponge is a simple, but convenient, command that exists to roll this process up into a single step:

$ grep -v someuser /etc/passwd | sponge /etc/passwd

Sponge ’soaks up’ its standard input, waiting for it to complete before writing to the specified output file. In this way the result is what was intended, and without the need to fiddle with temporary files.

Vipe - Interactively editing pipes

Sometimes it is desirable to put yourself in the middle of a pipe processing chain, where it will be quicker to just edit the pipe content, rather than create complex filters with sed and friends. Maybe the pipe content will be unknown, perhaps a list of files that the user would like to manually filter.

Say that you would like to touch all files in the current directory, but would like to do so selectively, you could do the following:

ls | vipe | xargs -d ‘\n’ touch

In this example a list of files is opened up in your editor (as set by either the EDITOR or VISUAL environment variables), in which you may edit the list of files to be touched at your leisure. When you are satisfied, you can save the file and quit your editor, and vipe will regurgitate the content you edited to its standard-out - touching only the files retained in the editor.

Combine - Boolean/Set operations with text files

Performing set operations with lines in two text files can also be useful. This can be useful in knowing what file names are common to two directories, for example:

Directory foo contains the files:

tom and harry
Directory bar contains the files:

tom and dick

The file lists can be written to two files ready for use with combine with the following bash command:

ls /path/to/foo > foo_list && ls /path/to/bar > bar_list

It can be complicated to find which files are present in both directories, which is where combine really comes into its own:

$ combine foo_list and bar_list
tom

How about files that are in foo, but not in bar?

$ combine foo_list not bar_list
harry

A note of caution, however: while using combine, ‘or’ can be used to find the complete list of files, it has the slightly odd effect of listing files common to both files twice:

$ combine foo_list or bar_list
harry
tom
dick
tom

Obtaining the union of the two lists of file names is therefore best performed with the standard sort command:

$ cat foo_list bar_list | sort -u
dick
harry
tom

Summary

This introduction to moreutils has only touched upon some of the commands that it provides. It is worth experimenting with the others, very briefly described here:

isutf8
Checks if a file consists of valid UTF-8
ts
Reproduces standard input on standard output, with a timestamp prefix - good for annotating non-timestamped log files.
vidir
Enables a user to “edit” a directory with their text editor. That is, to conveniently delete and rename files.
ifdata
Outputs requested information about a specific Linux network interface, without the need to parse ifconfig output.
pee
Acts like tee, but pipes to given commands, instead of standard out and files.
zrun
Automatically recognises compressed files passed to a given command, uncompresses them to a temporary file and passes the uncompressed files in place of the original compressed file arguments.
mispipe
Connects two commands with a pipe, as in command1 | command2, but returns the exit value of the first command, rather than the second.

moreutils has been available in Debian in testing and unstable distributions, and in Ubuntu from Edgy onwards.

Posted in Debian, Ubuntu | 5 Comments »

glabels: Label, business card and media cover creation program

April 13th, 2007 edited by Adelie

Entry submitted by Dave Seff. DPOTD needs your help, please contribute !

gLabels is a program for creating labels and business cards. It is designed to work with various laser/ink-jet peel-off label and business card sheets that you’ll find at most office supply stores.

This application is a gem of a program for anyone who want to create their own business cards, address labels, CD Labels and covers, and much more. It has an extensive database of label and sticker formats for most major brands of labels such as Avery, Neato, and Memorex. It also has a template creation feature which allows for custom labels and designs. For this example I will explain the basics on how to create a set of business cards.

When you choose new from the file menu, you are presented with a list of various standard label sets. I chose Avery 5871 Business cards as that was what I had purchased from the store.

From here you can start designing. You can place and format text, images, and basic shapes to your liking. Don’t worry about needing to duplicate these to cover the entire sheet of labels. gLabels knows to print the entire sheet as per the template used. Once you are satisfied with your design, just send it to the printer once you have loaded it with the store bought labels.

Screenshot

As you can see the interface is quite simple to use. Editing labels is simple and straight forward. News, updates and support can be found at the gLabels homepage, http://glabels.sourceforge.net/.

gLabels is written for the Gnome desktop environment but just like most Linux applications, it will run under any window manager. KDE has a similar application called kbarcode. The name is misleading however it does provide the same functionality. It does not seem to be as straightforward as gLabels, but it does support batch printing if you are mass producing labels for commercial use.

gLabels has been available in Debian since Sarge, and in Ubuntu since Warty.

Posted in Debian, Ubuntu | 4 Comments »

Reportbug-NG: An easy to use alternative to Debian’s classic reportbug

April 11th, 2007 edited by Tincho

This week, an extra DPOTD article will be published on Friday, remember to check it out!

Entry submitted by Bastian Venthur. DPOTD needs your help, please contribute !

Reportbug-NG is an alternative to Debian’s classic reportbug written with the end-user in mind. It has a nice and clean Qt interface allowing you to search for existing bug reports and filter them easy and fast. You can give additional information to existing bug reports or create new ones. In both cases a dialog will ask you for all relevant information (summary, severity, tags, …) and will finally start your favourite mail client, where you only have to fill the gap with your full report and click the “send” button.

A screencast showing Reportbug-NG in action (click on the image for full size):
Reportbug-NG screencast

The major advantages over reportbug are:

  • Graphical interface (true desktop application)
  • Severity and Status of bugs are associated with colors, so it’s easy to distinguish the different classes.
  • Easy and fast filtering of bug reports
  • Ability to write you bug reports with your mail client (spellchecker, copy-paste, attachments). The following Clients are currently supported:
    • Evolution
    • GoogleMail
    • Iceape/Mozilla
    • Icedove/Thunderbird
    • KMail
    • Mutt
    • Pine
    • Sylpheed
    • Sylpheed-Claws
    • Sylpheed-Claws-Gtk

Note to Ubuntu users: since reportbug-ng submits reports to the Debian BTS, it isn’t useful for reporting bugs in Ubuntu packages.

Reportbug-NG is actively developed and maintained by Bastian Venthur. It is fully functional and currently no major flaws are known. As it’s fairly new, it’s only available in Debian unstable.

Some features I planned for the next versions:

  • Porting R-NG from Qt3 to Qt4.
  • Include some advanced BTS-features for developers like tagging, reassigning, merging, etc.

Project homepage: http://reportbug-ng.alioth.debian.org/

Posted in Debian, Ubuntu | 7 Comments »

TinyCA: simple user interface to manage a small CA

April 8th, 2007 edited by Tincho

Entry submitted by Julien Valroff. DPOTD needs your help, please contribute !

TinyCA aims at helping you in the certification authority (CA) management task. Despite its easy-to-use and somewhat intuitive interface, it provides extended functions for advanced users who want to simplify their life.

Screenshot: CA & certificate list tabs

TinyCA - main window

TinyCA - certificate list

It works like a front-end for OpenSSL and offers (almost) the same features, amongst which:

  • Unlimited CAs: you can work with several CAs, choice is made when opening the main window or from an easily accessible button
  • Creation and revocation of x509 - S/MIME certificates
  • Import already existing CAs
  • Export client and server certificates in PEM, DER, TXT and PKCS#12 formats

Screenshot: create & import CA dialogs

TinyCA - creating a new CA

TinyCA - importing an already existing CA

Users already familiar with OpenSSL will be able to work immediately with TinyCA, while the more inexperienced will first have to look for documentation on certificate management elsewhere, as suggested by TinyCA documentation page:

TinyCA - help

TinyCA reveals particularly useful when you have to manage a bunch of certificates, eg. in the case of an OpenVPN tunnel. In this case, I do only regret TinyCA is not able to generate Diffie-Hellman keys, for which you still need to use OpenSSL from the command line.

TinyCA is available in Debian Sarge in the GTK version, whereas the latest version in Debian testing and unstable is based on the Perl-Gtk2 bindings (this lead upstream developer to call the new generation TinyCA2, whereas the Debian package kept the name tinyca). The package is also available for Ubuntu users in the universe component.

Once the package is installed, do not look for a TinyCA entry in your GNOME or KDE menu, none is provided. Instead, just look in the Debian menu, or simply launch the command in a terminal emulator: tinyca2.

If you end up using TinyCA, remember to keep your ~/.TinyCA directory private, as it contains the private keys for your CA and your certificates! Also do use a secure method for transferring your keys to the machine, eg. ssh.

Posted in Debian, Ubuntu | 2 Comments »

Gobby: A Collaborative Text Editor

April 4th, 2007 edited by Tincho

Entry submitted by Adam Victor Nazareth Brandizzi, Pedro Vaz de Mello de Medeiros and Pedro Araújo Chaves Júnior. DPOTD needs your help, please contribute !

Gobby is a Free Software collaborative text editor. That means that various users can edit the same text file simultaneously.

Using Gobby is easy: just create a session, then other writers may connect to your host and subscribe to any publicly available documents in the Document List dialog, and/or create a new shared document. Files are opened in tabs in the main window, so that the user can edit them simultaneously. Any user can contribute with his own set of files to the pool of shared files, just like the session owner, and anyone can save a local copy of them.

gobby1.png

The user interface is very clear and simple: the main window is divided in two parts: the text being edited on the top and a chat window below with an IRC look and feel (but only one IRC command is supported, though: the good old /me ;)). In the main window, each fragment of text is colour-coded to indicate which user wrote it. The list of currently connected users, along with their corresponding colours, can be checked in the Online node in the User List dialog.

Gobby has support for some common text-editing features such as auto indenting, tab-to-space replacement, smart Home key, font selecting, syntax highlighting by file type, etc. Gobby will try to guess the right file type, but if it doesn’t, syntax highlighting can be changed on the fly from a long drop-down menu list. It is also possible to define a password-protected session; this is useful if you want to control which users are allowed to connect.

The chat functionality provides a separate channel that allows authors to communicate and coordinate their efforts —even if they are not physically close to each other—, which can be particularly useful if they want to discuss, for instance, guidelines or other things that don’t exactly translate to text editing. Or you can just fire up Gobby to have a simple and lightweight chat session with some friends ;).

screenshot

The Gobby developers also provide the specifications of the Obby protocol used for implementing the collaborative editor, sobby, the Obby dedicated server, and libobby, the library for developers interested in creating their own clients and servers.

Known issues:

There are some reports about crashes on the Gobby site. We have not observed any of them ourselves, though. On functionality, Gobby does not provide any Undo/Redo capabilities —and we have really missed them. Also, there is no way to keep track of deleted text. Another missing feature is a graphic representation of the cursors of all users and means to distinguish them from each other, but this functionality is already expected for Gobby v0.5.0.

License:

Gobby is licensed under the GNU General Public License (v2).

Availability:

Gobby is available in Debian Etch and Sid, as well as in the Ubuntu Universe since Breezy Badger. You can get more information at the Gobby home page.

Posted in Debian, Ubuntu | 6 Comments »

« Previous Entries Next Entries »