
- #Find any file in linux how to
- #Find any file in linux windows
This option has to be used with a number that specifies how many days passed since the file was accessed, modified or changed: find / -atime 1
Change Time ( -ctime) – when the file’s meta-data was updated. Modification Time ( -mtime) – when the file was modified. Access Time ( -atime) – when the file was either read or written into. Linux keeps track of the files using these three timestamps. If you want to search for files based on when they were accessed and modification time footprints. This will look for files named my-file, excluding directories or links. You can also combine the – type and -name options to narrow down your searches further: find / -type f -name my-file This will list all of the current directories in your system since we searched from our root directory with the / (slash) symbol. There are several filters that you can use:Ī simple example of using a file type can be seen below: find / -type d Linux allows users to list all information based on their types. Lastly, if you want to find a certain file by name and remove it, use the -delete argument after the file name: find. This will list down all the text files starting with the current folder. You can look for multiple files with a common format like. However, it has to be preceded by the escape identifier (\) to let Linux know that this is the part of the find command. Second, we can use the exclamation symbol ( !). The first method involves using the –not keyword in the following manner: find. You can also search for all files without a certain keyword in their name. If you know the name of the file, but are not sure about its case-sensitivity, use the following find command: find. Keep in mind that the -name argument looks for case-sensitive terms in Linux. Note that we started the search in our current directory by using the. We used the -name option, and searched for a file called my-file. To run a simple search query using the name of the file, use the find command like this: find. Of course, the most common method to look for a file is using its name. Let’s take a look at various options Linux provides its users: Searching by Name The third argument is where you will specify the relevant search term.
This could be the file’s name, type, date of creation, etc. The second argument is dedicated to your file.
In order to find the current directory you are in, use the pwd command.
~ (tilde) - to search from your home folder. (dot) - search from the folder you’re currently working on (current directory). It can be replaced with several arguments, including: The argument is the origin point of where you want to start the search. It starts with the keyword find, which alerts Linux that whatever follows after will be used to find your file. The most popular command to find and filter files on Linux is find. #Find any file in linux how to
Using the Find Command in Linuxįirst, let us explain the find command and how to use it. If you don’t know how to connect to VPS, you can follow this guide before proceeding further. That being said, the steps should also work for Debian, CentOS, or any other distribution of Linux. To do that, we’ll utilize the find and locate commands in Linux.Īn important thing to note is that we will be using Ubuntu VPS in this guide. What’s great, once you understand the commands, searching for files on your Linux platform is strikingly easy. Besides searching based on common filters, you are also able to find files by user permissions, size, timestamps, and so on. While there is some truth to this, Linux gives users more options on how to search for files using certain commands.
#Find any file in linux windows
This might be because most people are used to operating Windows or macOS, which have more clear-cut and user-friendly directory layouts. New Linux users often claim that they get confused about the location of their files on a server. Why Use Find and Locate Commands in Linux?
Why Use Find and Locate Commands in Linux?.