Archive for November, 2009

Linux Find Commands

I Use Linux at my work and as i am new to it, i was trying to exlore different commands which make my work easy.Lately i was to find one files location and in that process came across few find commands which might be useful to u all:

Listing them below,Check out!!!!!

find / -name  file …this command searches thru the root directory for the file named ‘file’ and prints the location.

find . -name file …..this command would also list all the files named ‘file’ but in the current directory

find /root/home  -name file ….this command would search for the file named ‘file’ through the /root and /file directories.

find /root/file -name “file*” …….this command would search in the root/file directory for all the file names that starts with the word  file  and lists them

find /root/file -name “*.txt” ……this would list all the text files(files with extension txt) present in the location /root/file

find . -mtime -1 …….to find all the files that were modified within the last 1 hour.

find / -size +2000 ……command to find a file sof particular size,in this case it will return all the files of size greater than 2KB.

find /home -user jonde ……find every file under the directory home owned by the user jonde

find . -size 1000c …….find files with exactly 1000 characters

find . -size +599c  -and -size -701c ………find the files containg between 600 to 700 characters inclusive

find . empty ……..will list all the empty files

That’s it guys, these are the basic find commands will update the post if i find any………

Any new areas in this are welcome in the form of posts and suggestions.

Happy linuxing…[:)]

Leave a Comment