Notes:
Change ownership of directories and files
In the long List above, the files are owned by Brian and are also in the Brian group. What if we wanted to change the ownership of some of those files? Then we would use the “ chown ” command.
We’ll use the file “ brotplot.odt ” as an example. Let’s say we want to make Fred the file’s owner. We would use the command:
$ chown fred brotplot.odt
If we run the command “ls -l” again, we will now see the result:
-rw-rw-r--. 1 fred brian 10919 Apr 2 19:52 brotplot.odt
The file is still in group Brian but is now owned by Fred. But what if we want to make the user “Foo” the owner of the file and also move the file to the “foo” group. We’d use the command:
$ chown foo:foo brotplot.odt
If we use “ls -l” again to see the long-format name of our file, we will see:
-rw-rw-r--. 1 foo foo 10919 Apr 2 19:52 brotplot.odt
To find out more about “chown” command see its Wikipedia entry: http://en.wikipedia.org/wiki/Chown
chown Changes the ownership of one of more files.
While we’re at it, take a look at “ chgrp ” to see how it compares: http://en.wikipedia.org/wiki/Chgrp
chgrp Changes the group of one of more files.
The Linux Command Line
158
Made with FlippingBook flipbook maker