Changing Ownership in Linux
Kothandaraman Kannadasan Lv3

chown, full name change owner, is a very useful command in Linux systems, mainly used to change the permissions of files or directories.

Let’s take a look at how to use it and some common options:

Basic syntax

1
chmod [options] [user:group] file(or)directory 
  • -v, –verbose: Display the instruction execution process.
  • -R, –recursive: Process recursively, processing all files and subdirectories in the specified directory together.

Here is an example:

1
2
3
cd <directory_path>
sudo chown -Rv raman:raman .
sudo chown -Rv a+rwX .

sudo: Runs the command with superuser (administrator) privileges.

chown: Stands for “change owner”, which changes the owner of files and directories.

-R: Recursive option, applies the command to all files and directories within the specified directory.

-v: Verbose mode, which outputs more information about the files and directories being changed.

a: Represents all users.

+rwX: Specifies the permissions to grant: rw for read and write permissions on files, and X for execute permissions on directories.

.: Represents the current directory.