FreeBSD find the chmod numerical value for a file or directory

w‮tual.ww‬turi.com
FreeBSD find the chmod numerical value for a file or directory

On a FreeBSD system, you can use the stat command to display the file permission mode (also known as the file mode or chmod value) for a file or directory.

To display the file permission mode for a file or directory, use the stat command followed by the name of the file or directory. For example:

# stat file.txt

This will display a summary of the file's or directory's attributes, including the file permission mode. The file permission mode is displayed in octal notation, which is a representation of the file's permission bits using base 8.

For example, the output of the stat command might look like this:

File: file.txt
  Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
Device: 805h/2053d	Inode: 786123      Links: 1
Access: (0644/-rw-r--r--)  Uid: (  100/   user)   Gid: (   10/    wheel)
Access: 2022-12-20 12:34:56.000000000 -0500
Modify: 2022-12-20 12:34:56.000000000 -0500
Change: 2022-12-20 12:34:56.000000000 -0500
 Birth: -

In this example, the file permission mode is 0644, which corresponds to rw-r--r-- in symbolic notation.

For more information about using the stat command, you can refer to the stat man page by running man stat on the command line.

Created Time:2017-10-28 20:40:37  Author:lautturi