Find files in Unix
> FIND FILES THAT WERE MODIFIED/ACCESSED WITHIN A SPECIFIED TIME
$ find /<your path> -mtime 1 -type f
This command would return files modified in the last 24 hours .
You can use -mtime option to return a list of files that were last modified N*24 hours ago. For example to find a file in last month (30 days) you would need to use -mtime +30 options.
-mtime +30 means you are looking for a file modified 30 days ago.
-mtime -30 means less than 30 days.
-mtime 30 If you skip + or – it means exactly 30 days
-type f searches only for files and not directories
To list the files in the directory tree that were modified within the past five minutes, type
$ find /<your path> -mmin -5
To return a list of files that were accessed in the last 24 hours you would need to use the–atime option.
$ find /<your path> -atime 1 -type f
> FINDING FILES WITH A SPECIFIC EXTENTION WITHIN A DIRECTORY
$ find /<your path> -name “*.cfg”
The command –name matches the file names with the specified pattern
> FINDING FILES BASED ON THE FILE-PERMISSIONS
Files with execute permission for group :
$ find /<your path> -perm g=x -type f
Files with execute permission for others:
$ find /<your path> -perm o=x -type f
Where ‘g’ denotes groups and ‘o’ denotes others. x denotes execute permission.
> FIND FILES THAT WERE MODIFIED/ACCESSED WITHIN A SPECIFIED TIME
$ find /<your path> -mtime 1 -type f
This command would return files modified in the last 24 hours .
You can use -mtime option to return a list of files that were last modified N*24 hours ago. For example to find a file in last month (30 days) you would need to use -mtime +30 options.
-mtime +30 means you are looking for a file modified 30 days ago.
-mtime -30 means less than 30 days.
-mtime 30 If you skip + or – it means exactly 30 days
-type f searches only for files and not directories
To list the files in the directory tree that were modified within the past five minutes, type
$ find /<your path> -mmin -5
To return a list of files that were accessed in the last 24 hours you would need to use the–atime option.
$ find /<your path> -atime 1 -type f
> FINDING FILES WITH A SPECIFIC EXTENTION WITHIN A DIRECTORY
$ find /<your path> -name “*.cfg”
The command –name matches the file names with the specified pattern
> FINDING FILES BASED ON THE FILE-PERMISSIONS
Files with execute permission for group :
$ find /<your path> -perm g=x -type f
Files with execute permission for others:
$ find /<your path> -perm o=x -type f
Where ‘g’ denotes groups and ‘o’ denotes others. x denotes execute permission.
No comments:
Post a Comment