tail
फ़ाइल और डायरेक्टरी
इस्तेमाल
tail -f [file]फ़ाइल का अंत छापता है और -f के साथ उसे देखता रहता है; log rotate होने के बाद पीछा जारी रखने के लिए -F चाहिए।
आम विकल्प
| विकल्प | अर्थ |
|---|---|
| -n | Print the last N lines |
| -n +N | Start at line N instead of counting from the end |
| -f | Keep printing as the file grows |
| -F | Follow by name and reopen the file after log rotation |
| -c | Print the last N bytes |
| -r | BSD: print the lines in reverse order (GNU uses tac) |
उदाहरण
tail -f app.logWatches a log live; Ctrl-C stops.
tail -n +2 data.csvSkips the header line.
tail -F /var/log/nginx/access.logKeeps following after the log is rotated.
हटाना, मिटाना और ढूँढना। कुछ कमांड दोबारा नहीं पूछते, इसीलिए -i लगाने की आदत हाथ बचाती है।
कैसे पढ़ें
- बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
- तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
- विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।
आम सवाल
Q. tail क्या करता है?
फ़ाइल का अंत छापता है और -f के साथ उसे देखता रहता है; log rotate होने के बाद पीछा जारी रखने के लिए -F चाहिए।
Q. इसे कैसे लिखें?
tail -f [file] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।
Q. कितने विकल्प जानने लायक़ हैं?
यहाँ 6 दिए हैं; पूरी सूची man tail में है। यह कमांड फ़ाइल और डायरेक्टरी में आती है।
मिलती-जुलती कमांड
man पेज: man tail