Using find to search for any owner having execute permissions.


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Using find to search for any owner having execute permissions.
# 1  
Old 09-02-2010
Bug Using find to search for any owner having execute permissions.

Hi I need help. I need to use find (or grep I don't care) to recursively search for files who have any kind of executable permissions (group and/or owner and/or other). I am looking for *.c and *.h

This what I am using now:
Code:
find . -name *.h -perm -111 -print

but I don't want to retype that for -110, -010, -100, -001, etc....

also - how do I combine find to search *.c AND *.h instead?

Last edited by Scott; 09-02-2010 at 03:19 PM.. Reason: Please use code tags
# 2  
Old 09-02-2010
Hi.

You can also use chmod-style symbolic permissions.

Code:
find . -name *.h -perm +ugo+x

# 3  
Old 09-02-2010
Quote:
Originally Posted by scottn
Hi.

You can also use chmod-style symbolic permissions.

Code:
find . -name *.h -perm +ugo+x

Thanks! Do you also know how to combine the search for both *.c AND *.h ?

---------- Post updated at 01:44 PM ---------- Previous update was at 01:38 PM ----------

And....can I just type
Code:
 +a

instead of
Code:
 + ugo

for all? Or is that not what 'a' means?
# 4  
Old 09-02-2010
Hi.

Try:

Code:
find . -name "*.[hc]" -perm +ugo+x

Regarding +a... yes, why not? Smilie
This User Gave Thanks to Scott For This Post:
# 5  
Old 09-03-2010
If your "find" doesn't support alphabetic permissions it can still be done. The leading hyphen on the permissions bits tells "find" to treat the bit pattern as a mask.

Code:
find . -type f -name "*.[hc]"  \( -perm -000001 -o -perm -000010 -o -perm -000100 \) -print

This User Gave Thanks to methyl For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Is there a way to restrict a user (owner) to execute scripts from a specific directory

Hello, I have a user Bob on a RHEL 7 server1. Where his script area is "/home/Bob/scripts/" and he is the owner for this directory. On the server1, there is a NFS mount from another server2, with path as "/global/work/" and Bob is the owner for this directory too in server2. (Same UID and GID... (5 Replies)
Discussion started by: karumudi7
5 Replies

2. Shell Programming and Scripting

Search for files owned by particular owner and group

I am searchingfor files owned by particular owner and group in a particular directory including its sub-directories. I use find <dir> -user <user> -group <group> -exec ls -l {} \; It does not work completely. In the sense is a subdirectory is owned by 'user' and group 'group' then all... (9 Replies)
Discussion started by: Soham
9 Replies

3. UNIX for Dummies Questions & Answers

Script without execute permissions will work for a user?

Please help me to understand the issue: Issue: There are shell scripts in a user home directory (/home/user_1) without execute permissions (rw-r--r--) to owner,group and world These shell scripts were able to execute/work previously but its not working now and it says permission denied or... (2 Replies)
Discussion started by: MSK_1990
2 Replies

4. UNIX for Dummies Questions & Answers

Removing permissions from all users including owner

Hello all: I will include a "requirement" for an issue I am attempting to solve for my boss. Basically, he would like to know if there is a way to prevent users and owner from editing 'write' script in Vi. - While working in Unix Vi, users would be able to keep all the previous versions... (15 Replies)
Discussion started by: bruski4
15 Replies

5. Solaris

Why user has permissions to execute 'init 0'?

Hi all. On one workstation run Solaris 10 a simple user can to execute 'init 0' command without input (su and root password). Example: % init 0 % OK I don't understand how user can execute 'init 0' command on this workstation? 1) I checked /usr/local/etc/sudoers all lines are... (6 Replies)
Discussion started by: wolfgang
6 Replies

6. Shell Programming and Scripting

search files with owner having execute permission

Hi All, I have to search for all files in the current directory where the owner having execute operation. I can find the files with specific permission such as 666 find . -type f -perm 666 But how to find files with only execute permission to user. tried with : find . -type f... (3 Replies)
Discussion started by: gotam
3 Replies

7. UNIX for Dummies Questions & Answers

Running file without execute permissions

Please explain this strange behavior to me bash-2.03$ ls -l abc -rw------- 1 bashboy users 319 Sep 21 18:02 abc bash-2.03$ ./abc bash: ./abc: Permission denied bash-2.03$ . abc Successfully run I wanted to ask how the file executes without the execute permissions when we... (3 Replies)
Discussion started by: rakeshou
3 Replies

8. UNIX for Dummies Questions & Answers

How to copy owner permissions to group

Hi, I need a command or a script to change the group permissions to be the same as the owner permissions for all my files and directories (recursive) any idea ? (4 Replies)
Discussion started by: ynixon
4 Replies

9. UNIX for Dummies Questions & Answers

help with permissions - execute but not delete

Hi, We have 2 users and one directory (dir). One user is admin user and other use r is operator user. who is responsible for just executing the scripts e.g. startWeblogic and stopWeblogic etc, we want to restrict this operator user in such a way that he can only execute these files and he should... (2 Replies)
Discussion started by: reldb
2 Replies
Login or Register to Ask a Question