Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
When I try to rename files from a console, the command 'rename' does not work.
It happens with proper write permissions (I tried both from a normal user account and from a root console). The command exits with 0 and no errors show up; however, the name of the files remains unchanged.
On the contrary, 'mv' works, but this command does not work with several files (in the same directory; that is, using it for renaming instead of moving).
Also, I can rename files from the different file managers I use, but I have to do it one by one and I would like the convenience of being able to rename several files at the same time from a console.
Yes, 'mv' works, but I cannot use it as a substitute of 'rename' to change the name of several files at the same time. Quoting from 'info mv': "It is an error if the last argument is not a directory and more than two files are given."
Of course, I could use 'mv' to rename/move them to another directory and then copy them back to the original directory, deleting the files with the old name, but this adds extra work to the process, and I'd really want to know why 'rename' does not behave as it should.
The rename command in linux doesn't work as in DOS. The man page says the usage is rename <from> <to> <file>, where <from> is the string you want to rename, <to> is the string you want to rename it to, and <file> are the file(s) you want to rename. From the man page:
rename will rename the specified files by replacing the first occurrence of <from> in
their name by <to>.
For example, given the files foo1, ..., foo9, foo10, ..., foo278, the commands
rename foo foo0 foo?
rename foo foo0 foo??
will turn them into foo001, ..., foo009, foo010, ..., foo278.
rename .htm .html *.htm
will fix the extension of your html files.
Bebo, you're damn right. I had read the man page of 'rename' before, but I missed the whole point. Now I understand, and of course if you do it right it works.
Tinkster, thanks for suggesting 'ren'. It seems interesting. What I wanted to do was related with names more than extensions, as until now I used 'krename' to change the latter. But now I can change names and extensions from the command line, which I prefer.