Linux Unix Timestamp Commands

Linux Unix Timestamp Commands — Copy the right Linux or macOS date command to create, inspect, and convert Unix timestamps in seconds.

Free in your browserCopy-ready resultsNo sign-up
Live tool

Linux Unix Timestamp Commands

Works locally

Unix timestamp Linux commands

Linux · macOS

Generate and convert Unix timestamps with the standard date command.

Current Unix secondsdate +%s
Current Unix millisecondsdate +%s%3N
Convert timestamp to date (GNU/Linux)date -d @1700000000
macOS alternativedate -r 1700000000
About this tool

Terminal commands.
Ready to run.

The Unix date command is the quickest way to inspect time from a Linux or macOS terminal. It can print the current epoch seconds, format a date, and convert an epoch value back into a human-readable timestamp. These commands are especially useful in deployment scripts, shell pipelines, cron jobs, incident response, and debugging sessions where opening a separate application would slow you down.

GeoTimeTools collects the most useful Unix timestamp commands in one place. Use date +%s for current seconds, date +%s%3N on GNU/Linux for milliseconds, date -d @TIMESTAMP to convert a value on GNU date, and date -r TIMESTAMP for the BSD date command used by macOS. Enter your own timestamp to update the conversion commands without manually replacing the number in each line.

Linux and macOS share many Unix conventions but their date utilities are not identical. GNU date supports the -d flag, while BSD date uses -r for reading an epoch value. Keeping both commands visible prevents a common copy-and-paste failure when a script moves between a Linux server and a local Mac. The page favors small, labelled code blocks so each command has a clear purpose.

Current seconds and milliseconds

The +%s format prints the number of seconds since the Unix epoch. GNU date can append %3N to print milliseconds, but BSD date does not support the same nanosecond format sequence. For portable scripts, decide whether your target is Linux, macOS, or both before choosing a command.

Converting an existing timestamp

On GNU/Linux, date -d @1700000000 reads the number after the @ as epoch seconds. On macOS, date -r 1700000000 performs the equivalent conversion. Replace the example with your value and include the timezone or format flags you need for a script.

Frequently asked

Questions,
answered.

How do I get the current Unix timestamp in Linux?

Run date +%s in a Linux or macOS terminal. For GNU date milliseconds, use date +%s%3N.

How do I convert a Unix timestamp with date?

Use date -d @TIMESTAMP for GNU/Linux or date -r TIMESTAMP on macOS.

Does the Linux date command work on macOS?

macOS uses BSD date, so some GNU date flags differ. The page includes both command styles.

Copied