Chgrp

Chgrp


Linux chgrp command

  • On Unix-like operating systems, the chgrp command changes the group ownership of a file or files.

  • This document covers the GNU/Linux version of chgrp.

    Description

  • The chgrp command changes the group of each FILE to GROUP. If the --reference option is specified, chgrp changes the group of each FILE to that of RFILE.

    Syntax

    chgrp OPTION... GROUP FILE...
    chgrp OPTION... --reference=RFILE FILE...
    Options
    -c, --changes

    Like verbose but report only when a change is made.

    -f, --silent, --quiet

    Suppress most error messages.

    -v, --verbose

    Output a diagnostic for every file processed.

    --dereference

    Affect the referenced file of each symbolic link, rather than the symbolic link itself, which is default setting.

    -h, --no-dereference

    Affect symbolic links instead of any referenced file. This option is useful only on systems that can change the ownership of a symlink.

    --no-preserve-root

    Do not treat '/' in any special way. This option is the default.

    --preserve-root

    Do not operate recursively on '/'.

    --reference=RFILE

    Use RFILE's group rather than specifying a GROUP value.

    -R, --recursive

    Operate on files and directories recursively.

    The following options modify how a hierarchy is traversed when the -R option is also specified. If more than one of these options is specified, only the final one takes effect:

    -H

    If a command line argument is a symbolic link to a directory, traverse it.

    -L

    Traverse every symbolic link to a directory.

    -P

    Do not traverse any symbolic links. This option is the default.

    --help

    Display a help message and exit.

    --version

    Output version information and exit.

    Examples
    chgrp hope file.txt
    Change the owning group of the file file.txt to the group named hope.

    chgrp -hR staff /office/files
    Change the owning group of /office/files, and all subdirectories, to the group staff.

    Related commands

  • chmod — Change the permissions of files or directories.

  • chown — Change the ownership of
    files or directories.

  • id — Display real and effective user and group IDs.


    What is an Operating System? » Computer Shortcut Keys and their Functions » Keyboard Function Keys » Computer Basics - Hardware - Software - Parts

    Short Stories for Kids - Moral Stories – English Short Stories for Children - Moral Stories for Kids - Stories for Kids - Funny Story for Kids - Scary Stories for Kids - Really Funny Short Stories - Bedtime Stories
    Proverb Stories
    Powerful Motivational Quotes for Students » Success Quotes » English Short Stories for Kids

    Cabin Crew Jobs & Career Advice » Secretary Job Description » Receptionist Job Description » Top 100 Interview Questions and Answers » How to Prepare for an Interview » How to Write a CV » How to Choose a Career » Computer Shortcut Keys and their Functions

    Scholarships in Australia » Scholarships in Austria » Scholarships in Belgium » Scholarships in Canada » Scholarships in Germany » Scholarships in Ireland » Scholarships in Italy » Scholarships in Japan » Scholarships in Korea » Scholarships in Netherlands » Scholarships in Switzerland » Scholarships in UK » Scholarships in USA

    Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants Scholarships for Study in Africa » Scholarships for African Students » Undergraduate Scholarships » African Women Scholarships & Grants Short Stories for Kids - Moral Stories – English Short Stories for Children - Moral Stories for Kids - Stories for Kids - Funny Story for Kids - Scary Stories for Kids - Really Funny Short Stories - Bedtime Stories
    Proverb Stories
    Powerful Motivational Quotes for Students » Success Quotes »Scholarships in UK » Scholarships in USA Scholarships in UK »

  • Click here to post comments

    Join in and write your own page! It's easy to do. How? Simply click here to return to Computer Basics FAQ.