1

I've used RedHat servers before and now I've just installed Ubuntu Server.

I noticed that the date format in Ubuntu logs is different from in RedHat.

When I use the date command it showd

Wed  May 30 20:00 2012

I want to change it to

2012.5.30.20:00

How can I do that?

2

You can make an alias for date in .bashrc by typing alias date='date +%Y.%m.%d.%R' and then doing source .bashrc, if you want to change date default format.

| improve this answer | |
1
date --help

and

man date

both explain how to define a custom format for the output of the date command.

What you're looking for can be found with

date +%Y.%m.%d.%R

with everything after the + being the string to output with the variables from the current date.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.