• Contact
  • Contact Us
  • Disclamer
  • Home 1
  • Home 2
  • Home 3
  • Privacy Policy
Wednesday, May 21, 2025
How VPS - How to use/setup VPS
  • Login
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System Linux

Translate rwx Permissions into Octal Format in Linux

How VPS by How VPS
November 2, 2018
in Linux, Operating System
0
0
SHARES
12
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Sample Output
  2. Sample Output

Sometimes you may find it useful to display the access rights of files or directories in octal form instead of rwx or perhaps you want to display both.

Instead of using good old ls -l command, in most modern Linux distributions (if not all) you will find stat, an utility that displays file or filesystem status.

When run without arguments but followed by a given filename, stat will display a good deal of information about the file or directory. If used with the -c option, stat allows you to specify an output format. It is precisely this option that’s of particular interest to us.

To display all files in the current working directory followed by the access rights in octal form, type:

# stat -c '%n %a' *
Sample Output
add_emails.sh 755
anaconda-ks.cfg 600
delete_emails.sh 755
employee-dump.sql 644
index.html 644
latest.tar.gz 644
nrpe-2.15.tar.gz 644
php7 644
playbook.retry 644
Translate rwx Permissions into Octal Format in Linux

Find Linux File Permissions in Octal Format

In the command above, the format sequence:

  1. %n – means file name
  2. %a – means access rights in octal form

Alternatively, you can append %a to %A, the argument passed to stat if you want to display the permissions in rwx format as well.

In that case, you can type:

# stat -c '%n %A' *
Sample Output
add_emails.sh -rwxr-xr-x
anaconda-ks.cfg -rw-------
delete_emails.sh -rwxr-xr-x
employee-dump.sql -rw-r--r--
index.html -rw-r--r--
latest.tar.gz -rw-r--r--
nrpe-2.15.tar.gz -rw-r--r--
php7 -rw-r--r--
playbook.retry -rw-r--r--
Translate rwx Permissions into Octal Format in Linux

Find Linux File Permissions in Directory

To view the file type in the output, you can add %F format sequence.

# stat -c '%c %F %a'

There are several other format sequences you can specify, refer to the stat man page to find out more.

# man stat

In this tip, we have covered an important Linux utility called stat, that helps you to display a file or file system status. Our main focus here was to translate the rwx access rights from the traditional ls -l output to octal form.

As I had mentioned earlier on, many modern Linux distributions now come with stat utility. But you must also remember that your shell may come with its own version of stat, therefore refer to your shell’s documentation for more information concerning options and how to use them.

Source: tecmint.com

Tags: Linux Commandslinux guidelinux vps setup guide
Previous Post

How to Sync Files/Directories Using Rsync with Non-standard SSH Port

Next Post

How to Find Out What Version of Linux You Are Running

Next Post

How to Find Out What Version of Linux You Are Running

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result

Recent Post

Install Imagemagick on CentOS
CentOS

Install Imagemagick on CentOS

by How VPS
June 28, 2023
0

This is how I installed Imagemagick on a vanilla CentOS server Start off by installing the prerequisites yum install php-pear...

Read more
how to Check phpinfo

How to Check phpinfo of Hosting or VPS?

June 28, 2023
Failed to download metadata for repo 'appstream' on Centos 8

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020

Recent News

  • Install Imagemagick on CentOS
  • How to Check phpinfo of Hosting or VPS?
  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

Category

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel
  • About
  • Advertise
  • Careers
  • Contact

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon

© 2025 JNews - Premium WordPress news & magazine theme by Jegtheme.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In
Thabet