Quantcast
Channel: Commands tagged dates sorted by votes
Viewing all articles
Browse latest Browse all 10

Get yesterday's date or a previous time

$
0
0
$ date -d '1 day ago'; date -d '11 hour ago'; date -d '2 hour ago - 3 minute'; date -d '16 hour'

With this command you can get a previous or future date or time. Where can you use this? How about finding all files modified or created in the last 5 mins?

touch -t `echo $(date -d "5 minute ago" "+%G%m%d%H%M.%S")` me && find . -type f -newer me

List all directories created since last week?

touch -t `echo $(date -d "1 week ago" "+%G%m%d%H%M.%S")` me && find . -type d -cnewer me

I'm sure you can think of more ways to use it. Requires coreutils package.

commandlinefu.com

by David Winterbottom (codeinthehole.com)


Viewing all articles
Browse latest Browse all 10

Trending Articles