Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 8 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .