Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there any command to display the recently modified/created files?

Which one...?

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

find ${1} -type f | xargs stat --format '%Y :%y %n' 2>/dev/null | sort -nr | cut -d: -f2-

See Find command

Source:Linux

share|improve this answer
    
The command is correct. Have you tried it? –  Mitch Jan 27 at 11:51
    
Yeah,it's correct,it just takes some time.I thought -f2- would be incorrect because commands don't generally end with an - –  Registered User Jan 27 at 11:56
    
Nice one! What about ignoring hidden files? –  Ionică Bizău Jan 27 at 11:57
    
You can use -iname. For example, find *.txt file but ignore hidden .txt file such as .vimrc you would -type f \( -iname "*.txt" ! -iname ".*" \). –  Mitch Jan 27 at 12:04
    
@Mitch how to specify to find files in last 2 days? –  user13107 May 8 at 2:36
show 1 more comment

Check stat command:

Usage:

stat [options] filename ... ...

e.g.

stat /home/user/Docs/filename.txt

To search for files, use find commands:

e.g.

find /to/target/directory* -mtime -1

(the switch -mtime n show file's with data last modified n*24 hours ago, for -mtime -1 the files 1 day old will be shown)

find /to/target/directory* -mmin 30

will show files modified in last 30 minutes.

Check for more options under TESTS in the manual pages (use man find in terminal). You can use other switches like -amin n (last accessed n minutes ago), -cmin (file's status was last changed n minutes ago), and others.

share|improve this answer
    
You should give specific command –  Registered User Jan 27 at 11:36
    
Maybe you could consider either removing the stat part from your answer or giving a specific command. –  Registered User Jan 27 at 11:48
    
stat filename where filename could be your target's absolute or relative path. This will show access, modification, change times among other outputs.. –  rusty Jan 27 at 11:54
    
stat will also give you the file's birth time if the filesystem supports that.. –  rusty Jan 27 at 11:55
    
The asker wants to see a list of recently changed files.stat gives out properties of a specific file or directory(like when it was modified last time). Therefore this command is not appropriate for this question. –  Registered User Jan 27 at 12:02
show 3 more comments

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.