I want to see the recently used(accessed) files along with their path through terminal.
How could i get that files list?
Note: This question is not a duplicate of Show recent modified/created files using Terminal
command line
I want to see the recently used(accessed) files along with their path through terminal.
How could i get that files list?
Note: This question is not a duplicate of Show recent modified/created files using Terminal
Best Answer
It works on Ubuntu systems which has
nautilus
as a default file-manager.Run the below command on terminal to see the recently accessed(aka viewed) files.
Information about all the recently accessed files are stored in this particular
~/.local/share/recently-used.xbel
file. Extracting only the file along with it's path was done by the above command.Command Explanation:
-n
--> suppress automatic printing of pattern space-r
--> Extended regex. If we use sed with-r
, then we don't have to escape some characters like ((
,)
,{
,}
,etc)'s/.*href="([^"]*)".*/\1/p'
--> sed searches for a line which has this(.*href="([^"]*)".*
) regex in the input file. If it find any, then it grabs only the characters that are within double quotes which was afterhref=
(href=""
) and stored it in a group. Only the stored group are printed through back-reference(\1
).Example:
If you want the output to be formatted then run this,