Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a folder with some files, which each have different permissions. Some are read-only, some are read/write, some are read/execute.

How can I copy the permissions from user to group, so that for example a file marked read-write for user will be set to read-write for group, but a file read-executable for a user will be set read-executable for the group.

Can this be done with a single command?

share|improve this question
up vote 4 down vote accepted

chmod from coreutils understands such assignments:

chmod g=u file
share|improve this answer
just a joke :) #! /bin/bash for FILE in * do chmod g=$(ls -l $FILE | cut -c 2,3,4) $FILE done – Hojat Taheri Apr 4 '13 at 14:17

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.