# Changing More Than One File’s name in Linux

Hi everyone,

Changing the name of the file is a normal situation in your daily life. It is easy, just right click then choose the `rename`  then change it or you can use the command  `mv old-file-name  new-file-name` in the Linux environment.

What if I need to change the name of more than one file at the same time, add a postfix, or prefix them? At that point, it’s not going to be easy to change the name of the files.

Yes, if you are a Linux/Unix user, the situation we have might not be a problem.

Let’s see how to add a postfix or prefix in your files in Linux.

The first step to rename of the file is finding all files you want to change.

The `find` command is enough to find the files. Then, you need to change the name of the file that you find with the `mv` command.

The below command will search for the given name of the file, after searching, it will execute the `mv` command to change the current filenames to the new ones.

For example, assume that we have files of a name beginning with `test-file`  like `test-file1.c, test-file2.c, test-file3.c, test-file4.c` . Then we would like to change the names of files from `.c` to `.cpp` .

```bash
find . -depth -name "*.c" -exec sh -c 'f="{}"; mv -- "$f" "${f%.c}.cpp"' \;
```

The below image contains the files, which is ending with `.c` that we would like to change.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1673517092741/92f3b3b1-a125-42a4-9a71-4a5fbe14a2ee.png align="center")

After running the command, you will see the changes in the file extensions like the below image.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1673517118910/b9f2f4e1-d8e7-4614-a4d4-3dbbd6ac3b5d.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1673517140458/d000d52e-37a5-4f19-83c8-4418d30616e8.png align="center")

If you would like to see more information about `find` and `mv` command in Linux, please take a look into the `man find`  or `man mv` in the Linux terminal.

I hope you enjoy reading.

Have a nice coding.
