How to Use chmod command on Ubuntu Linux with examples

computer screen with text editor
computer screen with text editor

The chmod command defines or changes permissions or modes on files and limits access to only those allowed access.

If you’re a new user or student and want to learn how to use and manage Linux systems, the most accessible place to start might be Ubuntu Linux OS.

Ubuntu is an open-source Linux operating system that runs on desktops, laptops, servers, and other devices.

When you’re ready to learn how to use the chmod commands, follow the guide below:

About the chmod command:

The chmod command defines or changes permissions or modes on files and limits access to only those allowed access. It changes the mode of each FILE to MODE.

The chmod command stands for change mode. And it’s used to limit access to resources.

It’s the same as using your mouse to right-click a file or folder, selecting permission tabs, and defining who can access the resource. The chmod command is the way to do it on the command line.


The syntax is the rule and format of how the chmod command can be used. The syntax options can be reordered. But a straight format must be followed.,.

Below is an example syntax of how to use the chmod command.





The command line options are switches or flags that determine how the commands are executed or controlled. They modify the behavior of the commands. They are separated by spaces and followed after the commands.

Below are some options for the chmod command:

FILE.Replace FILE.. with the file you want to change its permissions
Replace the MODE (rwx) or OCTAL-MODE (777) with a value to change the permission to
-c, –changes           Use the -c or –changes option to show verbose but report only when a change is made
-f, –silent, –quietUse them -for –silent or –quiet option to suppress most error messages
-R, –recursiveUse the -R or –recursive option to change files and directories recursively
–helpUse the –version option to display this help and exit
 –versionUse the –version option to output version information and exit.


Below are some examples of how to run and use the chmod on Ubuntu Linux.

If you own a file called Confidential and want to change the permissions or modes so that users can read/write and execute, group members can read and execute only, and others can only read, you will run the commands below.

sudo chmod u=rwx,g=rx,o=r Confidential

The commands above change the permission of the file called Confidential so that the user can read (r), write (w), and execute (x) it. Group members can only read (r) and execute (x), and others can only read (x) its content.

The same command above can be written using its octal permission notation.

sudo chmod 754 Confidential

If you’re not logged in as a root account, you may have to use the sudo command.

sudo chmod 754 Confidential

The digit 7 is equal, read, write, and execute. The digit 5 is similar to read and execute, and the digit 4 is equivalent to read.

  • 4 = Read
  • 2 = Write
  • 1 = Execute
  • 0 = no permission

So, 7 = 4 + 2 + 1 (rwx);      5 = 4  + 1 (RX);   4 (r)

To configure access to a file so only the user can read, write and execute and group/others can read, run the commands below.

sudo 744 Confidential

The commands below change the permissions of the Confidential file so that everyone has full access. read/write/execute

sudo 777 Confidential

When you run chmod with the –help option, you’ll see the help text below:

Usage: chmod [OPTION]. MODE[,MODE]. FILE.
  or:  chmod [OPTION]. OCTAL-MODE FILE.
  or:  chmod [OPTION]. --reference=RFILE FILE.
Change the mode of each FILE to MODE.
With --reference, change the mode of each FILE to that of RFILE

That’s it!

I hope you like it, and please come back soon for more Ubuntu Linux commands!

Posted by

I love computers; maybe way too much. What I learned I try to share at


  1. I think you should have sudo chmod – not sudo by itself!

  2. Nurul Atikah Japry

    I just want to say your note saves my day. Thank you.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: