In most Unix-like systems, a file, directory, or any other filesystem object is represented by an inode, which contains, among other things, an integer called the mode, which describes the type of object and some of its permissions. It's described in POSIX stat.h.
The following symbolic names for the values of type mode_t shall also be defined:
File mode bits:
Read, write, execute/search by owner.
Read permission, owner.
Write permission, owner.
Execute/search permission, owner.
Set-user-ID on execution.
Set-group-ID on execution.
Those are all symbolic names for integer constants.
S_IFREG is 0100000.
S_IRUSR is 000400.
S_ISUID is 004000. They're in octal for ease of use: the file mode bits can logically be considered to be 4 groups of 3 bits each.
Here you can see the file type bits and file mode bits of my
$ perl -e 'printf("%#o\n", (stat(".profile")));'
Users can set the mode bits (but not the file type) using the
chmod system call, which takes an integer argument (possibly using some of those S_* symbolic constants), or the
chmod utility, which takes either an integer or symbolic names (such as
Since, in practice, there are not that many different combinations of mode bits, many Unix users over many decades have called
chmod (both the system call and the command) with a numeric argument rather than symbolic names.
0755 means "writable by owner, readable and executable to everyone else",
0644 means "writable by owner, readable by everyone else",
04755 means "setuid, writable by owner, readable and executable by everyone else`.