2

My current rename command version is 0.20

$ rename -V
/usr/bin/rename using File::Rename version 0.20

I want to update it to 1.10 or higher.

How can I do that?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Ahmad Ismail
  • 2,678

3 Answers3

3

There is no convenient binary package for you to upgrade to, so the best long-term way to upgrade rename is to rebuild the package from source:

  • install a few packages we’ll need:

    sudo apt install devscripts debhelper libmodule-build-perl
    
  • download the 1.10 source package:

    dget -u http://deb.debian.org/debian/pool/main/r/rename/rename_1.10-1.dsc
    
  • build it:

    cd rename-1.10
    dpkg-buildpackage -us -uc
    
  • install it:

    sudo dpkg -i ../rename_1.10-1_*.deb
    

This will replace your current rename package, and ensure that it remains updated when you upgrade your distribution in the future.

You can remove the build packages which are no longer necessary:

sudo apt --autoremove purge devscripts debhelper libmodule-build-perl
Stephen Kitt
  • 434,908
2

Mint 19.2 is based on Ubuntu Bionic (18.04 LTS), and it has no rename package of its own.

So the rename package is inherited from Bionic as-is... and in Bionic, the standard version for the package is indeed 0.20..

The fact that your rename -V output says it's using File::Rename indicates it is a Perl-based tool. For Perl, there is an entire ecosystem of Perl packages, and a distribution-neutral repository system for Perl source code, known as CPAN (Comprehensive Perl Archive Network). See https://cpan.perl.org.

Perl makes it possible to install newer versions of Perl packages from source code without interfering with the binary packages of the distribution. First, you'll need to have the gcc compiler and other basic development tools installed in order to be able to compile source code into executable form. The easiest way to do that is probably to use whatever GUI package manager you have, find the package group "development tools" (or similar), and install the minimum/default set of packages from it.

Once you've done that, it should be possible to use the CPAN shell of Perl to automatically download and install an updated version of the File::Rename Perl module. The CPAN shell can be started with perl -MCPAN -e shell, and if you want the updated tool to be usable system-wide, you'll need to run it as root using sudo or similar.

On first use, the CPAN shell will ask some configuration questions and verify it has network connectivity to a cpan.perl.org mirror site. Usually, you can just press Enter to the automatic configuration question, defaulting to a "yes" answer:

$ sudo perl -MCPAN -e shell
Password:

CPAN.pm requires configuration, but most of it can be done automatically.
If you answer 'no' below, you will enter an interactive dialog for each
configuration option instead.

Would you like to configure as much as possible automatically? [yes]

Autoconfiguration complete.

commit: wrote '/root/.cpan/CPAN/MyConfig.pm'

You can re-run configuration any time with 'o conf init' in the CPAN shell
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v2.20)
Enter 'h' for help.

cpan[1]>

The texts may vary if your CPAN shell version happens to be different from mine, but the general idea should be the same. Once you see the cpan[1]> prompt, the CPAN shell is ready for use. Just type install File::Rename (the name of the Perl package the rename tool comes from) to start the process of downloading, compiling, testing and installing the updated version of the Perl module.

The CPAN shell will create a lot of diagnostic output when it's working. But if one of the last lines of the output is something like /usr/bin/make install -- OK, then the installation of the upgraded File::Rename perl module was probably successful. Enter the command exit to the cpan[number]> prompt to exit the CPAN shell and return to the normal Linux shell command prompt.

Also, the CPAN shell might suggest that you run two CPAN shell commands, install CPAN and reload cpan to have it upgrade itself, but this should be optional unless the default CPAN shell version in your distribution is quite old.

telcoM
  • 96,466
1

apt update; apt upgrade

If that does not work, then you have to do it manually. It is a perl script. Find where the upstream is, and put it in /usr/local/bin. (You may also want to consider stow.) Then check that your $PATH, puts priority on /usr/local/bin (It probably does). Then test.

Be vary careful to validate that you don't download some malware.