diff --git a/Linux/Basic Administration/31-date.md b/Linux/Basic Administration/31-date.md index 1ea66aa..907a1b5 100644 --- a/Linux/Basic Administration/31-date.md +++ b/Linux/Basic Administration/31-date.md @@ -1,4 +1,44 @@ -create epoch time +# Essential Date and Time Manipulation Commands + +This document outlines common shell commands used for working with dates and times, essential for scripting, logging, and system administration tasks. + +## 1. Creating Epoch Timestamps + +The `date` command is versatile for generating timestamps in various formats, most notably the Unix epoch time (seconds since 1970-01-01 00:00:00 UTC). + +### Command to Create Epoch Time (Milliseconds Precision) + +This command converts a specific human-readable date and time into the epoch time, including milliseconds (`%3N`). + ```bash date -d "2026-01-13 14:31:26" +%s%3N -````` \ No newline at end of file +``` + +## 2. Formatting Current Date and Time + +Displaying the current date and time in a readable or specific format. + +| Command | Description | Example Output (Varies) | +| :--- | :--- | :--- | +| `date` | Default display | Wed Jan 17 10:30:00 UTC 2026 | +| `date +'%Y-%m-%d %H:%M:%S'` | Standard ISO format | 2026-01-17 10:30:00 | +| `date +%s` | Current epoch time (seconds) | 1737154200 | + +## 3. Converting Epoch to Human Readable + +Converting a numeric epoch timestamp back into a readable format. + +```bash +# Assuming $EPOCH_TIME holds a value like 1737154200 +date -d @"$EPOCH_TIME" +``` + +## 4. Date Arithmetic + +Calculating dates relative to the current time. + +| Command | Description | Example Output (Varies) | +| :--- | :--- | :--- | +| `date -d "yesterday"` | The previous day | Tue Jan 16 ... | +| `date -d "2 weeks ago"` | Two weeks prior | Thu Jan 03 ... | +| `date -d "+1 hour"` | One hour from now | Wed Jan 17 11:30:00 UTC 2026 | \ No newline at end of file diff --git a/Web-Servers/Nginx/13-openssl.md b/Web-Servers/Nginx/13-openssl.md new file mode 100644 index 0000000..26c7fa4 --- /dev/null +++ b/Web-Servers/Nginx/13-openssl.md @@ -0,0 +1,3 @@ +openssl genrsa -out gitea.key 2048 +openssl req -new -key gitea.key -out gitea.csr +openssl x509 -req -in gitea.csr -signkey gitea.key -out gitea.crt