Skip to content

Instantly share code, notes, and snippets.

@scienceystuff
Created January 25, 2019 18:17
Show Gist options
  • Save scienceystuff/9c8f7954b3109556f04709c0031ceec2 to your computer and use it in GitHub Desktop.
Save scienceystuff/9c8f7954b3109556f04709c0031ceec2 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