Handy bash commands when working with timestamps as directory names

Create directory named with Unix timestamp of current time
mkdir `date +%s`

Human readable datetime
date -d @1641207605

Human readable datetime of latest directory
date -d @`ls -d */ | tail -n1 | cut -c -10`

cd to latest directory
cd `ls -d */ | tail -n1`


Posted in:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: