Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of "t" in ls output?

Tags:

ls

ls reports the following:

# ls -ld /var/lib/puppet/state/
drwxr-xr-t 3 puppet puppet 4096 Jan  8 16:53 /var/lib/puppet/state/

What does the "t" mean for other? What tool reports the symbolic names for the permissions? ls has the --numeric-uid-gid option, but is there another one for permissions?

like image 657
François Beausoleil Avatar asked Jan 08 '13 17:01

François Beausoleil


2 Answers

man ls is your friend:

t The sticky bit is set (mode 1000), and is searchable or executable.
(See chmod(1) or sticky(8).)

About sticky bit:

When set, it instructed the operating system to retain the text segment of the program in swap space after the process exited. This speeds up subsequent executions by allowing the kernel to make a single operation of moving the program from swap to real memory. Thus, frequently-used programs like editors would load noticeably faster.

like image 55
miku Avatar answered Oct 04 '22 18:10

miku


The sticky bit is today incredibly confusing. It no longer pins the file into memory, making it actually "sticky", anymore. Sometimes it is called the "tacky" bit because it is represented as a 't' or 'T', but other folks still call it sticky. It only matters in modern linux and unix when applied to a directory, as far as I can tell. It means that people in groups who have the permission to delete a file still can't do it if the sticky bit is set on the directory. But it gets more confusing. It shows up in the last field, which is the execute/search field for "other" users, but acts on "group" users ("other" normal users can never delete files). The reason why it isn't shown in the "group" execute field is because that one changes to an "s" if the SETUID bit is set for group. I think. I am still researching that one.

like image 29
John Rigler Avatar answered Oct 04 '22 20:10

John Rigler