When I run the ls -l command on a directory, I see the following permissions for a file and I don't know what does "t" indicate in the permissions?
-r-----rwt 1 bruce bruce 28146 Oct 27 09:48 samplesample is an ELF binary and I want to know if I have execute permissions for it.
11 Answer
In short: it indicates a sticky bit. On files, it is basically useless these days - it was an optimisation hint for older OSes. It has a rather different meaning for directories.
Lowercase t implies x while uppercase T does not.
GNU ls is documented in its info pages (info ls), also available on the web.
The file mode bits listed are similar to symbolic mode specifications (see Symbolic Modes). But ls combines multiple bits into the third character of each set of permissions as follows:
...
tIf the restricted deletion flag or sticky bit, and the other-executable bit, are both set. The restricted deletion flag is another name for the sticky bit. See Mode Structure.
TIf the restricted deletion flag or sticky bit is set but the other-executable bit is not set.
xIf the executable bit is set and none of the above apply.
Lowercase t implies x (for other; user and group are shown separately) while uppercase T does not.
Which leads us to the mode structure:
In addition to the three sets of three permissions listed above, the file mode bits have three special components, which affect only executable files (programs) and, on most systems, directories:
...
Prevent unprivileged users from removing or renaming a file in a directory unless they own the file or the directory; this is called the restricted deletion flag for the directory, and is commonly found on world-writable directories like /tmp.
For regular files on some older systems, save the program’s text image on the swap device so it will load more quickly when run; this is called the sticky bit.
When used on a file, it was an old optimisation that instructs the OS to cache them after they are run. It is no longer relevant in modern OSes.