Back Up a File with Today's Date in the Name
Make an instant timestamped copy before touching an important file.
01Command
$ cp ~/Documents/config.txt ~/Documents/config-$(date +%Y%m%d).txt02What it does
date +%Y%m%d expands to 20260917-style text right inside the command, so each day's backup gets a unique name and never overwrites yesterday's. Add -p to preserve the original timestamps, or swap the format to +%Y%m%d-%H%M if you back the same file up several times a day. This is the one-line habit that replaces "copy of config-FINAL-v2.txt".
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- cp – Copy filesEvidence: cp copies a file; command substitution $(date +%Y%m%d) stamps the copy with the current date.
Last verified: 2026-09-18 · Category: Files & Folders
06Related solutions
List the biggest files in your home folder that are eating disk space.
Make Finder display .pdf, .docx, .png and every other extension at all times.
See every local APFS Time Machine snapshot on your startup disk and delete ones you no longer need.