Now if you want to find all text files in your current or specific directory, the respective commands should look as follows. find Documents/test.txt Find files by file extension Suppose you want to search a file named ‘test.txt’ in Documents, the complete command should be as follows. The complete command should look like, find Now, if you want to locate the file in a specific directory. This will search the file in the current directory you are working on. If you want to find a file using the find command, execute one of the following on your terminal. Searching for Files and Directories using the find Command Search file in the current directory If you want to search for files by their content instead of the file name, have a look at the grep command instead. ![]() But the commands should be the same on other Linux distributions. This means that the locate command is usually faster, but it assumes that the file being searched for is in its index database, and that database is usually created at night, so newer files are not found by the locate command. ![]() The difference between the two commands is that find performs a search in real-time and locate uses an indexed database for the search. The two commands are the find command and the locate command. In this article, I briefly describe two commands in detail with useful examples to search for files with the terminal. But before you are able to edit a file, you must be able to locate it in your system. Basically, everything in Linux is a file.
0 Comments
Leave a Reply. |