by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 6 years ago )

The command is different on MacOS or Linux, but can achieve the same effect.
Let's see how to display yesterday's date with the date command.

On MacOS, we pass the following command:
date -v -1d +'%Y-%m-%d'

On Linux:
date -d 'yesterday' +'%Y-%m-%d'

Tags: linux cli

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


linux

Load the environment variables of .env to the system

Load the environment variables of .env to the system

bash,cli

some commands to check cpu, ram and disk info in linux

Introduce those commands that can be used to check hardware information on the Linux host

linux

How rsync automatically allows ssh key fingerprints

When we use ssh to connect to the host for the first time, a fingerprint confirmation of the host key will be displayed. Sometimes use rsync for some automated scheduling, maybe the remote host has changed and needs to be automatically allowed, How to let ssh automatically allow fingerprints to connect without manually pressing yes in interactive mode?