Basic examples for the Linux date command (learnbyexample.github.io)
from learnbyexample@programming.dev to linux@lemmy.ml on 13 Aug 2024 10:08
https://programming.dev/post/18070256

I rarely ever use the date command, but when I need it I almost always struggle to get the right incantation. So, wrote a blog post for easy reference.

Do you use a cheatsheet as well?

#linux

threaded - newest

quantenzitrone@lemmings.world on 13 Aug 2024 10:24 next collapse

the manpage has me covered tbh

Vector@lemmy.world on 13 Aug 2024 11:08 next collapse

I thought that was…

mandated

YyyYyYeeeaaaAaaAaaAhhHhHhhhHH

CubitOom@infosec.pub on 13 Aug 2024 13:06 collapse

After a man date, I like to do a man touch and man mount.

SweetCitrusBuzz@beehaw.org on 13 Aug 2024 11:01 next collapse

Thanks for posting this. Exmples are very useful.

Deckweiss@lemmy.world on 13 Aug 2024 11:10 next collapse

Try the tldr util on linux.

atzanteol@sh.itjust.works on 13 Aug 2024 13:03 next collapse

LLMs do this pretty well. I’ve used them for date/time formatting strings across a number of languages.

nyan@sh.itjust.works on 13 Aug 2024 13:49 next collapse

date is the command for setting the system date and time from the command line. Nothing to do with formatting, beyond the fact that it presumably applies system locale settings when echoing date-time info.

atzanteol@sh.itjust.works on 13 Aug 2024 13:57 next collapse

 date +%Y-%m-%d
IsoKiero@sopuli.xyz on 13 Aug 2024 15:18 collapse

$ whatis date

date (1) - print or set the system date and time

JackbyDev@programming.dev on 13 Aug 2024 14:44 collapse

They once wrote me a massive script for parsing a history file instead of telling me about history -i

atzanteol@sh.itjust.works on 13 Aug 2024 17:06 collapse

The other “real person” who replied to me told me that the Linux date command has nothing to do with formatting.

JackbyDev@programming.dev on 13 Aug 2024 17:32 collapse

Second sentence of the description from the man pages, “Otherwise, depending on the options specified, date will set the date and time or print it in a user-defined way.” not sure what they were on about.

atzanteol@sh.itjust.works on 13 Aug 2024 20:29 collapse

Right - I’m just saying that it’s super annoying that people point out times that llms have been wrong as though humans are never wrong, or even aren’t wrong frequently.

JackbyDev@programming.dev on 13 Aug 2024 21:01 collapse

I get that. It’s funny I think I’ve gotten advice in the past to always check the results of search engines because they can be wrong (as in teachers said it to me) or things about Wikipedia being unreliable. But nobody does those things nowadays. Perhaps someday LLMs will be good enough that we don’t need to check them either.

loaExMachina@sh.itjust.works on 13 Aug 2024 15:46 next collapse

Saving this post in case I ever get a date.

bobthecowboy@lemmy.world on 13 Aug 2024 17:43 collapse

I’m addition to tldr which someone else suggested, there’s also the cheat command. It’s pretty easy to add to it’s cheat sheets, if you have custom commands, or want to keep a specific example. I’ve never kept a physical cheat sheet… They’re just too inconvenient and my fingers are probably already at the keyboard.