About Linux FAQ

Browse More FAQs:

Linux set date and time from command prompt

Posted by Vivek on Monday October 2, 06 @6:21 pm

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"

You can also set new timzone using this mini-howto.

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Linux / UNIX FAQ:

Discussion on This FAQ

  1. Johan Dalevi Says:

    Found out i had to set the date like this:
    # date -s 2007.04.08-22:46+0000

  2. mani Says:

    How can I set the proxy setting from the command prompt (bash shell)?

  3. raju Says:

    Just This code is ultimate.It is simple and worth full.Thank you very much providing help to people.

  4. kiran Says:

    It Work’s Thanks a Lot,

    Kiran.

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Please do not use the comment form to ask for help / question. Ask your question on the excellent Linux tech support forum. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Tags: , , , , , , , , , , , , , , , , ~ Last updated on: March 12, 2008

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.