Tuesday, 10 July 2012

How to find files in linux

These are some of the useful commands to search files in linux system.
Consider we need to list all the mp3 files in our system. Use the following command

find / -name *.mp3

Now, we need to find a file which has the name in which some letters are s and e

find / -name *se*

if we need to search in a particular folder, just include the folder path

find Softwares/ -name *se*

Find command is useful but it will take some time to search the system if it contains too many files. Locate is a very simple and powerful command which can be used in place of find.

To find the file abc.txt command is

locate abc.txt

it will scan the system and list the locations where abc.txt is present.
Now, if we need to search in a specific directory just include the folder name.

locate Softwares/ *.txt

okay then why we should use locate command ? both yields the same result..
Its because locate command is too faster than find command. The reason for that is, there is a background process that runs on your system that essentially finds new files and stores them in a database. when you use the locate command, it then searches the database instead of searching your filesystem while you wait.

0 comments:

Post a Comment

 

Subscribe to our Newsletter

Contact our Support

Email us: youremail@gmail.com

Our Team Memebers