I want to delete a group using groupdel command, but before doing this I want to assign all files belonging to this group to another one is there a way to do this?I know that I can use find / -gid group_id to find files that belong to this groups and then manually assign them to new one. I seek a way to automatically do the task.
assigning files of a group to another one
linux;group
find / -group <groupname> -exec chown :<groupname> {} \+should do the trick. Just replace <groupname> with the appropriate name.find allows you to call arbitrary commands on the files it returns, using the -exec primary. In this case, as we know we want to change the group ownership of each matching file, we can simply pass the chown command (and any arguments - in this case, the group name to whose ownership we wish to transfer matching file names, preceded by :, which tells chown to treat it as a group name and not as a user name) as the argument to -exec. The file name returned by find is inserted into the command in place of the {}, and +; tells find that it has reached the end of the external command, and should parse any additional parameters as its own.   Using \+ rather than \; tells find to process multiple files in each command (so it's more efficient).