LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-10-2009, 05:39 PM   #1
Linux_coder
LQ Newbie
 
Registered: Apr 2009
Posts: 17

Rep: Reputation: 0
How to change time from console?


Just installed lxde theme, and widget "Digital clock" doesn't allow to change time.
What commands to use in console to change time?
 
Old 04-10-2009, 06:39 PM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,072

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
The command you are looking for is "date".

You probably need to do root to do so. Changing the system time is not a trivial thing as it might seem.
 
Old 04-10-2009, 08:20 PM   #3
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,191

Rep: Reputation: 105Reputation: 105
Another question would be why? Time isn't typically considered arbitrary, and these days it normally isn't set by hand anyway. Assuming you have network, you should have ntpd running. Check `ps -ax | grep ntpd` and see if it shows up. Look at /etc/ntp.conf for its setup. Depending on your distribution, it might have a startup script at /etc/init.d/ntpd. While you probably don't want to read the man page (network time protocol can get bloody complicated), `man ntpd` would at least confirm it is there. If it isn't set up and running, you'll want to google a simple howto for setting up ntpd in linux.
 
Old 04-10-2009, 09:00 PM   #4
zaithyn
LQ Newbie
 
Registered: Apr 2009
Posts: 6

Rep: Reputation: 0
yes, web.config is the key. Take a look at http://systemcenterinfo.blogspot.com...-range-in.html
 
Old 04-11-2009, 05:02 AM   #5
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287
Here's a script I wrote to change the system time:

Code:
#!/bin/sh
# set the system time and date

# make sure we are root
if test ~ != '/root'
then
	echo 'ERROR: You must be root to run this script' >&2
	# fail
	exit 1
fi

# read user input
printf 'Enter month as ## => '
read month
printf 'Enter day as ## => '
read day
printf 'Enter year as #### => '
read year
printf 'Enter hour out of 24 as ## => '
read hour
printf 'Enter minute as ## => '
read minute
printf 'Enter second as ## => '
read second
echo "Press <Enter> when you want to set the time to $month/$day/$year $hour:$minute:$second"
read dummy

# set date and time, and fix hwclock
date -s "$month/$day/$year $hour:$minute:$second"
/sbin/hwclock -r
/sbin/hwclock --adjust
/sbin/hwclock --systohc

echo 'System time is set. Settings will be in full effect on next reboot.'

# success
exit 0
You don't have to use the whole script, if you don't need to prompt the user.
 
Old 04-12-2009, 06:38 AM   #6
Linux_coder
LQ Newbie
 
Registered: Apr 2009
Posts: 17

Original Poster
Rep: Reputation: 0
Thanks, H_TeXMeX_H, but i didn't need it.
Just changed system time from control panel.
 
Old 04-12-2009, 01:01 PM   #7
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287Reputation: 1287
Yeah, ok, but you didn't ask for that, you asked for the "What commands to use in console to change time?", does console = control panel or does console = command-line interface ? = konsole = terminal
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change the time via console? JET-33 Linux - Newbie 6 02-16-2009 11:20 PM
Various clock issues: Clock shows wrong time only in Knoppmyth, & CMOS time change ? davidbix General 1 04-05-2006 09:58 PM
Need ACCESS to change files! Every time I try to change a setting,"Permission Denied" Balarabay1 SUSE / openSUSE 2 03-06-2006 09:54 AM
Daytime Saving time. Cannot change time arubin Linux - General 9 11-06-2004 04:37 PM
how much time are you on the console? gui10 Linux - General 14 04-17-2002 12:28 AM


All times are GMT -5. The time now is 12:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration