Page 1 of 1

command "rename": only "man" is installed?

Posted: Thu Jan 06, 2022 9:27 am
by Duliwi
Hello,

I am a bit confused.

I wanted to inform me with "man" how the command "rename" works.

So I have typed into the terminal:

Code: Select all

man rename
-> This has worked as expected. I got a help of this command.

After I have tried to use and run the command "rename" in a terminal and got the following message:

Code: Select all

bash: rename: Command not found.
This was the first irritation. I couldn't imagine, that a command, from which I can get help with "man" is not installed.

So I opened MXPI and found, that "rename" is really not installed:
ksnip_20220106-151459.jpg

My system MX Linux 19.4 Xfce

So this all confuses me. Here is my question:
Why do I have a "man" from "rename" although I have not the command?
Is this as it would be expected to be? Are you aware of this? Is this the default in MX?
I don't remember uninstalling "rename". Do I miss anything?

Thank you.

Re: command "rename": only "man" is installed?

Posted: Thu Jan 06, 2022 10:14 am
by dolphin_oracle
the rename man page is for the kernel instruction, not a user command. The man page is from the Linux Programmer's manual.

you will want to use "mv" for renaming files.

Re: command "rename": only "man" is installed?

Posted: Thu Jan 06, 2022 10:22 am
by Adrian
There's a rename package that puts a binary in /usr/bin/file-rename and I think /usr/bin/rename is just a link to it managed by "update-alternatives" system.

This utility is nice (better than mv) because it lets you use regular expressions to rename files.
apt show rename
Package: rename
Version: 1.13-1
Priority: optional
Section: perl
Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>
Installed-Size: 51.2 kB
Provides: libfile-rename-perl
Depends: perl:any, perl (>= 5.26.0-6)
Recommends: libio-stringy-perl, libpod-parser-perl
Conflicts: libfile-rename-perl
Breaks: perl (<< 5.26.0-6)
Replaces: libfile-rename-perl, perl (<< 5.26.0-6)
Homepage: https://metacpan.org/release/File-Rename
Download-Size: 18.0 kB
APT-Manual-Installed: yes
APT-Sources: http://deb.debian.org/debian bullseye/main amd64 Packages
Description: Perl extension for renaming multiple files
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 that used to be supplied by the perl package.
As for man pages, D_O is right. You probably saw the man page of the C function. To make sure you can run

Code: Select all

man 1 rename
for utility

Code: Select all

man 2 rename
for the C function

Re: command "rename": only "man" is installed?

Posted: Thu Jan 06, 2022 11:23 am
by Duliwi
Thank you both.
Adrian wrote: Thu Jan 06, 2022 10:22 am As for man pages, D_O is right. You probably saw the man page of the C function. To make sure you can run

Code: Select all

man 1 rename
for utility

Code: Select all

man 2 rename
for the C function
Oh, it's still a bit confusing.

When I have installed the package "rename", you suggested, then I get the following:

With:

Code: Select all

man 1 rename
RENAME(1p)
With:

Code: Select all

man 2 rename
RENAME(2)

When I have not installed the package "rename", then I get the following:

With:

Code: Select all

man 1 rename
RENAME(1)
With:

Code: Select all

man 2 rename
RENAME(2)

--> So it looks like installing the package "rename" you suggested lets disappear the man "RENAME(1)" and replaces it through the man "RENAME(1p)". Whereas man "RENAME(1)" looks different than "RENAME(1p)".

(?)

Re: command "rename": only "man" is installed?

Posted: Thu Jan 06, 2022 12:15 pm
by fehlix
and one more ..

Code: Select all

man rename.ul
rename.ul --help

Code: Select all

Usage:
 rename.ul [options] <expression> <replacement> <file>...

Rename files.

Options:
 -v, --verbose       explain what is being done
 -s, --symlink       act on the target of symlinks
 -n, --no-act        do not make any changes
 -o, --no-overwrite  don't overwrite existing files
 -i, --interactive   prompt before overwrite

 -h, --help          display this help
 -V, --version       display version

For more details see rename(1).

Re: command "rename": only "man" is installed?

Posted: Thu Jan 06, 2022 12:25 pm
by Adrian
Is that rename.ul available in Bullseye?

Re: command "rename": only "man" is installed?

Posted: Thu Jan 06, 2022 12:40 pm
by fehlix
Adrian wrote: Thu Jan 06, 2022 12:25 pm Is that rename.ul available in Bullseye?
Nope, seems they "renamed" to somewhere else and took it out of util-linux on bullseye.
As I'm using perl-rename anyway, I have not spotted they toke it out.

Re: command "rename": only "man" is installed?

Posted: Thu Jan 06, 2022 1:01 pm
by Duliwi
OK. Thank you.

Maybe I begin to understand.

When I want to use in MX-19 the "basic" variant of "rename" from "util-linux", then I can get
--> a short version of help with:

Code: Select all

$ rename.ul --help
--> And a longer version of help with:

Code: Select all

$ man 1 rename

But when I then want to use this version of "rename", it works not with the command "rename"
Instead I have to use the command "rename.ul" (for example):

Code: Select all

$ rename.ul * b.txt a.txt

Very tricky.

Re: command "rename": only "man" is installed?

Posted: Thu Jan 06, 2022 1:31 pm
by figueroa
Interesting. I've never been drawn to use the rename command, but elsewhere, I find the command still exists in upstream util-linux. The following is from Gentoo bash shell:

Code: Select all

$ rename -V
rename from util-linux 2.37.2
The traditional Unix/Linux command to rename/move files is mv.