Linux set date and time from command prompt

Posted by Jiltin     9 November, 2008    4,320 views   

Q. How can I set the system date and time from the command prompt (bash shell)? I don’t have GUI installed and I am login over ssh session.

A. Use date command to display the current date and time or set the system date and time over ssh session.

This is useful if the Linux server time and/or date is wrong, and you need to set it to new values from the shell prompt.

Task: Set new date / time

Use the following syntax to set new data and time:
date set=”STRING”

For example, set new data to 2 Oct 2006 18:00:00, type the following command as root user:

> date -s “2 OCT 2006 18:00:00″

> date -s “10 NOV 2008 08:08:00″

=================================

Run the date command to make sure you have the correct time:

[root@server /root]# date
Thu Sep 20 11:00:06 CDT 2001
[root@server /root]#

If you have the wrong timezone set, use “timeconfig” or “linuxconf” to set the correct timezone.

If your timezone is correct but the date and/or time needs updating, the following commands will update the date and time. The second command is needed in order to push the date and time into the PC clock.

[root@server /root]# date 092011082001
Thu Sep 20 11:08:00 CDT 2001
[root@server /root]# hwclock --utc --systohc
[root@server /root]#

Following Google Searches Lead To This Post: how to correct date in linux
show time and linux command
setting date and time on linux command prompt
linux set date
linux date UTC+5
unix and changing EDT to EST
linux showing EDT as timezone
linux setting edt
unix+”set date”+command
setting date and time on linux from c#.net
linux “date set”
linux date -r with timezone bash script
linux set time command
linux date command update
linux date command
set linux date and time to est
linux display timezone command
set timezone for India from Command Prompt in windows
time EDT linux
changing date on linux machines + EST
change date linux +sample
change date and timezone unix command
linux date command how to change the time from command line
linux change systime date usage
UTC to EST linux
to lunch date and time on linux
linux “change date time
bash date command
set linux server time ssh
what is command to change time in linux ES
firestats wrong date and time
date linux set
setDate setTime
set date in linux without root
change server time using date command
command to set datetime in oracle?
setting time example linux
ssh linux chance date time
date cdt
Linux and “set system date”
linux date wrong
linux date set
command to display the current date linux
linux date set from server
extract timezone from date command in unix shellscript
set system date time timezone bash
linux date sintax 24h
date commant to reset date + linux
set current date command + unix
linux funcion date set
linux date command examples
how to change linux date and time in one command
command prompt for date and time
How to set LINUX time using PHP
set time linux c++
date command prompt
unix shell command to set timezone
how to set time date bash script Linux
date and time commands in oracle
show time on prompt +unix
“change date linux”
linux set date function
set previous date command prompt
linux time without root
set prompt in c linux
how to set linux date
linux c++ set clock
set date in linux c
c++ linux set system date
date utc est linux
linux commands change time from UTC to CST
update date time linux cmd
how to set EST time in linux
time commands in C++
linux set date time
set date linux
how to change date time calendar command in linux
sample command when changing server time in linux
how to set server time in bank in php
linux set only date from shell
google linux date set
command to change the sys time linux
set date time command example in linux
linux set time EDT
linux commands set zone
commande date for linux
linux set `date`
linux set time crash
linux date samples
“changing date in linux”
linux set date only
linux timezone EDT CDT
change time zone in linux +cdt
linux set time zone in shell script
command to show linux system time
UTC time in linux c
Linux date command wrong timezone
bash change system date
Shell script to change time in linux
cmd to change date in linux
replacements for Linux command date
set date usage
linux date and time change command
date command+EST
change date and time from command line linux
reset date linux
linux date command operations
changing server time for oracle apps on linux
linux change est to utc
linux php change server date
change prompt to the current date followed by $ in unix
change CDT en linux
BASH set date commnad
howto-set-date-time-from-linux-command-prompt
update date linux cmd
linux timezone C++
prompt date time
linux change date
set date Oracle Linux
linux date set est timezone how to
c set time linux
linux + set date
how to set system time in linux using c++
linux set date C++
setting date and time on linux ssh
linux set timezone est
examples of set the timer in linux
linux setdate
set date on linux

Post to Twitter  Post to Delicious  Post to Digg    Post to StumbleUpon

Categories : Scripts Unix Tags : , , , ,

Comments
June 9, 2009

That was a very nice post, I

Posted by Aargaard
Leave a comment

(required)

(required)