AI rewrote my Perl script in JavaScript.
A browser version of my Perl script for explaining file permissions. Convert numeric permissions to symbolic notation and back, inspect the permissions of the owner, group and others, and decode special bits.
Enter three or four octal digits (755, 0644, 4755) or a symbolic
string (rwxr-xr-x, -rw-r-----, drwxrwxrwt+).
The result updates as you type.
The three groups of characters describe the owner, group and others:
rwx r-x r-x. Within each group, r means read (4), w means write (2),
x means execute (1), and - means that the permission is absent.
Add the values to get the digit: rwx = 4 + 2 + 1 = 7.
For directories, the meanings differ: r allows listing names,
w allows modifying directory entries, and x allows traversing the
directory and accessing its contents. Creating or removing entries
normally requires both w and x on the directory.
An optional fourth digit on the left specifies the special bits:
SUID (4), SGID (2) and sticky (1). Lowercase s and t mean that
both the special bit and the corresponding x permission are set.
Uppercase S and T mean that the special bit is set but x is absent.
You can include a file type and a + or . suffix, as shown by GNU ls -l.
These are explained separately and do not contribute to the numeric mode.
The tool only parses the supplied string: it does not inspect actual files,
ACL entries, security contexts or effective access.
See also: file permissions in GNU Coreutils.