3

I found a command rename.ul on my Ubuntu machine. It comes from util-linux package.

It is odd for me because I rarely see executables with extension. In addition, it seems unnecessary because the file is compiled.

Are there any historical or technical reasons on it?

I'm also confused because I could not find file format associated this extension.

6

The extension is to avoid conflict with the multitude of rename commands otherwise available on Debian. This change was made in 2007 in response to Debian bug #439647:

/usr/bin/rename is managed by the alternatives system (with Perl's version the default). util-linux 2.13~rc3-8 installs its own binary there, instead of registering it as an alternative.

In response, the util-linux rename was renamed to be rename.ul.

Even so, rename.ul syntax is so far different from the Perl variants that it's not added to the alternatives system by default (see Debian bug #439935).

5

As the commenters have guessed, it is probably the Debian Alternatives system in action.

If a distribution has multiple packages that contain an identically-named file, the creator of the package needs to know about it, and there needs to be a mechanism for the administrator to choose which one of them they want to use. So all the conflicting files get renamed (usually with suffixes, but this can be specified in the package metadata) and the original filename will become a symbolic link pointing to /etc/alternatives/<original filename>. That, in turn, will be another symbolic link pointing back to one of the now-renamed files.

The system administrator can use the update-alternatives tool to choose which version of the file will be pointed to by the original name. The other versions can still be reached using the new names.

The update-alternatives tool can handle "families" of things, so when e.g. you have both the traditional and OpenBSD netcat installed and use sudo update-alternatives --config nc to switch the default one way or another, the corresponding man page name will get switched too.

A common example would be /usr/bin/editor. On Debian-style systems, that's a symbolic link that other programs can use to get the "default text editor on this system, whatever it is". After a minimal installation, it is likely to default to nano, so editor example.txt will open the text file in nano, and man editor will show the man page of nano.

But if you install an editor that has a higher priority in the alternatives system, e.g. joe, then it automatically becomes the new default, so now editor example.txt will use joe instead, and man editor will also now show joe's man page. You can also use sudo update-alternatives --config editor to choose which of the installed editors you want to be the default, and once you've made a choice this way, the automatic priorities won't override it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.