We recently ran an हमने हाल ही में एक भागा article लेख on the Linux “date” command. पर लिनक्स "तारीख" कमांड. It's a pretty cool command line tool that allows you to get your system's date and time in various formats. यह एक सुंदर शांत कमांड लाइन उपकरण है कि आप अपने सिस्टम की तारीख और विभिन्न स्वरूपों में समय मिल करने की अनुमति देता है. What it also does is it allows you to set the machine's date and time. क्या यह भी होता है यह तुम्हारे है मशीन की तारीख और समय सेट करने देता है. Let's look at a couple of ways to set the time and date on a Linux machine. तरीकों के लिए एक Linux मशीन पर समय और तारीख तय की एक जोड़ी में देखें. First, we'll look at how to do it using the “date” command, then I'll briefly introduce you to the NTP server in Linux and show you how you can sync your machine's clock to a clock running on the Internet. सबसे पहले, हम में देख लेंगे यह कैसे की तारीख "" कमांड का प्रयोग तो मैं आपको संक्षेप में लिनक्स में राष्ट्रीय क्षयरोग कार्यक्रम सर्वर से मिलवाता हूँ और तुम्हें दिखाने तुम कैसे सिंक अपने मशीन एक इंटरनेट पर चल रहे घड़ी के अनुसार घड़ी कर सकता है.
First, a brief recap on what the “date” command can do for you: पहला, एक संक्षिप्त संक्षिप्त क्या कमान की तारीख "" तुम्हारे लिए क्या कर सकते हैं पर:
# date # तारीख
Mon Dec 22 22:35:58 IST 2008 सोम दिसम्बर 22 22:35:58 IST 2008
Now if you want to change the machine's date to 1:45 PM on Christmas day in the year 2008, here's how you would do it: अब अगर आप को वर्ष 2008 में क्रिसमस के दिन पर 1:45 पर है मशीन की तारीख बदलना चाहते हैं, यहाँ है कि तुम इसे कैसे करना होगा:
# date -s “25 DEC 2008 13:45:00″ -S "25 DEC 2008 13:45:00 तिथि" #
Thu Dec 25 13:45:02 IST 2008 Thu दिसम्बर 25 13:45:02 IST 2008
This above command is pretty self-explanatory. इस संस्करण की कमान बहुत स्पष्ट है. But to make it clear, here's the breakup. लेकिन बनाने के लिए यह स्पष्ट है, यहाँ अव्यवस्था है. First comes the “date” command. पहले "तारीख" कमांड आता है. Then you use the “-s” option, which stands for “set date”. तो फिर तुम 's "विकल्प है, जो' के लिए तारीख तय खड़ा का उपयोग करें." After that you enter the date you want to set in the following order. उसके बाद तुम तारीख आप निम्नलिखित क्रम में स्थापित करना चाहते दर्ज करें. “Date Month Year Hours:Minutes:Seconds”. "दिनांक महीना वर्ष घंटे: मिनट: सेकंड. After entering this hit the return key. प्रवेश करने के बाद यह वापस प्रमुख मारा. The system should revert with the new date. नई प्रणाली की तारीख के साथ वापस चाहिए. Now you can enter the “date” command once again to make sure that the date is set right. अब तुम तारीख "प्रवेश" एक बार फिर से कमांड को विश्वास है कि सही तारीख तय कर सकता है.
There are a number of other ways to do this same thing. वहाँ अन्य तरीकों से इस एक ही बात है की एक संख्या हैं. As you might have read in my previous article about the “date” command, it is pretty versatile. जैसा कि आप की तारीख "के बारे में मेरे पिछले लेख में पढ़ा है शायद" कमांड, यह सुंदर बहुमुखी है. You can do something similar as what we just tried above with a slightly different syntax: तुम क्या हम एक से थोड़ा अलग वाक्य रचना के साथ इसके बाद के संस्करण की कोशिश के रूप में ऐसी ही कुछ कर सकते हैं:
# date +%Y%m%d -s “20081225″ तारीख # +% Y% मी% d-20081225 s ""
This will set the system's date to the 25th of December, 2008. यह दिसंबर, 2008 के 25 वीं के लिए सिस्टम के तारीख तय करेंगे.
The other method I use to set my computer's date is using the NTP server. अन्य विधि मैं अपने कंप्यूटर की तारीख तय उपयोग एनटीपी सर्वर का उपयोग कर रहा है. NTP stands for Network Time Protocol. राष्ट्रीय क्षयरोग कार्यक्रम नेटवर्क टाइम प्रोटोकॉल के लिए खड़ा है. NTPd is a daemon that runs on most Linux machines. NTPd एक डेमॉन है कि ज्यादातर Linux मशीन पर चलता है. When configured correctly this daemon allows you to connect to a Time server over the network (your local network or the Internet) and synchronize the time. जब सही ढंग से कॉन्फ़िगर इस डेमॉन आप नेटवर्क पर एक समय सर्वर से कनेक्ट करने की अनुमति देता है (अपने स्थानीय नेटवर्क या इंटरनेट) और समय सिंक्रनाइज़. It's very commonly used for production servers. यह बहुत सामान्य उत्पादन सर्वरों के लिए किया है.
It's pretty likely that your Linux machine is already equipped with NTP. यह बहुत संभव है कि आपके Linux मशीन पहले से ही राष्ट्रीय क्षयरोग नियंत्रण कार्यक्रम के साथ सुसज्जित है. If not, install it using your system's preferred installation method. अगर नहीं स्थापित करें, यह आपके सिस्टम के पसंदीदा अधिष्ठापन पद्धति का उपयोग करके.
Ubuntu users can use the following command: Ubuntu उपयोगकर्ताओं को निम्न कमांड का प्रयोग कर सकते हैं:
# sudo apt-get install ntpdate # उपयुक्त-मिल ntpdate स्थापित sudo
Fedora users can probably use this: Fedora उपयोगकर्ता संभवतः इस का उपयोग कर सकते हैं:
# yum install ntp # Yum स्थापित राष्ट्रीय क्षयरोग कार्यक्रम
Once NTPd is installed on your computer open the file /etc/ntp.conf in your favorite text editor. एक बार NTPd आपके कंप्यूटर पर स्थापित अपने पसंदीदा पाठ संपादक में फ़ाइल खोलने के / etc ntp.conf / है. In this file locate a line containing the “server” parameter. इस फ़ाइल में एक सर्वर "युक्त" पैरामीटर पंक्ति ढूँढें. Set it to the following address: यह निम्नलिखित पते पर सेट करें:
server pool.ntp.org सर्वर pool.ntp.org
Save the file and restart your NTP server. फ़ाइल सहेजें और अपने राष्ट्रीय क्षयरोग कार्यक्रम सर्वर पुनः आरंभ करें.
# /etc/init.d/ntpd restart # / Etc / init.d ntpd / पुनः आरंभ
You can now synchronize your machine to the time server you just configured: अब आप समय सर्वर कॉन्फ़िगर तुम सिर्फ अपने मशीन सिंक्रनाइज़ कर सकते हैं:
# ntpdate pool.ntp.org # Pool.ntp.org ntpdate
22 Dec 23:07:00 ntpdate[24328]: step time server 123.108.39.80 offset 172868.246157 sec दिसम्बर 22 23:07:00 ntpdate [24328]: कदम समय सर्वर 123.108.39.80 172868,246157 सेकंड ऑफसेट
Now your machine will quickly talk to the time server you assigned it and get you the right time. अब आप अपने मशीन जल्दी समय सर्वर तुम और तुम सही समय मिल सौंपा से बात करूँगा. This way you know for sure that the time on your machine is accurately set. इस तरह तुम्हें यकीन के लिए पता है कि आपकी मशीन पर निर्धारित समय सही है. It may be a good idea to run this command every once in a while to make sure you're on time. यह एक अच्छा विचार के लिए इस कमांड चलाने के हर एक समय में एक बार होना सुनिश्चित हैं कि आप समय पर हो कर सकते हैं.























For my Debian boxes I usually use the following after a Net Install: मेरी डेबियन बक्से के लिए मैं आमतौर पर एक नेट स्थापित करें बाद निम्नलिखित का उपयोग करें:
mv /etc/localtime /etc/localtime.bak एम वी / etc / / etc localtime / localtime.bak
ln -sf /usr/share/zoneinfo/America/Los_Anglese /etc/localtime LN-एस एफ / शेयर usr / / zoneinfo / अमेरिका / Los_Anglese / etc / localtime
/etc/init.d/ntpd restart / etc / init.d ntpd / पुनः आरंभ
date तिथि
and if you want to save the time after restart, you need to use this command और यदि आप को पुनः आरंभ करने के बाद समय बचाना चाहते हो, तो आप इस कमांड का प्रयोग की जरूरत
hwclock –systohc hwclock-systohc
I'm using Arch linux and the ntpd daemon is located in /etc/rc.d/ntpd, but I didn't need to start it. मैं आर्क Linux और ntpd डेमॉन का उपयोग कर रहा हूँ / etc में स्थित है / rc.d / ntpd, लेकिन मैं इसे शुरू करने की जरूरत नहीं है. I just used: # ntpdate pool.ntp.org and it worked. मैं सिर्फ का प्रयोग किया: # pool.ntp.org ntpdate और यह काम किया. However if you have the ntpd server running the update won't work. लेकिन अगर तुम ntpd अद्यतन नहीं काम करेगा चल सर्वर है.