rename stopped working after upgrading from Ubuntu 17.04 to Ubuntu 17.10
Solution 1:
Click on Activities, search for "Software & Updates" and launch it. Then check the "Community-maintained free and open-source software (universe)" option if it's unchecked.
Then open Terminal and run
sudo apt update
sudo apt install rename
to install rename
.
Solution 2:
Quick answer and explanation of the problem
The perl package in 17.10 no longer contains the rename
script, at least not the perl version that comes with a fresh installed system.
So I recommend @pomsky's answer.
sudo apt update
sudo apt install rename
Inspection in an old system (16.04.LTS)
I have the perl rename in my 16.04 LTS system, which is my production system.
$ rename
Usage: rename [-v] [-n] [-f] perlexpr [filenames]
$ which rename
/usr/bin/rename
$ l /usr/bin/rename
lrwxrwxrwx 1 root root 24 feb 28 2016 /usr/bin/rename -> /etc/alternatives/rename
$ l /etc/alternatives/rename
lrwxrwxrwx 1 root root 16 feb 28 2016 /etc/alternatives/rename -> /usr/bin/prename
$ l /usr/bin/prename
-rwxr-xr-x 1 root root 2987 mar 13 2016 /usr/bin/prename
$ head /usr/bin/prename
#!/usr/bin/perl -w
#
# This script was developed by Robin Barker ([email protected]),
# from Larry Wall's original script eg/rename from the perl source.
#
# This script is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
# Larry(?)'s RCS header:
# RCSfile: rename,v Revision: 4.1 Date: 92/08/07 17:20:30
If that version is what you want, you can install it with
sudo apt update
sudo apt install perl
I am not sure what you get if you install rename
. Maybe the same version, maybe some other version. They might work in the same way (seen from the user interface).
Edit (correction and sorry for the confusion)
Inspection in Ubuntu 17.10
@pipe discovered a major problem, that I did not find because I checked in 16.04 LTS and relied on the information in the question (that rename is found in two packages, perl and rename). I tested and the perl package in 17.10 no longer contains the rename script, at least not the perl version that comes with a fresh installed system.
So I recommend @pomsky's answer.
sudo apt update
sudo apt install rename
which installs another perl script, as can be seen below:
tester@tester-desktop:~$ which rename
/usr/bin/rename
tester@tester-desktop:~$ l /usr/bin/rename
lrwxrwxrwx 1 root root 24 nov 4 19:08 /usr/bin/rename -> /etc/alternatives/rename
tester@tester-desktop:~$ l /etc/alternatives/rename
lrwxrwxrwx 1 root root 20 nov 4 19:08 /etc/alternatives/rename -> /usr/bin/file-rename
tester@tester-desktop:~$ l /usr/bin/file-rename
-rwxr-xr-x 1 root root 3085 sep 5 23:49 /usr/bin/file-rename
tester@tester-desktop:~$ head /usr/bin/file-rename
#!/usr/bin/perl -w
# $Revision: 331 $$Date: 2013-04-30 21:23:41 +0100 (Tue, 30 Apr 2013) $
# Robin's RCS header:
# RCSfile: rename.PL,v Revision: 1.3 Date: 2006/05/25 09:20:32
# Larry's RCS header:
# RCSfile: rename,v Revision: 4.1 Date: 92/08/07 17:20:30
#
# Log: rename,v
# Revision 1.5 1998/12/18 16:16:31 rmb1
# moved to perl/source
This is also a perl script, but another one compared to the one in 16.04 LTS.