Create Directories or Recordsdata Named With Present Date / Time / Month / 12 months


Get real time updates directly on you device, subscribe now.

Have you ever ever wished to create a listing or file and title it the present date/time/month/yr from command line in Linux? This temporary tutorial will educate you the best way to create a listing or file with present timestamp within the title. This will likely be useful once you need to save one thing, for instance photographs, in directories named with date when they’re really taken. For instance, If the photographs have been taken at present, you possibly can create a folder named “05-10-2019”. Creating information with timestamps will make your work simpler to rearrange the information so as. This can even be helpful if you wish to automate the duty utilizing a script. The next instructions will create directories  or information named with present date or time based mostly in your pc’s clock. So be sure to have setup right time in your system.

Create Directories Or Recordsdata Named With Present Date / Time / Month / 12 months In Linux

To create a listing and title it the present date, merely run:

$ mkdir “$(date +”%d-%m-%Y”)”


$ mkdir $(date +”%d-%m-%Y”)

This command will create a listing and title it the at present’s date in dd:mm:yyyy format.

Pattern output:


Create Directories Named With Current Date, Time, Month, Year In Linux

To modify into this listing, merely exchange “mkdir” with “cd” command like under.

$ cd “$(date +”%d-%m-%Y”)”

Equally, to create a file named with present date, time, month, yr, merely exchange “mkdir” with “contact” command:

$ contact “$(date +”%d-%m-%Y”)”

Create directories or information with customized title with present date

What a few customized title for the listing or file with date/time/month/yr? Additionally it is attainable.

$ mkdir$(date +”%d-%m-%Y”)

This command will create a listing named “”.

Create directories or files with custom name with current date

To create a file with customized title:

$ contact$(date +”%d-%m-%Y”)

Create directories of information with ISO format

If you wish to use ISO date format (e.g. 2020-06-06) and ls will checklist them in date order, run:

$ mkdir $(date -I)


$ mkdir $(date +%F)


$ mkdir $(date +”%Y-%m-%d”)

The entire above three instructions will produce the identical consequence.

To create information, simply exchange mkdir with “contact” command.

Extra examples

In order for you solely day of the present date, use:

$ mkdir “$(date +%d)”

This command will solely create the listing with present day within the title. i.e 06.

Equally, you possibly can create directories with present month-only within the title:

$ mkdir “$(date +%m)”

12 months-only:

$ mkdir “$(date +%y)”

This command will title the directories with the final two digits of present yr i.e 20. In order for you the entire yr (2020) within the title, use Y (capital Y).

$ mkdir “$(date +%Y)”

How about directories title with present time? Additionally it is attainable.

$ mkdir “$(date +%r)”

This command will create a folder and title it with present time in hh:mm:ss format.

Pattern output:

’02:59:52 PM IST’

We will even create directories with present minutes and seconds within the title. For instance, the next command will create a listing and title it with present second.

$ mkdir “$(date +%S)”

Right here, S is capital.

To call listing with present minutes, use capital M:

$ mkdir “$(date +%M)”

In all the above examples, we created the directories with numbers on their names. What if you wish to title the directories with precise title of the present day/month like Sunday, October and so forth? It’s easy!

$ mkdir “$(date +%A)”

The above command will create a listing named “Saturday” i.e at present’s title.

create directory with name of current day

To create a listing with title of present month (i.e October), run:

$ mkdir “$(date +%B)”

Right here is the checklist of supported operators that you should utilize to call the directories with present day, month, time, yr, day of week, day of the month, time zone and so forth.

%a locale’s abbreviated weekday title (e.g., Solar)

%A locale’s full weekday title (e.g., Sunday)

%b locale’s abbreviated month title (e.g., Jan)

%B locale’s full month title (e.g., January)

%c locale’s date and time (e.g., Thu Mar three 23:05:25 2005)

%C century; like %Y, besides omit final two digits (e.g., 20)

%d day of month (e.g., 01)

%D date; identical as %m/%d/%y

%e day of month, area padded; identical as %_d

%F full date; identical as %Y-%m-%d

%g final two digits of yr of ISO week quantity (see %G)

%G yr of ISO week quantity (see %V); usually helpful solely with %V

%h identical as %b

%H hour (00..23)
%I hour (01..12)

%j day of yr (zero01..366)

%ok hour, area padded ( zero..23); identical as %_H

%l hour, area padded ( 1..12); identical as %_I

%m month (01..12)

%M minute (00..59)

%n a newline

%N nanoseconds (000000000..999999999)

%p locale’s equal of both AM or PM; clean if not recognized

%P like %p, however decrease case

%q quarter of yr (1..four)

%r locale’s 12-hour clock time (e.g., 11:11:04 PM)

%R 24-hour hour and minute; identical as %H:%M

%s seconds since 1970-01-01 00:00:00 UTC
%S second (00..60)

%t a tab

%T time; identical as %H:%M:%S

%u day of week (1..7); 1 is Monday

%U week variety of yr, with Sunday as first day of week (00..53)

%V ISO week quantity, with Monday as first day of week (01..53)

%w day of week (zero..6); zero is Sunday

%W week variety of yr, with Monday as first day of week (00..53)

%x locale’s date illustration (e.g., 12/31/99)

%X locale’s time illustration (e.g., 23:13:48)

%y final two digits of yr (00..99)

%Y yr

%z +hhmm numeric time zone (e.g., -0400)

%:z +hh:mm numeric time zone (e.g., -04:00)

%::z +hh:mm:ss numeric time zone (e.g., -04:00:00)

%:::z numeric time zone with : to vital precision (e.g., -04, +05:30)

%Z alphabetic time zone abbreviation (e.g., EDT)

For extra particulars, refer man pages.

$ man date
$ man mkdir
$ man contact

Hope this helps.

Advised learn:

Thanks for stopping by!

Assist us that can assist you:

Have a Good day!!

Leave A Reply

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More