Remember, you can always search the directory you’re currently in by putting a dot (.) after find. This command is also useful if you need to find multiple files that begin with the same name: find –iname “file\*”įor example, if you wanted to find 3 files named players1.txt, players2.txt and players3.txt, type the following command: find –iname “play\*” If you know the partial name of the file, you can still search for it. The syntax for this is: find –not –name “name_of_file_you_don’t_want”Īnother command that achieves the same thing is as follows: find \! –name “name_of_file_you_don’t_want” You can search for files that don’t match a certain pattern – that is, you will be given a list of all files that don’t match what you’ve typed. The command to search for a file in the directory you’re currently in varies very slightly (notice the dot): find. If you know your file is located in a certain directory, you can navigate to that directory and then find the file to speed up the search. Now you can search for players.txt even by typing: find –iname PLAYERS.txt You can ask Linux to ignore the letter case of the name of your file by typing the following command: find –iname “name_of_file” This means that if you were looking for PLAYERS.txt and searched for players.txt, you won’t be able to find it. Remember that this command is case sensitive. For example, if you wanted to search for a file called players.txt, simply type: find –name players.txt The name of the file should be specified without the quotes. Here, the –name keyword tells Linux to look for files by its name. The syntax to find a file by its name is: find –name “name_of_file” You can find a file if you know its exact name. Let’s take a look at the find command first. There are two main ways to find files in Linux: using the find command and the locate command. In this tutorial we’ll take a look at some of the commands with which you can quickly find the file you’ve been looking for. In many ways, Linux file finding commands are even better than anything that Windows has to offer. However, you’ll find that Linux offers several efficient search commands with which you can find exactly the file you’d been looking for. Finding a file in Linux can be a little confusing if you’re used to the Windows interface.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |