- Linux Systems
- How To Search And Find Files In Linux Shell Commands
You can search and find files in Linux using these command provided on this page. This page gives you the commands you will need for searching files 
Thu May 03, 2007
lets say i have a file called my_users which is located in several of your directories. all files can be located using find in linux.
locating files by name: make sure you are in the directory or home directory where you want to look for the file name. if you are not sure where you have it, you can always do it from the root directory, but it will be faster if you go to the directory where you think you have the file. so lets say i think my_users file is located somewhere in my home directory and my username is wallpaperama i would use this commandcode
once i have chaned to my home directory, i can search for my_users file with this commandcode
find ~ -name my_users -print
the find utiltity may take some time to complete its work. as find is examining directories, it reports to your workstation both its output and any error information that is apporpiate. you may see the pathnames of files named my_users as well as information about which directories you cannot examine because of their assinged permissions.
following are explanations of each part of the ocmmand line inthe example command above
( find ~ -name my_users -print )
|COMMAND ||DESCRIPTION |
|find||instructs the shell to execute the find utility, which searches a target directory and all of its sbudirectories. |
|~||this argument specifies the starting point directory - in this case, your home direcotyr. the resul is a seach of all directories listed i nyour home direcotyr, which includes your home direcotry and all its subdirectories |
|-name my_users ||instructs find to locate all files with the specified name my_users. in addition to locating files by name, find can also locate based on the criteria of age, owner , permission, size, tec. |
|-print||specifies that the full pathname of each occurence of the files matching the selection criterion should be oupt. in addition to pringint, find can be instructed to remove located files, change file permisions, or emply essentially any shell file-manipulation command |