iesilikon.blogg.se

Linux find file with name
Linux find file with name













The 1st command would find within a directory called /mp3collection, only those mp3 files that have a size less than 5000 Kilobytes ( 10MB) $ find /mp3collection -name ‘*.mp3’ -size -5000k Since the directory is not specified as the the second parameter, Linux defaults to using the current directory as the one to start the search in. The above command would start searching for the files that begin with the letters ‘met’ within the current directory and the directories that are present within the current directory. So all files starting with any combination of letters in upper and lower case such as INDEX or indEX or index would be returned.

linux find file with name

The 2nd command would search for the same, but the case of the filename wouldn’t be considered. The search would be started in the directory /home/david and carry on within that directory and its subdirectories only. The 1st command would find files having the letters index as the beginning of the file name. simply discard all error messages.Īlternatively you could use 2>error.txt where after the search is completed you would have a file named error.txt in the current directory with all the error messages in it. So 2>/dev/null in this case means that while finding for the files, in case any error messages pop up simply send them to /dev/null i.e. 2 indicates the error stream in Linux, and /dev/null is the device where anything you send simply disappears. Note : 2>/dev/null is not related to find tool as such.

linux find file with name

Always enclose the filename in single quotes.















Linux find file with name