Linux Command Line Tips - How to search for a file on Linux

# to search for a file on Linux  using name

# find /datadump -name abc.txt

This command will search for all files located in /datadump  filesystem

Find files ignoring case

find /datadump-iname abc.txt 

Find Directories Using Name

find / -type d -name datadump


Find Files With 777 Permissions
 

# find . -type f -perm 0777 -print

Find Files Without 777 Permissions

# find / -type f ! -perm 777

Find Read Only Files

# find / -perm /u=r

Find Executable Files

# find / -perm /a=x

Find all Empty Files

# find /datadump -type f -empty


Find all Empty Directories

# find /datadump -type d -empty

File all Hidden Files

# find /datadump -type f -name ".*"       

Find Last 50 Days Modified Files

# find / -mtime 50

Find Last 50 Days Accessed Files

# find / -atime 50

Find Last 50-100 Days Modified Files

# find / -mtime +50 –mtime -100

Find Changed Files in Last 1 Hour

# find / -cmin -60

Find Modified Files in Last 1 Hour

# find / -mmin -60

Find Accessed Files in Last 1 Hour

# find / -amin -60

Find 50MB Files

# find / -size 50M

Find Size between 50MB – 100MB

# find / -size +50M -size -100M

        

Post a Comment

And that's all there is to it!

If anyone has any other questions or requests for future How To posts, you can either ask them in the comments or email me. Please don't feel shy at all!

I'm certainly not an expert, but I'll try my hardest to explain what I do know and research what I don't know.

Previous Post Next Post