Is there a tool, which lets me know about the last newly created files?

The still common way of using a hierarchically file system makes it hard to save files in different places, so sometimes I sort things into general topic folders and sometimes at the place of directly related things, f.e. publications related to a certain tool in the directory of the binaries.

Best would be a tool, which I can ask:

  • Period of creation / saving

  • File type / name / extension

  • Black-/Whitelist of directories to exclude/include

  • which operating systems are you interested in?
    – pqnet
    Sep 4 '14 at 15:24
  • pqnet: Debian GNU/Linux
    – PythoNic
    Sep 6 '14 at 23:58

A command line tools supporting such actions is find:


find /path -iname '*.ext' # search for extension (don't forget the quotes)
find /path -mtime n       # search for last modified `n*24h` ago
find /path -atime n       # search for last accessed `n*24h` ago
find /path -newer ref     # newer than ref
find /path -size +100M    # larger than 100MB
find /path -perm 664      # example to search for files with a specific permission
find /path -type <t>      # search for file `f`, directory `d`, symbolic link `l` ...

In order to ask for more details on the filetype, I suggest running something along the lines of

find /path -type f -exec file '{}' \; | grep 'Vorbis audio'

I'm not aware of a tool (particularly a GUI tool) which is as capable as find.

  • Combining your serious answer with bantering humor would look nearly the same. So I'll grin every time I'll use 'find' for this task :)
    – PythoNic
    Sep 7 '14 at 0:03
  • Why does find -atime give my always a different result (fewer entries) on the 2nd run, short after the 1st run?
    – PythoNic
    Sep 12 '14 at 11:15
  • good question, I have not experienced this before. You should ask a new question! Please provide the exact commands you're using.
    – Sebastian
    Sep 12 '14 at 11:25

Use inotify if you need to know immediately

If you need to know about the newly created files immediately, you can actually wait for the event of creating a file in a directory, or in a directory tree, using the inotify API on linux (see man 7 inotify):

You would combine this with parts of the other solutions to find out the detailed information about the files.

Example watching file creation

Below, the command inotifywait -e create -m /path is started. When it waits after the line Watches established., a new file foo is created in /path on another terminal:

term1$ inotifywait -e create -m /path
Setting up watches.
Watches established.

term2$ touch /path/foo

term1$ inotifywait -e create -m /path
Setting up watches.
Watches established.
./ CREATE foo

(first 3 lines repeated from above)

Without the -m (--monitor) option inotifywait stops after the first event, which can be useful in a script loop.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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