Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

chgrp

From Wikipedia, the free encyclopedia
Shell command for changing the group of a file
chgrp
Example usage ofchgrp command to change the files' groups
DeveloperAT&T Bell Laboratories
Initial releaseMay 1975; 50 years ago (1975-05)
Written inPlan 9:C
Operating systemUnix,Unix-like,Plan 9,Inferno,IBM i
PlatformCross-platform
TypeCommand
LicensePlan 9:MIT License

chgrp, short forchangegroup, is ashellcommand for changing thegroup associated with aUnix-basedfile systemfile – including special files such asdirectories. Changing the group of a file is restricted to a super-user (such as viasudo) or to the file's owning user if the user is in the specified group.

A file has accesspermissions for the owning user, a group and for others. Changing the group for a file changes access to it based on users' group memberships.

History

[edit]

Thechgrp command was originally developed as part of theUnix operating system byAT&T Bell Laboratories. It is available in mostUnix-like systems,Plan 9,Inferno andIBM i.[1]

The version ofchgrp bundled inGNUcoreutils was written by David MacKenzie.[2]

Use

[edit]

Generally, the syntax can be described as:

chgrp [options]groupfiles
  • group specifies the group with which the files should be associated; may be either a symbolic name or anidentifier
  • files specifies one or more files, which may be the result of aglob expression like*.conf

Options:

  • -RRecurse through directories
  • -vVerbose output: log the name of each file changed
  • -fForce orforge ahead even if an error occurs

Examples

[edit]

The following demonstrates changing the group of files matching*.conf tostaff – provided the user owns the files (isgbeeker) and is a member ofstaff. The change will allow members of the groupstaff to modify the files since the group-class permissions (read/write) will apply, not the others-class permissions (read only).

$ls-l*.conf-rw-rw-r--   1 gbeeker  wheel          3545 Nov 04 2011  prog.conf-rw-rw-r--   1 gbeeker  wheel          3545 Nov 04 2011  prox.conf$chgrpstaff*.conf$ls-l*.conf-rw-rw-r--   1 gbeeker  staff          3545 Nov 04 2011  prog.conf-rw-rw-r--   1 gbeeker  staff          3545 Nov 04 2011  prox.conf

See also

[edit]
  • chmod – Shell command for changing access permissions of a file
  • chown – Shell command for changing the owner of a file
  • Group identifier (Unix) – Unix/POSIX system account group number; numeric value used to represent a specific groupPages displaying short descriptions of redirect targets
  • List of POSIX commands

References

[edit]
  1. ^IBM."IBM System i Version 7.2 Programming Qshell"(PDF).IBM.Archived(PDF) from the original on 2020-09-18. Retrieved2020-09-05.
  2. ^chgrp(1) – Linux UserManual – User Commands from Manned.org

External links

[edit]
The WikibookGuide to Unix has a page on the topic of:Commands
File system
Processes
User environment
Text processing
Shell builtins
Searching
Documentation
Software development
Miscellaneous
File system
Processes
User environment
Text processing
Shell builtins
Networking
Searching
Software development
Miscellaneous
File system
Text utilities
Shell utilities
Retrieved from "https://en.wikipedia.org/w/index.php?title=Chgrp&oldid=1328452774"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp