Find: Difference between revisions
From Hackepedia
Jump to navigationJump to search
Created page with "== To find a file created in the last X days == The following prints a file created/changed in the last day find . -ctime -1 -print Also see ctime. == To find a file acc..." |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
== To find a file | == To find a file changed in the last X days == | ||
The following prints a file | The following prints a file changed in the last day | ||
find . -ctime -1 -print | find . -ctime -1 -print | ||
Line 14: | Line 14: | ||
Also see [[atime]] | Also see [[atime]] | ||
== Large files == | |||
find . -name '*' -size +500M | |||
will search from the directory you're in, recursively, listing all files over 500M in size. If you're not root, you will likely get a lot of "Permission Denied" errors if you are traversing a large file system. You can avoid this by redirecting all errors to /dev/null: | |||
find / -size +1G 2>/dev/null | |||
will search every file under the root directory (/) for files over 1 gigabyte, ignoring all error warnings |
Latest revision as of 18:44, 24 December 2013
To find a file changed in the last X days
The following prints a file changed in the last day
find . -ctime -1 -print
Also see ctime.
To find a file accessed 30 days or before
To see files that were accessed last 30 or more days from now you'd do
find . -atime +30 -print
Also see atime
Large files
find . -name '*' -size +500M
will search from the directory you're in, recursively, listing all files over 500M in size. If you're not root, you will likely get a lot of "Permission Denied" errors if you are traversing a large file system. You can avoid this by redirecting all errors to /dev/null:
find / -size +1G 2>/dev/null
will search every file under the root directory (/) for files over 1 gigabyte, ignoring all error warnings