In this article, we have explained Difference between find and locate command in Linux
find | locate |
---|---|
It searches directly in the file system for the required files and directories | It searches in the database for the required files and directory |
find command has number of options and easy to customized based on our requirement. | locate command has very few options |
We can find files based on name, size,type,depth,age,user,group, permissions etc | We can find files only based on name and permissions |
We can reduce the depth of search | We cannot reduce depth of search |
find command will produce accurate results as it searches directly in the file system | locate command wont produce accurate results as it searches the database which will be updated only once per day by default |
find command wont produce delete files in search results as it searches directly in the file system | locate command may produce deleted files in search results as it searches in the database which may not be updated |
There is way to use search results by using -exec option | There is no direct way to use search results |
find command operates slowly | locate command operates fastly |