Skip to content

Instantly share code, notes, and snippets.

@disulfidebond
Forked from scienceystuff/timestamp-bash.sh
Created January 25, 2019 18:22
Show Gist options
  • Save disulfidebond/b88773e7dcc333a89f37af752a8813b6 to your computer and use it in GitHub Desktop.
Save disulfidebond/b88773e7dcc333a89f37af752a8813b6 to your computer and use it in GitHub Desktop.
timestamp in bash
#!/bin/sh
date
# outputs Fri Jan 25 12:10:33 CST 2019
# alternative: add to bash_profile
timestamp() {
date +"%T"
}
# when timestamp is typed into bash, it outputs
# 12:10:25
# alternative 2: format timestamp, this matches the timestamp-py.py gist
date "+%Y.%m.%d.%H.%M.%S"
# 2019.01.25.12.17.07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment