How to Use the date Command in Linux: Step-by-Step Tutorial

preview_player
Показать описание
It's time to Learn Linux! The Linux Crash Course series on Learn Linux TV takes you through a valuable Linux-related concept, one video at a time. In this episode, Jay covers the date command.

*LEARN LINUX TV - YOUR HOME FOR LINUX-RELATED FUN AND LEARNING!*

*🎓 BRAND NEW UDEMY COURSES AVAILABLE!*
Check out my new courses on Udemy and learn something new!

*🐧 SUPPORT LINUX LEARNING!*
_Note: Royalties and/or commission is earned from each of the above links_

*🎓 FULL LINUX COURSES FROM LEARN LINUX TV*

*🕚 Time Codes*
00:00 - Intro
01:49 - Basic usage of the date command
03:21 - Using the date command within other commands
04:21 - Output formatting with the date command
09:48 - Setting the date and time
11:51 - Fun game: On what week day were you born?

*📘 FAQ*

*🌐 LEARN LINUX TV ON THE WEB*

*⚠️ DISCLAIMER*
Learn Linux TV provides technical content that will hopefully be helpful to you and teach you something new. However, this content is provided without any warranty (expressed or implied). Learn Linux TV is not responsible for any damages that may arise from any use of this content. Always make sure you have written permission before working with any infrastructure and that you are compliant with all company rules, change control procedures, and local laws.

#CloudComputing #DevOps #Linux
Рекомендации по теме
Комментарии
Автор

OH!!
and a created a shortcut to display date&time rapidly!!
mate-terminal -- bash -c "date +%d.%m.%Y-%H:%M:%S; exec bash"

I freaking love your videos!!!!

TheCârtiță
Автор

@ time 9:45 you show the formatting options chart. But %h says "same as %b", but I don't see %b anywhere on the chart.

javabeanz
Автор

Happy belated birthday, 11 days since you recorded.

javabeanz
Автор

I believe you should have mentioned in this video the way of setting the time zone that is much more commonly used compared to setting the time.
Happy Birthday 🎉

yaroslav
Автор

Hey, I'll be swapping over from Win10 to Linux sometime in 2025 before Win10 end of support and was wondering what Linux users generally do in regards to antivirus software. Are there popular options for Linux or are antivirus software not usually needed for various reasons?

yourlocalsadman
Автор

Happy birthday! I found date is super useful in crontab scripts when you need to do something like run on the last day of the month


if [ "$(date -d tomorrow +\%d)" == "01" ]
then

BrianRussell
Автор

If I enter the "what day of the week" example like this: date +%A -d "" leaving the space between the quotation marks for the date blank it returns "Wednesday" Weird.

pestpatroller
Автор

Happy belated birthday!
Thanks for the video. Even though I thought I " knew it all" when it came to the date command, you managed to teach me something new, as always: date -r
I'm going to write a bash script around that because I wanted an easy way to check if a certain file I reference often was current. Sure, I could use ls -l, but I think date -r meets my needs better.

QHPRN
Автор

Best wihes, Jay. Your videos are always interesting

Автор

Thanks Jay, great guide as always

Happy Birthday :)

sussusamogus
Автор

Can you please prepare LPIC-1 course, I would really appreciated .

abdullahisamiir
Автор

date +%Y%m%d is one of the date commands with formatting I use the most. It prints the ISO formatted date of YEARMonthDay and is incredibly useful in scripting to do things like extensions on file names or dated entries. Throw in %H%M as well at the end and you can include the hour and minute for your entry as well. If you need more granularity, there are of course seconds, but also partial seconds which might be interesting on more busy systems.

scottmcbrien
Автор

Hi Jay, can I ask what's running on the left side of your monitor in the background?
Also happy belated birthday!

jacobhenriksen
Автор

This is so great! I never knew I could date my computer! Is there also a marry command?

TheChadXperience
Автор

Thanks a ton for this Jay! Happy Birthday!

michelesherokee
Автор

I watched this video on my birthday. 😂

susanpinochet
Автор

I found a way to navigate android phone files and i proceed to copy them (as much as possible because permission denial)
I want to backup the boot.img at some point and then post it for backup for my specific model
Anyone wanna help?
Update
Found the difference between android base linux files and copied files, can anyone help with rooting to access everything so we make/copy/extract the boot.img? here is the output
this should be in the oroginal /etc my android
sending incremental file list
etc/
etc/.pwd.lock
etc/adduser.conf
etc/bash.bashrc
etc/bindresvport.blacklist
etc/debconf.conf
etc/debian_version
etc/deluser.conf
etc/e2scrub.conf
etc/environment
etc/fstab
etc/gai.conf
etc/group
etc/gshadow
etc/host.conf
etc/hostname
etc/hosts
etc/issue
etc/issue.net
etc/ld.so.cache
etc/ld.so.conf
etc/legal
etc/libaudit.conf
etc/login.defs
etc/lsb-release
etc/machine-id
etc/mke2fs.conf
etc/netconfig
etc/networks
etc/nsswitch.conf
etc/os-release -> ../usr/lib/os-release
etc/pam.conf
etc/passwd
etc/profile
etc/resolv.conf
etc/rmt -> /usr/sbin/rmt
etc/shadow
etc/shells
etc/subgid
etc/subuid
etc/sudo.conf
etc/sudo_logsrvd.conf
etc/sudoers
etc/sysctl.conf
etc/xattr.conf
etc/alternatives/
etc/alternatives/README
etc/alternatives/awk -> /usr/bin/mawk
etc/alternatives/nawk -> /usr/bin/mawk
etc/alternatives/pager -> /bin/more
etc/alternatives/rmt -> /usr/sbin/rmt-tar
etc/alternatives/which -> /usr/bin/which.debianutils
etc/apt/
etc/apt/sources.list
etc/apt/apt.conf.d/


etc/apt/apt.conf.d/70debconf
etc/apt/auth.conf.d/
etc/apt/keyrings/
etc/apt/preferences.d/
etc/apt/sources.list.d/
etc/apt/trusted.gpg.d/


etc/cron.d/
etc/cron.d/e2scrub_all
etc/cron.daily/
etc/cron.daily/apt-compat
etc/cron.daily/dpkg
etc/default/
etc/default/rsync
etc/default/useradd
etc/dpkg/
etc/dpkg/dpkg.cfg
etc/dpkg/dpkg.cfg.d/
etc/dpkg/dpkg.cfg.d/excludes
etc/dpkg/origins/
etc/dpkg/origins/debian
etc/dpkg/origins/default -> ubuntu
etc/dpkg/origins/ubuntu
etc/gss/
etc/gss/mech.d/
etc/init.d/
etc/init.d/hwclock.sh
etc/init.d/procps
etc/init.d/rsync
etc/kernel/
etc/kernel/postinst.d/
etc/ld.so.conf.d/

etc/ld.so.conf.d/libc.conf
etc/logrotate.d/
etc/logrotate.d/alternatives
etc/logrotate.d/apt
etc/logrotate.d/dpkg
etc/opt/
etc/pam.d/
etc/pam.d/chfn
etc/pam.d/chpasswd
etc/pam.d/chsh
etc/pam.d/common-account
etc/pam.d/common-auth
etc/pam.d/common-password
etc/pam.d/common-session

etc/pam.d/login
etc/pam.d/newusers
etc/pam.d/other
etc/pam.d/passwd
etc/pam.d/runuser
etc/pam.d/runuser-l
etc/pam.d/su
etc/pam.d/su-l
etc/pam.d/sudo
etc/pam.d/sudo-i
etc/profile.d/

etc/rc0.d/
etc/rc1.d/
etc/rc2.d/
etc/rc2.d/S01rsync -> ../init.d/rsync
etc/rc3.d/
etc/rc3.d/S01rsync -> ../init.d/rsync
etc/rc4.d/
etc/rc4.d/S01rsync -> ../init.d/rsync
etc/rc5.d/
etc/rc5.d/S01rsync -> ../init.d/rsync
etc/rc6.d/
etc/rcS.d/
etc/rcS.d/S01procps -> ../init.d/procps
etc/security/
etc/security/access.conf
etc/security/faillock.conf
etc/security/group.conf
etc/security/limits.conf
etc/security/namespace.conf
etc/security/namespace.init
etc/security/opasswd
etc/security/pam_env.conf
etc/security/sepermit.conf
etc/security/time.conf
etc/security/limits.d/
etc/security/namespace.d/
etc/selinux/
etc/selinux/semanage.conf
etc/skel/
etc/skel/.bash_logout
etc/skel/.bashrc
etc/skel/.profile
etc/sudoers.d/
etc/sudoers.d/README
etc/sysctl.d/





etc/sysctl.d/10-ptrace.conf
etc/sysctl.d/10-zeropage.conf
etc/sysctl.d/README.sysctl
etc/systemd/
etc/systemd/system/
-> /dev/null

->

->
->
->
->
->
->
etc/systemd/user/
etc/terminfo/
etc/terminfo/README
etc/update-motd.d/
etc/update-motd.d/00-header




sent 5, 503 bytes received 606 bytes 12, 218.00 bytes/sec
total size is 135, 001 speedup is 22.10 (DRY RUN)

TheCârtiță