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

Message
Author
User avatar
Duliwi
Posts: 1178
Joined: Sun Jul 07, 2019 9:34 am

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

#1 Post 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.
You do not have the required permissions to view the files attached to this post.

User avatar
dolphin_oracle
Developer
Posts: 22753
Joined: Sun Dec 16, 2007 12:17 pm

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

#2 Post 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.
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

User avatar
Adrian
Developer
Posts: 9237
Joined: Wed Jul 12, 2006 1:42 am

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

#3 Post 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

User avatar
Duliwi
Posts: 1178
Joined: Sun Jul 07, 2019 9:34 am

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

#4 Post 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)".

(?)

User avatar
fehlix
Developer
Posts: 12928
Joined: Wed Apr 11, 2018 5:09 pm

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

#5 Post 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).

User avatar
Adrian
Developer
Posts: 9237
Joined: Wed Jul 12, 2006 1:42 am

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

#6 Post by Adrian »

Is that rename.ul available in Bullseye?

User avatar
fehlix
Developer
Posts: 12928
Joined: Wed Apr 11, 2018 5:09 pm

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

#7 Post 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.

User avatar
Duliwi
Posts: 1178
Joined: Sun Jul 07, 2019 9:34 am

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

#8 Post 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.

User avatar
figueroa
Posts: 1106
Joined: Thu Dec 20, 2018 11:20 pm

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

#9 Post 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.
Andy Figueroa
Using Unix from 1984; GNU/Linux from 1993

Post Reply

Return to “General”