ducky
ducky

Reputation: 537

How to temporary adjust date/time in Linux shell

I want to write some testscripts that create some files and execute commands that change behaviour depending on the current date. For testing purposes I would like to change the time to different dates (in the past and future) and check the behaviour.

Is it possible to change the date exclusively just for a singe shell-session, or fool a single application about the current date? - how could this be done?

Upvotes: 6

Views: 1985

Answers (1)

Dan D.
Dan D.

Reputation: 74645

this can be done to a program with libfaketime which is preload library i.e. LD_PRELOAD.

Upvotes: 7

Related Questions