I am learning linux and using Ubuntu 24.04 LTS.

I have a file file1 in my home directory owned by a group (group ID 1001) which I removed from the system.

I now want to change file ownership of all files originally owned by the deleted group to my primary group.

I tried to execute the following command, but it fails:

sudo find ~/ -gid 1001 -exec 'chown shahnawaz:shahnawaz {}'  \;
find: ‘chown shahnawaz:shahnawaz /home/shahnawaz/file1’: No such file or directory

The file exists in /home/shahnawaz and the following simple command runs without errors:

chown shahnawaz:shahnawaz /home/shahnawaz/file1

What am I doing wrong?

Note: the original file permission string:


  • I like this a s a first question. It is far from "noob". find has the exec argument which takes a sequence of parameters. rsync has the rsh argument which takes a string. It is not consistent across tools. Even after using Linux for years, I look at the manual every other time.
    – Hermann
    Commented May 20 at 17:08

1 Answer 1


You need to take what the error shows literally: it says you are trying to exec(ute) ‘chown shahnawaz:shahnawaz /home/shahnawaz/file1’.

Short answer: drop the 's :)

Long answer:

find ~/ -gid 1001 -exec chown shahnawaz {} +
find  ~/ -gid 1001 -exec chgrp shahnawaz {} +

Both at the same time:

find ~/ -gid 1001 -exec chown shahnawaz:shahnawaz {} +

More about the + at the end:

using + will execute the least possible commands (as the arguments are combined together). It's very similar to how xargs command works, so it will use as many arguments per command as possible to avoid exceeding the maximum limit of arguments per line.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .