How to see the current mode of a file in Linux


The mode of a Linux file is the numeric representation of it’s access rights.

The command to see the current mode of a file in Linux is:

~ stat --format '%a' settings.php

The opposite of that would be:

~ chmod 555 settings.php

Here is another more elaborate example of a .c file that was compiled under arm to substitute a 32-bit binary. This worked, but permissions had to be altered for warnings to go away.

root@arm64:/usr/bin# ls -lah procmail-wrapper*
-rwxr-xr-x 1 root root 9.1K Jul  3 20:46 procmail-wrapper
-rwsr-xr-x 1 root root 1.4M Jan 26  2022 procmail-wrapper.backup
root@arm64:/usr/bin# stat --format '%a' procmail-wrapper.backup 
root@arm64:/usr/bin# stat --format '%a' procmail-wrapper
root@arm64:/usr/bin# chmod 4755 procmail-wrapper


Share this article

Leave a Reply

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

Scroll to Top