• Home
  • Subscribe
  • Contribute Us
    • Share Your Interview Experience
  • Contact Us
  • About
    • About CSEstack
    • Campus Ambassador
  • Forum & Discus
  • Tools for Geek
  • LeaderBoard
CSEstack

What do you want to Learn Today?

  • Programming
    • Tutorial- C/C++
    • Tutorial- Django
    • Tutorial- Git
    • Tutorial- HTML & CSS
    • Tutorial- Java
    • Tutorial- MySQL
    • Tutorial- Python
    • Competitive Coding Challenges
  • CSE Subject
    • (CD) Compiler Design
    • (CN) Computer Network
    • (COA) Computer Organization & Architecture
    • (DBMS) Database Management System
    • (DS) Data Structure
    • (OS) Operating System
    • (ToA) Theory of Automata
    • (WT) Web Technology
  • Interview Questions
    • Interview Questions- Company Wise
    • Interview Questions- Coding Round
    • Interview Questions- Python
    • Interview Questions- REST API
    • Interview Questions- Web Scraping
    • Interview Questions- HR Round
    • Aptitude Preparation Guide
  • GATE 2024
  • Linux
  • Trend
    • Full Stack Development
    • Artificial Intelligence (AI)
    • BigData
    • Cloud Computing
    • Machine Learning (ML)
  • Write for Us
    • Submit Article
    • Submit Source Code or Program
    • Share Your Interview Experience
  • Tools
    • IDE
    • CV Builder
    • Other Tools …
  • Jobs

Chmod Calculator for Linux File Permission

Aniruddha Chaudhari/14070/0
Linux

Use this online tool to convert the file permission for the owner, group and public to the numeric value and symbolic notation. You can use these converted notations to know or to change the file permission using chmod Linux command.


Do you want to learn how to calculate the file permission values? You should be familiar with the ownership, permission, notations and basic Linux commands. We will see them one-by-one. In the later part, I will describe you to calculate Linux file permission.

Let’s dive in.

Table of Contents

  • Ownership
  • Permissions
  • [Example] How to Calculate Linux File Permission?
  • How to get the file permission in Linux?
  • How to set the file permission using Linux chmod command?

Ownership

There are three types of ownership for each file in the Linux.

  1. User– One who owns the file. By default, the user who creates the file becomes the owner of the file.
  2. Group– The owner can create the group and assign the file permission to the file. One can simply add any user to the group to access the file.
  3. Other– All the users apart from the owner and group members, become part of the other.

You can set the different file permissions for different types of ownership.

Permissions

Each file or directory has three permissions or mode of accessing it.

  1. Read mode (r)– Read mode gives you permission to read the file.
  2. Write mode (w)– Write mode gives you permission to write and update the file.
  3. Execute mode (x)– Execute mode gives the ability to execute the file.

[Example] How to Calculate Linux File Permission?

Calculate Linux File Permission Example

For sake of simplicity and to calculate the numeric value for file permission, consider

r=4 (2^2)
w=2 (2^1)
x=2 (2^0)
-=0

By adding them, you get the numeric value for file permission.

For example:

rwx = 4+2+1 = 7
r-x = 4+0+1 = 5

You can use symbolic as well as numeric mode for getting and setting file and directory permission in Linux.

How to get the file permission in Linux?

Use ls command:

 ls -l <file_name>

If you don’t provide the file name, it list out all the files and directories in the current directory.

ls -l

Sample output for the ls command:

Linux command to read file permission

You can see the symbolic notation with prefix ‘-‘ or ‘d’.

  • The prefix ‘-‘ in symbolic notation represents a file.
  • The prefix ‘d’ in symbolic notation represents a directory.

ls and chmod are two very useful Linux commands.

How to set the file permission using Linux chmod command?

Use chmod command:

chmod <numeric_mode> <file_name>

It is convenient to use numeric mode value for setting up the file permission.

linuxtool
Aniruddha Chaudhari
I am complete Python Nut, love Linux and vim as an editor. I hold a Master of Computer Science from NIT Trichy. I dabble in C/C++, Java too. I keep sharing my coding knowledge and my own experience on CSEstack.org portal.

Your name can also be listed here. Got a tip? Submit it here to become an CSEstack author.

Leave a Reply Cancel reply

Make Your Linux Run Faster

Linux- Remove Old Kernels

Linux- Auto-Remove Unused Packages

Linux Commands

Linux- Most Useful Commands

Linux- LS command [Tool]

Linux- 7 Hostname Commands

Linux- Text Search in Terminal

Linux- File Permission [Chmod Calculator]

Linux- Check Free Memory in Ubuntu

Linux- Find Total Size of the Directory

Linux- Mount/Umount USB Drive

Linux- Change VNC Password

Linux- Get Serial Number (dmidecode)

Linux- Execute Shell Script

Linux Tools

5 Free Linux screenshot tools

Vim Editor Tricks

Vim- Setting Vim of Programming

Vim- 6 Commands to Edit File

Vim- Case-Sensitive Search

Vim- How to Create Function?

© 2022 – CSEstack.org. All Rights Reserved.

  • Home
  • Subscribe
  • Contribute Us
    • Share Your Interview Experience
  • Contact Us
  • About
    • About CSEstack
    • Campus Ambassador
  • Forum & Discus
  • Tools for Geek
  • LeaderBoard