tee कमांड
tee एक T-shaped water pipe जैसा है: same पानी दोनों एक bucket में और आगे next place की तरफ flow करता है। आप output को एक file में save करते हैं और फिर भी इसे screen पर देखते हैं।
In this page:
Syntax
command | tee file_name
command | tee -a file_name
tee
tee standard input से पढ़ता है और इसे एक साथ एक file में और वापस standard output में लिखता है, आपको terminal में इसे देखते हुए भी output को एक log में save करने देते हुए।
यह अक्सर एक pipeline के बीच में रखा जाता है। tee -a overwrite करने के बजाय file में append करता है।
Note:
command | tee log.txt उपयोग करें output को live देखने के लिए और साथ ही इसे बाद के लिए save करने के लिए।उदाहरण: tee
#!/bin/bash
echo "Important message" | tee log.txt
echo "--- contents of log.txt ---"
cat log.txt
Login to try C/C++/Java/PHP code in the editor
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the
view already swaps in the hi_ translation fields (or blanks these
out if untranslated), so this renders correctly for both languages
without a lang_code check here. #}
आम गलतियां
-aभूल जाना, इसलिएtee fileहर बार file overwrite करता है।- यह उम्मीद करना कि
teeerrors लिखेगा, जब यह सिर्फ standard output copy करता है। sudo cmd > fileउपयोग करना और redirect के पास root rights होने की उम्मीद करना;cmd | sudo tee fileउपयोग करें।
🔒
Chapter Quiz — Complete all 14 topics to unlock
0/14 topics done
Complete these topics first: