HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

faketime — Fake the system time for a command. More information: <https://manned.org/faketime>.

Submitted by: @import:tldr-pages··
0
Viewed 0 times
thecommandfakeclitimefaketimeforsystem
linux

Problem

How to use the faketime command: Fake the system time for a command. More information: <https://manned.org/faketime>.

Solution

faketime — Fake the system time for a command. More information: <https://manned.org/faketime>.

Fake the time to this evening, before printing the result of date:
faketime '{{today 23:30}}' {{date}}


Open a new Bash shell, which uses yesterday as the current date:
faketime '{{yesterday}}' {{bash}}


Simulate how a program would act next Friday night:
faketime '{{next Friday 1 am}}' {{path/to/program}}

Code Snippets

Fake the time to this evening, before printing the result of `date`

faketime '{{today 23:30}}' {{date}}

Open a new Bash shell, which uses yesterday as the current date

faketime '{{yesterday}}' {{bash}}

Simulate how a program would act next Friday night

faketime '{{next Friday 1 am}}' {{path/to/program}}

Context

tldr-pages: linux/faketime

Revisions (0)

No revisions yet.