I had created a .txt
file but now I forgot where I save it and also the file name of it. So my question is: is there any method to filter out .txt
files on descending order of created date? I'm currently using Ubuntu 12.04 on 32 bits.
I had created a .txt
file but now I forgot where I save it and also the file name of it. So my question is: is there any method to filter out .txt
files on descending order of created date? I'm currently using Ubuntu 12.04 on 32 bits.
Expanding on the comment from @soulsource you need to use the find command the most basic usage you could use is finding all files which end in .txt on your machine, the following command will descend though the file system starting at the root directory:
find / -type f -iname '*.txt'
Now if you know you saved the file in a specific directory, your home directory for instance, but forget which sub directory you can always speed up the find by changing the path:
find ~/ -type f -iname '*.txt'
Now, you just need to pipe, |
, the resulting files to ls
to order them by date
find ~/ -type f -iname '*.txt' | xargs ls -td1
If you're getting a large number of files back, you can always limit the number of responses by piping it again to head. As an example, if you're only interested in the 10 most recent results you can use:
find ~/ -type f -iname '*.txt' | xargs ls -td1 | head -n10
One thing to note about find
is that by default it does not follow symbolic links, if like me you have a few symbolic links in your home directory and want to check those too you need to use the -follow
option to find.
find ~/ -type f -iname '*.txt' -follow | xargs ls -td1 | head -n10