Learn to change a file's owner and group at the Linux command line.
Linux chown command summary with examples (3:39)
Videos can also be accessed from the YouTube Playlist.
Our seventy-sixth word, or command to memorize is
chown from our category
chown allows you to change file owner
Recall from the previous video (tutorial) on
chmod, we learned how to change file
permissions for the owner, group and world. Now we'll make changes to
the owner of the file itself, so the new owner can make changes.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s).
chown command has
14 options, the first argument is the new owner,
: then the new group and
the file or directory.
Like most commands, help is available with double-dash
-r option applies changes to
So why is
chown an important command?
Well, since the file or directory owner has additional rights, it's
important to know how to make ownership changes.
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go. Let's start by viewing a new empty file I created using
touch command for this video and
I called it
video76.txt and the owner is
paul and group is paul.
Oh, also while I'm here, I won't do it now, but when you have time,
cat /etc/group to see a listing
of groups on your system.
Okay, next let's change the owner and group to the root user using
chown root:root video76.txt and
And last, let's verify with
ls -l for the long format, on
video76.txt that shows two additional
And it looks like it was changed.
Okay now you know how to use
And you know the syntax for commands, options and arguments.
One last tip about the
command. So there is a legacy command
chgrp, used to change groups before
the functionality was added to
chown. And so you don't really have
to look that one up or memorize it. It just gives you one less
command to think about.
Okay, thanks for visiting today. I hope this was a helpful
introduction to the
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Be part of our growing family on YouTube. Subscribe here.
chmodcommand, hit Back.
idcommand, click Next.