Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I list in long format all files (located in a directory) which belong to me (rights) and were modified more than 7 days ago?

share|improve this question

2 Answers 2

Use the find command with an argument for files owned by a given username and modified over a certain time.

find -user username -mtime +7

EDIT: Optionally (if you use GNU find, mandatory if you use other implementations) you can add a directory location to search in like this: find /path/to/search -user username -mtime +7. GNU find assumes you want to search from the current directory if you do not specify a path.

share|improve this answer
    
you're missing the directory name in that find command –  Mat Apr 2 '11 at 13:10
    
@Mat: depends if it is the GNU or BSD version of find. Here it looks like the GNU one. –  shellholic Apr 2 '11 at 13:17

In zsh:

ls -ld *(u$UIDm+7)

u and m are globbing qualifiers to match files by owner and modification time respectively.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.