commands

chown — change owner and group

Changes ownership when permitted. A different owner normally requires privilege on Linux. Changing ownership can clear special bits; verify state afterward. GNU -h operates on a symlink itself where supported. No recursive changes in this lab. Example assumes a fresh permissions lab fixture.

Formal Syntax & Structure

linux syntaxlinux
chown [OPTION] OWNER[:GROUP] FILE...

Parameters & Attributes

NameTypeDescription
OWNERoperandowner name or numeric ID
GROUPoperandoptional group
FILEoperandfixture path
-hoptionoperate on symlink itself

Return Value

exit status and output

Changes ownership when permitted. A different owner normally requires privilege on Linux. Changing ownership can clear special bits; verify state afterward. GNU -h operates on a symlink itself where supported. No recursive changes in this lab.

Working Example

Example Snippetlinux
chown "$(id -u)" report.txttest "$(stat -c %u report.txt)" = "$(id -u)" && printf "owner retained\n"
Linux Reference