Command to find a file in Unix with Example
The find command is used to locate files on a Unix or Linux system. find will search any set of directories you specify for files that match the supplied search criteria. You can search for files by name, type, date, size and other criteria.
# find . -name tecgeeks.tar
# find /home -name tecgeeks.txt
# find / -type d -name TecGeeks
# find -type f -empty
# find -type d -empty
# find -type f -name ".*"
To find all the files which are changed in last 1 hour.
# find / -cmin -60
To find all the files which are modified in last 1 hour.
# find / -mmin -60
To find all 50MB files,
# find / -size 50M
- Find Files Using Name in Current Directory
# find . -name tecgeeks.tar
- Find Files Under Home Directory
# find /home -name tecgeeks.txt
- Find Directories Using Name
# find / -type d -name TecGeeks
- Find all Empty Files
# find -type f -empty
- Find all Empty Directories
# find -type d -empty
- File all Hidden Files
# find -type f -name ".*"
- Find Changed Files in Last 1 Hour
To find all the files which are changed in last 1 hour.
# find / -cmin -60
- Find Modified Files in Last 1 Hour
To find all the files which are modified in last 1 hour.
# find / -mmin -60
- Find Files based on their size
To find all 50MB files,
# find / -size 50M
Command to find a file in Unix with Example
Reviewed by TecGeeks News
on
April 30, 2016
Rating:
No comments: