4

example

-rwxr--r--    1 me     users             0 May 27 13:58 file_0
-rw-rwxrw-    1 me     users             0 May 27 13:58 file_1
-rw-rw-rwx    1 me     users             0 May 27 13:59 file_2
-rwxrwxrwx    1 me     users             0 May 27 14:02 file_3

I would need to list all 4 files in the current dir

  • AIX
  • non-gnu 'find', so "find . -executable" won't work
webwesen
  • 945
  • 4
  • 13
  • 21

3 Answers3

6
find . -type f \( -perm -u=x -o -perm -g=x -o -perm -o=x \)

worked for me. any other solutions?

webwesen
  • 945
  • 4
  • 13
  • 21
5
find . -type f -perm +111

From find(1):

-perm [-|+]mode

The mode may be either symbolic (see chmod(1)) or an octal number. If the mode is symbolic, a starting value of zero is assumed and the mode sets or clears permissions without regard to the process’ file mode creation mask. If the mode is octal, only bits 07777 (S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO) of the file’s mode bits participate in the comparison. If the mode is preceded by a dash ("-"), this primary evaluates to true if at least all of the bits in the mode are set in the file’s mode bits. If the mode is preceded by a plus ("+"), this primary evaluates to true if any of the bits in the mode are set in the file’s mode bits. Otherwise, this primary evaluates to true if the bits in the mode exactly match the file’s mode bits. Note, the first character of a symbolic mode may not be a dash ("-").

Not specified in SUSv3, but portable across *BSD and Linux at least (I haven't tested others).

  • I tried that before posting - does not work on AIX - at least. nothing is returned. $ uname -a AIX xyz 3 5 00000000000 $ find . -type f -perm +111 $ ||| sorry - formatting in comments is not supported apparently – webwesen May 28 '09 at 19:55
  • that doesn't work on AIX 6 at least for me – Kiwy Dec 27 '13 at 14:57
0

Well, if you like Rube Goldberg devices, you could use:


ls -l | grep '^[^d]\(..x\|.\{5\}x\|.\{8\}x\)' | awk '{ print $8 }'

Though this only lists the current directory.

Gavin McTaggart
  • 1,846
  • 16
  • 14