Saturday, April 27, 2024
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 427  / 2 Years ago, sun, january 30, 2022, 3:12:34

I now understand sticky bits and why I should use them based on my question: What is the "t" letter in the output of "ls -ld /tmp"?



Now I have a new question.



How could I list all files that have stickybits in my Ubuntu Linux?


More From » command-line

 Answers
7

This command should serve you (-perm flag used to be +1000)



find / -perm /1000 


Details:



To add a stickybit Numerical/octal way you have to add "1" to the beginning of the directory.
example:



chmod 1757 ~/Desktop/test


so know to search for a stickybit you have to search for all files having "this one" which means having permissions +1000 (1 here goes for stickybit and "000" for whatever the initial permissions are)



So this command will search the whole filesystem for every file that have permission "+1000".



Now if you have test this command then you can notice that many errors raise here which make the output unclear, and this errors happen because you are trying to search in some places and you don't have a read access on it.



So to get rid of these errors you can redirect those errors to /dev/null



 find / -perm +1000 2> /dev/null


Moreover you can redirect the output to a file"output.txt" rather than keep output in the "terminal stdout"



find / -perm +1000 >output.txt 2>/dev/null

[#26565] Monday, January 31, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
heathree

Total Points: 157
Total Questions: 132
Total Answers: 108

Location: Honduras
Member since Mon, Apr 5, 2021
3 Years ago
;