Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For example, if I only want the files that have the permission g+s while running ls, how could I do this?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

ls doesn't provide this – it's typically used for just tweaking display options. What you can do instead involves using find. For example:

find . -perm -g+s

To mimic ls's behavior of only listing files in the current directors, use the -maxdepth 1 option.

The possible combinations are endless. Refer to the find help linked above for more examples and the syntax differences in using - or / before the mode, also with respect to / being a GNU-only extension and + being used in BSD-style find.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.