Home Learn Linux Linux Answers Systems Management 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'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 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:

    file /etc/localtime

    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.

    Answered by tdr
    2 years ago
    0 0
  • 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.

    Answered by colo
    2 years ago
    0 0
Please register/login to answer this question. Click here to login
Similar Questions Found
Questions from category Systems Management

Upcoming Linux Foundation Courses

  1. LFD211 Introduction to Linux for Developers
    09 Feb » 10 Feb - Virtual
  2. LFD411 Embedded Linux Development
    09 Feb » 13 Feb - Mississauga - ON
  3. LFD312 Developing Applications For Linux
    16 Feb » 20 Feb - Atlanta - GA

View All Upcoming Courses

Community Answers - Search

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board