Linux date Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux date Guide
Complete beginner-friendly guide to date on Linux, covering Arch Linux, CachyOS, and other distributions including date display, date formatting, and date manipulation.
Table of Contents
date Basics
Current Date
Basic usage:
# Show current date
date
# Displays current date and time
Formatted Date
Custom format:
# Custom format
date +"%Y-%m-%d"
# Output: 2024-01-15
Date Display
ISO Format
ISO 8601:
# ISO format
date -I
# Output: 2024-01-15
RFC Format
RFC 2822:
# RFC format
date -R
# Output: Mon, 15 Jan 2024 10:30:00 +0000
Date Formatting
Format String
Custom format:
# Format string
date +"%Y-%m-%d %H:%M:%S"
# Output: 2024-01-15 10:30:00
Common Formats
Useful formats:
# Year-Month-Day
date +"%Y-%m-%d"
# Day/Month/Year
date +"%d/%m/%Y"
# Full date
date +"%A, %B %d, %Y"
⏰ Date Manipulation
Set Date
Change date:
# Set date (requires root)
sudo date -s "2024-01-15 10:30:00"
# -s = set (sets system date)
Relative Dates
Add/subtract:
# Tomorrow
date -d "tomorrow"
# Next week
date -d "next week"
# 5 days ago
date -d "5 days ago"
Troubleshooting
date Not Found
Check installation:
# date is part of coreutils
# Usually pre-installed
# Check date
which date
Summary
This guide covered date usage, date formatting, and date manipulation for Arch Linux, CachyOS, and other distributions.
Next Steps
- cal Guide - Calendar display
- timedatectl Guide - Time management
- Time Synchronization - Time sync
- date Documentation:
man date
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.