Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Since my Ubuntu system has some problem keeping of track of time, I want to add a bash script somewhere that has the ntpdate command in it to reset the time to the correct time when i log in. Where would I put this so the system does this when I login, not boot? Thanks.

share|improve this question

It's common to put commands like this in the ~/.profile script, which is executed at login.

I'd personally recommend using ntpd instead of ntpdate as it is a service which runs in the background and constantly checks and corrects the time.

To install it, run sudo apt-get remove ntpdate to remove ntpdate, then sudo apt-get install ntpd.

share|improve this answer
Both Noted. If you don't mind, how would I go about configuring ntpd once installed? – seanthewebber Nov 5 '12 at 1:36
The default configuration should work out of the box. If it doesn't, you can see the official help pages here – jackweirdy Nov 5 '12 at 12:03

Have you tried adding it to the Startup Applications in your user?

share|improve this answer
I have not, how do you set those? – seanthewebber Nov 5 '12 at 1:22
search for Startup Applications in your dash, i dunno if it has been renamed or w/e. It used to be pretty easy to add a new one. If ntpdate needs sudo however, it might not work.. – Karthik T Nov 5 '12 at 1:23
Would you care to make your answer a bit more elaborate? Comments get removed eventually. – guntbert Feb 14 '13 at 19:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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