A message for Linux.com registered users: We are in the process of making changes to the Linux forums. Starting Monday, 8/13/18 at 6:00 PM PT, you will be unable to access the forums. They will re-launch as soon as possible on Wednesday, 8/15/18 with new features and improved functionality. Thank you for your patience and stay tuned for the new improved forums.

August 16, 2009

rename a range of files using one-line command

Forums: 

Hi, all

I have a range of files in a certain dir, like this,

$ touch file[123456]
$ ls
file1 file2 file3 file4 file5 file6

now, how could rename them, and add a prefix to each file? for example, add a 'pre-' prefix, as following,

pre-file1
pre-file2
pre-file3
...
pre-file6

Thanks in advance. :cheer:

Regards,
gavin

Click Here!