Exploring Date Commands in Linux

In this article, we will see various options available in the "date" command.

So let's begin.

No alt text provided for this image

date

date command shows the current date and time.

No alt text provided for this image

date -u

date -u command shows the current date and time.

No alt text provided for this image

date --date="string"

This command shows the date as per the string passed in it. It can be used to display previous dates or date on a particular day.

No alt text provided for this image

date -r <filename> or date --reference=<filename>

This command show the last modification time and date of any file.

No alt text provided for this image

date "+%a"

This command shows the current day name in abbreviation. These commands are generally known as date formats. Other than %a there are many options available like this, e.g. - %m, %M, %y, %B, etc.

All these options have different uses. You can go to the manual page by typing "man date" of date command and check their usage. You can also use multiple date formatters at the same time to display the date and time as you want.

No alt text provided for this image

So, friends, that's all here.

Hope You like it and found it useful :)

To view or add a comment, sign in

More articles by Adil Ansari

  • AWS Lambda Use Cases (Serverless Computing)

    Hello Everyone, long time no see..

    6 Comments
  • Creating Our Own Art Using CV2 and Numpy

    Hello All, It has been months passed since I've not written any article. But now, I am back with a fun topic of…

    4 Comments
  • Fixed Capacity Queue

    Hello all, I am back with a new article on Fixed Capacity Queue and its use cases. So let's started.

    3 Comments
  • String Template and Do While Loop in Python3

    String Template Template is a class in module 'string' that is used to make a string template or we can say a blueprint…

    3 Comments
  • Capture and Crop Video using OpenCV

    OpenCV is a powerful library available for multiple languages. In this tutorial I have used python as a programming…

    12 Comments
  • Why malloc() gives more than asked memory | Dynamic Memory Allocation

    Dynamic Memory Allocation is one of the memory management processes in which we can change/modify the size of a data…

    2 Comments
  • Creating Docker Image for ML Project

    In this article, we will see how we can create a custom docker image for an ML algorithm and as soon as the code gets…

    10 Comments
  • Crop and Swap images using OpenCV

    OpenCV is a computer vision library. It enables many operations to be performed on images and videos, and today we are…

    10 Comments
  • Run GUI App in Docker

    Hello Everyone, In this article, I am going to show you how you can run GUI application inside a docker container. So…

    9 Comments

Explore content categories