I accidentally edited the "date" utility and now it doesn't work. Is there a shell script or something I can use to restore it?
I use Fedora 15. As part of a class project I accidentally edited the "date" utility. Any suggestions on how to restore it?
Use your distro's package manager to reinstall/restore the original version...
Use your distro's package manager to reinstall/restore the original version or build of the executable you fubared. With Fedora and `date` having been lost,
yum reinstall coreutils
should fix your problem.
I'm not sure what you mean by editing the date utility. The command "date"...
I'm not sure what you mean by editing the date utility. The command "date" is a system binary and editing it would have been rather unusual.
If you changed your system clock, your desktop environment will allow you to adjust it, and if you don't use a desktop the command line tool "date" will allow you to set the system clock, too:
date MMDDhhmmYYYY (2 digit month, 2 digit day, 2 digit hour, 2 digit minute, 4 digit year)
You may also have a network time utility on your system. Try using ntpdate pool.ntp.org to sync your clock, but if your time is far off, it may not allow you to do that until you manually set it closer.
Regardless of how you set your system time, use hwclock -w to save it to the hardware clock after you set it.
If you adjusted the timezone, your desktop environment will also allow you to adjust it. To change timezone from the command line, first determine if /etc/localtime is a sym link (shortcut) or a file using this:
If it's a file, find the appropriate timezone file under /usr/share/zoneinfo/xxx/xxx and copy it to /etc/localtime. If it's a link, rm /etc/localtime then ln -s /usr/share/zoneinfo/xxx/xxx /etc/localtime ... of course finding the correct path for your area under the zoneinfo directory.