Finding file location is common matter in Linux user. Find command use to find file location in Linux. The Linux find command is one of the most important and frequently used command command-line utility in Unix-like operating systems. The find command is used to search and locate the list of files and directories based on conditions you specify for files that match the arguments.
find command can be used in a variety of conditions like you can find files by permissions, users, groups, file types, date, size, and other possible criteria.
The most obvious way of searching for files is by their name.
To find a file by name with the find command, you would use the following syntax:
find -name "query"
You can specify the type of files you want to find with the -type parameter. It works like this:
find -type type_descriptor query
Here are some of the descriptors you can use to specify the type of file:
find gives you a variety of ways to filter results by size and time.
Size
You can filter files by their size using the -size parameter. To do this, you must add a special suffix to the end of a numerical size value to indicate whether you’re counting the size in terms of bytes, megabytes, gigabytes, or another size. Here are some commonly used size suffixes:
To illustrate, the following command will find every file in the /usr directory that is exactly 50 bytes:
find /usr -size 50c
You can also search for files by the user or group that owns the file using the -user and -group parameters, respectively. To find every file in the /var directory that is owned by the syslog user run this command:
find /var -user syslog