Date command in linux

menguin

Geek
Pinoy Techie
Date command is used to set and display date and time of a linux box. Using date command we can customize the date format according to our needs. Using date command we can assign date to our linux machine in two ways

1)Command prompt and
2)GUI.

Most of the linux lovers used to work on command prompt so, I too start explain you how to set and customize date from command prompt/

How to set date and time from command prompt

Syntax:

# date {mmddhhmiyyyy.ss}# date 013122192009.53(or)#date -s ” 24 JUL 2011 00:33:09″
-s option used to set, 24 is the date, JUL is the month, 2011 is the year, 00:33:09 is the current time

How to display the system date and time
#dateSun Jul 24 00:36:18 IST 2011

IST stands for indian standard time

#date +”%a %b %T %Y”
Sun Jul 00:38:19 2011
%a displays day, %b displays Month, %T displays time, %Y displays Time.
#cat /etc/sysconfig/clock —-> Configuration file for clockZONE=”Asia/Calcutta”UTC=trueARC=false
How to change the time zone
#timeconfig
Command used to change the time zone(e.g: “Asia/Calcutta”) information.
Another Method:
TZ=’Asia/Calcutta’; export TZ
Go to command prompt and type this or add this in .bashrc file.
How to view and Change hardware clock time(BIOS)
Command to view what is the current Hardware time (BIOS)#hwclock
Comman to change or customize the Hardware time(BIOS)
#hwclock –set –date “27 Sep 2011 23:01″
 

Top Bottom