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 Answers 2

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.

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .