![]() ![]() find /home -user userName Search files based on the user 9. The below command will find all the files that /homebelong to user userName say for example, ubuntu, under the /home directory. The previous command displayed a single file from the root directory. To find a file named test.txt under the root directory / of the owner root, this command is used. type f -name "*.php" Search the PHP files in a directory 7. To display all the PHP files in a directory the following command is used. type f -name test.php Search the PHP file with name 6. To find the php files with the name test.php use the following command. find / -type d -name Test Search directories using the name 5. This command will help us find the directories named Test under the / directory. find /home -iname test.txt Search the files ignoring the case 4. whether it is uppercase or lowercase, our command gets all the files under the name test.txt under the home directory. The following command gets us the files with the name test.txt ignoring the case, i.e. Find files using the name ignoring the case find /home -name test.txt Search a file under home directory 3. The file with the name test.txt which is under the home directory can be found using the following command. name test.txt Search a file with specific name 2. The following command will help us in finding the file named test.txt in the current working directory. Find sticky bit files with 551 permissions.Find files with 777 permissions and chmod to 755.Find files with 777 permissions and chmod to 644.Find files with/without 777 permissions.Find the changed files in the last 1 hour.Find modified files within the specific days.Find files using the name ignoring the case.Here are some basic examples to learn bout the usage of find command in Linux. The above attributes are optional and they can be used according to the user’s need. - The criteria like searching a file by its name or date or time range.,etc.- The directory when we begin the searching.The attributes in the find command are explained below. Let us see the syntax of the find command below. Users can search from several criteria like the name of the file, the date in which the file was created, owner and permissions, the time range in which the file got created, or even the modified date. Using this command, Linux users can set a specific search area, filter or find the files on the specific area or directory, and perform actions on the files that match the search. This command is used to locate files in one or more directories. One of the very useful commands for any Linux user is the find command. Rather they need to have a good knowledge of the various commands available. Linux users cannot just rely on GUI to perform various tasks in their system.
0 Comments
Leave a Reply. |