If you administer a Linux machine it is quite likely that you see a lot of messages fly by on your screen as you run commands. यदि आप एक Linux मशीन यह काफी संभावना है कि आप संदेशों की एक बहुत कुछ देखना है प्रशासन आपकी स्क्रीन पर से उड़ान भरने के रूप में तुम्हें हुक्म चलाते हैं. Some of these messages are trivial, while others may be critical. इन संदेशों में से कुछ तुच्छ हैं, जबकि अन्य महत्वपूर्ण हो सकता है. Although Linux and UNIX have a fine logging engine in syslogd and most of the system's messages are logged in a proper log format in various files under he /var/log directory, you might find it useful sometimes to log the output of a command or script that you have run. हालांकि Linux और UNIX एक syslogd इंजन में प्रवेश ठीक है और सिस्टम के संदेशों की सबसे विभिन्न फ़ाइलों में एक उचित लॉग प्रारूप में वह नीचे लॉग इन / var / log निर्देशिका, आप इसे उपयोगी कभी कभी एक समादेश या स्क्रिप्ट के उत्पादन में प्रवेश के लिए मिल सकती हैं कि तुम भाग है. Linux provides a number of ways to log the output of your commands. लिनक्स तरीके तेरी आज्ञाओं के उत्पादन में प्रवेश के एक नंबर प्रदान करता है.
The simplest, and probably the most common way to do this is to put a greater than sign after a command, followed by the location of the output file. सरल है, और शायद सबसे आम तरीका यह करने के लिए एक आदेश के बाद एक बड़ी हस्ताक्षर से रखा, आउटपुट फ़ाइल के स्थान के आधार पर किया है.
# ls /var/log > /tmp/varlog.log # रास / var / log / tmp / varlog.log>
The command shown above logs the output of the command ls /var/log into the file /tmp/varlog.log . ऊपर दिखाए गए आदेश कमांड लोकसभा के उत्पादन में / var / लॉग फाइल में लॉग इन / tmp / varlog.log. One thing to note about this command is that if you use a single greater than sign to log the output the output of a command to a file it will create a new file if not already present, or wipe clean, if one is found. एक बात के लिए इस कमान के बारे में ध्यान दें है कि यदि आप उपयोग एक हस्ताक्षर से अधिक उत्पादन के लिए एक कमांड के उत्पादन में लॉग इन करने के लिए फ़ाइल इसे एक नई फ़ाइल बनाने के अगर मौजूद नहीं, पहले से ही है या मिटा साफ होगा, अगर एक ही पाया जाता है. So, if you want to append the output of the command to a file you need to use two greater than signs instead of one. तो, अगर आप कमांड के उत्पादन में संलग्न करने के लिए फ़ाइल आप को दो के बजाय एक के संकेत से अधिक प्रयोग करना चाहते हैं. The command shown above needs to be modified to look like this: आदेश की जरूरत है ऊपर दिखाए गए करने के लिए इस तरह देखो संशोधित सकता है:
# ls /var/log >> /tmp/varlog.log # रास / var / log> tmp> / / varlog.log
Linux has a tool aptly named logsave which does a similar task as greater than sign. लिनक्स जिसे उपयुक्त है जो एक के रूप में एक समान कार्य करता है logsave नाम उपकरण है हस्ताक्षर से भी बड़ा. You can attain the same result as the first example using the following command: तुम पहले निम्न कमांड का प्रयोग उदाहरण के रूप में एक ही परिणाम प्राप्त कर सकते हैं:
# logsave /tmp/varlog.log ls /var/log / Logsave # tmp / रास varlog.log / var / log
This command will create a new or overwrite an existing one with the output of the command ls /var/log . इस कमान बनाने होगा एक नया या कमांड लोकसभा के उत्पादन में / var / के साथ एक मौजूदा एक लॉग अधिलेखित. If you want logsave to append the out to a file instead of writing over it, using it with the -a option: यदि आप चाहते हैं logsave को इस पर एक फ़ाइल के बजाय लिखने के लिए संलग्न, यह एक विकल्प के साथ प्रयोग:
# logsave -a /tmp/varlog.log ls /var/log # Logsave एक tmp / / रास varlog.log / var / log
There isn't much of a difference between the greater than and the logsave method. वहाँ नहीं है के बीच एक अंतर है बहुत से बड़ा और logsave विधि. The one thing I noticed was that logsave has a much cleaner output and it also adds the date to the output file. एक बात मैंने पाया है कि logsave था एक बहुत क्लीनर उत्पादन किया है और यह भी आउटपुट फाइल के लिए तिथि कहते हैं.























The one thing I noticed was that logsave has a much cleaner output एक बात मैंने पाया है कि logsave था एक बहुत क्लीनर उत्पादन किया है
and what do you mean by that? और तुम क्या मतलब है? output is output, so either logsave is dismissing parts of the output or it should be the same? उत्पादन उत्पादन है, तो या तो logsave उत्पादन के कुछ हिस्सों खारिज है या यह वही होना चाहिए?
By cleaner output I mean that the output is organized in a better fashion using whitespace and new lines. क्लीनर उत्पादन से मेरा मतलब है कि उत्पादन बेहतर फैशन में आयोजित रहितसफेद और नई लाइनों का उपयोग कर रहा है. And the fact that logsave marks the beginning and end of a session of output makes it a lot easier to return to the log file to debug at a later time. और इस तथ्य है कि logsave अंक शुरुआत और उत्पादन के एक सत्र के अंत में यह एक बहुत आसान प्रवेश पर लौटने के लिए एक बाद में समय पर डिबग फ़ाइल बनाता है.
Yes true I agree with Sukrit हाँ, मैं सच Sukrit से सहमत