If any subdirectories are found, they are listed, but not searched. If you want to restrict how many levels of subdirectory to search, you can use the -maxdepth option with a number.įor instance, specifying -maxdepth 1 searches only in the directory where the search begins. imagesīy default, the search looks in every subdirectory of your starting location. imagesīut this time, the output reflects the starting location of the search and looks like this. If our working directory is /home/hope/Documents, we can use the following command, which finds the same files: find. Notice that the full path is also shown in the results. home/hope/Documents/images/memes/picard.jpg home/hope/Documents/images/memes/goodguygary.JPG home/hope/Documents/images/memes/winteriscoming.jpg To only list files and subdirectories that are contained in the directory /home/hope/Documents/images, specify the first argument of the command as: find /home/hope/Documents/images /home/hope/Documents/images It's good practice to use this form of the command. If you try to use it on another Unix-like operating system, such as FreeBSD, specifying a directory is required. The example above is the "proper" way to use find. Running find with no options is the same as specifying that the search should begin in the working directory, like this: find. Notice that the output starts with a single dot, which represents the working directory. In this example, we see a total of ten files and four subdirectories in and beneath our Documents folder. Now let's run find without any options: find. First, let's check our working directory using the pwd command: pwd /home/hope/Documents
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |