Cyberithub

12 Easy Find Command Examples to List all files and directories with 777 Permissions in Linux

Advertisements

In this article, I will take you through 12 Easy Find Command Examples to List All Files and Directories with 777 Permissions. If you are using Linux based Systems from long time then you must be aware of the issues arises due to files and directories permissions. Some of the deployments like Database deployments in Linux Servers are highly permission dependent where change in permission of files and directories likely to cause Fatal error.

Although any permission other than the required permissions can cause the issue but in this article we will look into a situation where files and directories had been assigned 777 permission accidentally and we need to search all those files and directories to reassign the correct permission. There could be another scenarios due to which you might need to search all 777 permissions files and directories. So for all such scenarios you can use the find command as explained in below examples. We will also cover how to search all those 777 permissions files and directories based on ownership with the help of examples.

12 Easy Find Command Examples to List all files and directories with 777 Permissions in Linux

Find Command Examples to List all Files and Directories with 777 Permissions in Linux

Also Read: 13 Easy Methods to Check If a Server is Physical or Virtual in Linux or Unix

Example 1: How to Find all files and directories with 777 Permissions in Linux

If you want to find all files and directories with 777 Permissions in Linux then you need to use below find command. In this example, we are looking for all files and directories under / path with 777 Permissions using find / \( -type f -o -type d \) -perm 777 command.

[root@localhost ~]# find / \( -type f -o -type d \) -perm 777
/root/example
/root/example/hello.rs
/root/example/hello
/tmp/CentOS-7-x86_64-Minimal-1810.iso

-type : File is of type block, character, directory, regular file etc. More information can be checked on Find Command Man Page.

-o : OR Operator. More information can be checked on Find Command Man Page.

-perm : File's permission bits are exactly mode (octal or symbolic). More information can be checked on Find Command Man Page.

NOTE:

Please note that here I am using root user to run all the below commands.You can use any user with sudo access to run all these commands. For more information Please check Step by Step: How to Add User to Sudoers to provide sudo access to the User.

Example 2: How to Find all files on Server with 777 Permissions in Linux

If you want to find all files on Server with 777 Permissions then you need to use below find command. In this example, we are looking for all files under / path with 777 Permissions using find / -type f -perm 777 command.

[root@localhost ~]# find / -type f -perm 777
/root/example/hello.rs
/root/example/hello
/tmp/CentOS-7-x86_64-Minimal-1810.iso

Example 3: How to Find all directories on Server with 777 Permissions in Linux

If you want to find all directories on Server with 777 Permissions then you need to use below find command. In this example, we are looking for all directories under / path with 777 Permissions using find / -type d -perm 777 command.

[root@localhost ~]# find / -type d -perm 777
/root/example

Example 4: How to Use Find Command to List all the 777 permission files owned by Specific User in Linux

If you want to find all files on Server with 777 Permissions and owned by a Specific User then you need to use below find command. In this example, we are looking for all 777 permission files owned by User centos under / path using find / -type f -perm 777 -user centos command.

[root@localhost ~]# find / -type f -perm 777 -user centos
/root/example/hello.rs
/root/example/hello

Example 5: How to Use Find Command to List all the 777 permission files belong to Specific Group in Linux

If you want to find all files on Server with 777 Permissions and belong to Specific Group then you need to use below find command. In this example, we are looking for all 777 permission files belong to group centos under / path using find / -type f -perm 777 -group centos command.

[root@localhost ~]# find / -type f -perm 777 -group centos
/root/example/hello.rs
/root/example/hello

Example 6: How to Use Find Command to List all the 777 permission files owned by Specific User and Specific Group

If you want to find all files on Server with 777 Permissions and owned by a Specific User and Group then you need to use below find command. In this example, we are looking for all 777 permission files owned by user centos and group centos under / path using find / -type f -perm 777 -user centos -group centos command.

[root@localhost ~]# find / -type f -perm 777 -user centos -group centos
/root/example/hello.rs
/root/example/hello

Example 7: How to Use Find Command to List all the 777 permission directories owned by Specific User in Linux

If you want to find all directories with 777 Permissions in Linux then you need to use below find command. In this example, we are looking for all directories with 777 permissions under / path using find / -type d -perm 777 -user centos command.

[root@localhost ~]# find / -type d -perm 777 -user centos
/root/example

Example 8: How to Use Find Command to List all the 777 permission directories belong to Specific Group in Linux

If you want to find all directories on Server with 777 Permissions belong to Specific Group then you need to use below find command. In this example, we are looking for all directories which belongs to group centos under / path with 777 Permissions using find / -type d -perm 777 -group centos command.

[root@localhost ~]# find / -type d -perm 777 -group centos
/root/example

Example 9: How to Use Find Command to List all the 777 permission directories owned by Specific User and Specific Group

If you want to find all directories on Server owned by Specific User and Specific Group with 777 Permissions then you need to use below find command. In this example, we are looking for all directories owned by User centos and Group centos under / path with 777 Permissions using find / -type d -perm 777 -user centos -group centos command.

[root@localhost ~]# find / -type d -perm 777 -user centos -group centos
/root/example

Example 10: How to Find directories and files with permission other than 777 in Linux

If you want to find all directories and files with permissions other than 777 then you need to use below find command. In this example, we are looking for all directories and files under /home/centos path with permissions other than 777 using find /home/centos \( -type f -o -type d \) -not -perm 777 command.

[root@localhost ~]# find /home/centos \( -type f -o -type d \) -not -perm 777
/home/centos
/home/centos/.bash_logout
/home/centos/file
/home/centos/.bash_history
/home/centos/example.txt
/home/centos/.bash_profile
/home/centos/.bashrc
/home/centos/output.txt
/home/centos/CentOS.ISO
/home/centos/.Xauthority

Another way you can use to find directories and files with permission other than 777 in Linux is by using below find command. The only difference here is that instead of using -not option we are using ! operator.

[root@localhost ~]# find /home/centos \( -type f -o -type d \) ! -perm 777
/home/centos
/home/centos/.bash_logout
/home/centos/file
/home/centos/.bash_history
/home/centos/example.txt
/home/centos/.bash_profile
/home/centos/.bashrc
/home/centos/output.txt
/home/centos/CentOS.ISO
/home/centos/.Xauthority

Example 11: How to Only Find the directories with permission other than 777 in Linux

If you want to only find the directories with permissions other than 777 then you need to use below find command. In this example, we are looking for all directories under /home/centos path with permissions other than 777 using find /home/centos -type d -not -perm 777 command.

[root@localhost ~]# find /home/centos -type d -not -perm 777
/home/centos
/home/centos/file

Another way to find the directories with permission other than 777 in Linux is by using below find command. The only difference here is that instead of using -not option we are using ! operator.

[root@localhost ~]# find /home/centos -type d ! -perm 777
/home/centos
/home/centos/file

Example 12: How to Only Find the files with permission other than 777 in Linux

If you want to only find the files with permissions other than 777 in Linux then you need to use below find command. In this example, we are looking for all files under /home/centos path with permissions other than 777 using find /home/centos -type f -not -perm 777 command.

[root@localhost ~]# find /home/centos -type f -not -perm 777
/home/centos/.bash_logout
/home/centos/.bash_history
/home/centos/example.txt
/home/centos/.bash_profile
/home/centos/.bashrc
/home/centos/output.txt
/home/centos/CentOS.ISO
/home/centos/.Xauthority

Another way to find the files with permission other than 777 in Linux is by using below find command. The only difference here is that instead of using -not option we are using ! operator.

[root@localhost ~]# find /home/centos -type f ! -perm 777
/home/centos/.bash_logout
/home/centos/.bash_history
/home/centos/example.txt
/home/centos/.bash_profile
/home/centos/.bashrc
/home/centos/output.txt
/home/centos/CentOS.ISO
/home/centos/.Xauthority

 

 

 

 

Popular Recommendations:-

6 Popular Methods to List All Running Services Under Systemd in Linux

Unix/Linux Find Files and Directories Owned By a Particular User(5 Useful Examples)

How to Install PHP on Ubuntu 18.04

How to Install Ruby on Ubuntu 18.04 with Easy Steps

How to Install Ruby on CentOS/RedHat 7 in 5 Easy Steps

33 Practical Examples of ulimit command in Linux/Unix for Professionals

Install Node.js in 6 Easy Steps on Ubuntu 18.04

How to Install NVM for Node.js on Ubuntu 18.04

How to Limit CPU Limit of a Process Using CPULimit in Linux (RHEL/CentOS 7/8)

How to Install Rust Programming Language in Linux Using 6 Best Steps

Leave a Comment