Where does the
rename command come from?
user@host> dpkg -S /usr/bin/rename dpkg-query: no path found matching pattern /usr/bin/rename
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
Surprisingly, it comes from the
pilot6@Pilot6:~$ ls -l /usr/bin/rename lrwxrwxrwx 1 root root 24 окт 17 2013 /usr/bin/rename -> /etc/alternatives/rename pilot6@Pilot6:~$ ls -l /etc/alternatives/rename lrwxrwxrwx 1 root root 20 апр 29 2016 /etc/alternatives/rename -> /usr/bin/file-rename pilot6@Pilot6:~$ dpkg -S /usr/bin/file-rename rename: /usr/bin/file-rename
You will probably find that it's a symbolic link that is managed by the
$ ls -l $(which rename) lrwxrwxrwx 1 root root 24 Jun 29 2016 /usr/bin/rename -> /etc/alternatives/rename
You can see the optional implementations using
$ update-alternatives --list rename /usr/bin/file-rename /usr/bin/prename
and can choose between implementations using
update-alternatives --config rename
file-rename is provided by the
rename package, whereas the original
prename is provided by
perl itself. From
apt-cache show rename:
This package provides both a perl interface for renaming files (File::Rename) and a command line tool 'rename' which is intended to replace the version currently supplied by the perl package.
As if this was not already confusing enough, you may also come across yet another
rename from the
util-linux package - see What's with all the renames?
If we're talking about
/usr/bin/rename, which is a pretty nifty perl script, then
rename command belongs to its own separate package.
rename: Installed: 0.20-4 Candidate: 0.20-4 Version table: *** 0.20-4 500 500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages 500 http://archive.ubuntu.com/ubuntu xenial/main i386 Packages 100 /var/lib/dpkg/status
In case of Korn shell and its derivatives,
rename is a shell built-in command.
$ echo $SHELL /bin/mksh $ type rename rename is a shell builtin