jump to home dir and list all, not older than 3 days, with full-path, hidden/non-hidden files/subdirectories

cd && tree -aicfnF --timefmt %Y%j-%d-%b-%y|grep $(date +%Y%j)'\|'$[$(date +%Y%j)-1]'\|'$[$(date +%Y%j)-2]
Number of days back: change/append arbitrary amount of '\|'$[$(date +%Y%j)-x] expressions or specify any n-th day before today for a single day (you have to replace x with 3, 4, 5, whatever ... above I replaced it with 1 and 2 to get listing for yesterday and day before yesterday and 0 for today was not necessary, so left out). Q: How to narrow to *.pdf , *.png, *.jpg, *.txt, *.doc, *.sh or any type of files only? A: Pipe to grep at the end of command. Even shorter: cd && day=3;for a in $(seq $day -1 0);do tree -aicfnF --timefmt %Y%j-%d-%b-%y|grep $[$(date +%Y%j)-$a];done Here it's only needed to change amount of variable day to list period of days back - here is set to three days back (the seq command is adjusted for listing the oldest stuff first).
Sample Output
[2019215-03-Aug-19]  ./.config/session/
[2019215-03-Aug-19]  ./.config/session/konsole_2b5b0f704-9942-428b-a3d8-8054efd32b18_1564837706_57870
[2019215-03-Aug-19]  ./.config/session/konsole_23e1f9567-a8ff-42ad-a879-76f7bafb56c3_1564840981_89854
[2019215-03-Aug-19]  ./.config/session/konsole_2e2aea661-fd41-4510-b0b9-1d2c69ef99c7_1564864156_611707
[2019215-03-Aug-19]  ./.config/konsolerc
[2019216-04-Aug-19]  ./.config/dconf/
[2019216-04-Aug-19]  ./.config/dconf/user
[2019216-04-Aug-19]  ./.config/briši_me.pdf

-2
By: knoppix5
2019-08-04 02:22:24

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: