Skip to content

Instantly share code, notes, and snippets.

@niedzielski
Last active January 26, 2019 00:14
Show Gist options
  • Save niedzielski/0d0c61e31f7b67cc4c1cd1096310a644 to your computer and use it in GitHub Desktop.
Save niedzielski/0d0c61e31f7b67cc4c1cd1096310a644 to your computer and use it in GitHub Desktop.
Find and change files not in the current user's group or ownership
# Find all files not in the current user ownership AND group.
sudo find "$DIR" -not \( -uid $(id -u) -gid $(id -g) \)
# Recursively change owner and group to current user.
sudo chown -R $(id -nu):$(id -ng) "$DIR"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment