Questions tagged [tee]

`tee` is a command that reads from standard input and writes to standard output and to a file, so that the user can see output from a command at the same time as saving it.

Filter by
Sorted by
Tagged with
2 votes
1 answer
270 views

Grep output from application, show to screen and write to file?

I run an application and pipe the output to grep. This works. However, I wish to show the output on both screen and write to file. So I am piping the grep result to tee: ./app | grep something | tee ...
1 vote
2 answers
995 views

Bash - How to add new line when appending text to a file?

I'm running this command to append output text data to a markdown file: git log -1 --oneline --skip=1 | tee -a page1.md For the most part functionality is great, but I need to format the output so ...
  • 121
3 votes
2 answers
848 views

How to append date and text to a file as an alias?

I want to create an alias to append a dated note to a file. (The use case I want to reproduce : Sebastian Daschner - How to do effective note taking as developer. So far I was able to append the date, ...
1 vote
1 answer
258 views

using a tee inside a .desktop file for debug logging

How do I write a .desktop file that includes a tee? Normally I start my debug logging from terminal, using a .sh like the below: sudo ./start-ds.sh 2>&1 | tee output.log I have to go into ...
  • 21
0 votes
1 answer
355 views

Why use tee with wget? Isn't it superfluous?

So I came across this code for downloading youtube-dl using wget which pipes into tee here: How can I update youtube-dl? The code being: wget -O - https://yt-dl.org/downloads/latest/youtube-dl | sudo ...
2 votes
1 answer
139 views

How do I append a line to all .gitignore files recursively?

I have a directory that have multiple subdirectories with git repositories. I want to add desktop.ini to all .gitignore files in these subdirectories. I know i can do echo "desktop.ini" | ...
5 votes
1 answer
3k views

How to get both the output of the time command in a file?

I ran the command time echo "Hello world" | tee output.txt expecting to get the full output to both terminal stdout and the output.txt file. However, the file content is not what I expect : ...
0 votes
0 answers
177 views

Can't save output of particular command in particular environment (cron)

My crontab is not producing logs for a particular command I'm using to monitor my network; other commands work fine. * * * * * /usr/bin/COMMAND opt1 opt2 >> /home/pi/LOG.log 2>&1 The ...
  • 271
1 vote
1 answer
573 views

Wait for previous command to finish while using tee

I'm using tee as follows: some commands | tee -a >(command1 >> file) >(command2 >> file) >(command3 >> file) How can I delay the execution of command2 till command1 ends, ...
1 vote
1 answer
503 views

tee: constraint_0_power_limit_uw: No data available

I am trying to replace value in the file of constraint_0_power_limit with new value using echo "45000000" | sudo tee constraint_0_power_limit_uw That file is under /sys/class/powercap/intel-rapl/...
  • 67
0 votes
0 answers
3k views

Redirect program ouput to screen and file simultaneously

I have a Python script. I want to save its result while it outputs something in the terminal. I tried python program.py 2>&1 | tee output.txt However, it seems only after the program finishes, ...
1 vote
1 answer
632 views

use tee to save log file in a subfolder (defined in a variable)

The input file of a script is passed as an argument from command line. I want the log file from tee to be saved in the same directory than the input file: Lets say that input file is at "data/temp/...
  • 13
1 vote
0 answers
52 views

Can I use tee for large logoutputs on a server 7/24?

The tee command https://unix.stackexchange.com/questions/35935/how-to-log-to-file-and-to-console writes the console output as well to a file. However when I open the file while the main program is ...
  • 429
0 votes
1 answer
3k views

use "tee" command to append asterisk debug information to file

When I run: $ asterisk -rvvv | tee temp-log-asterisk.txt $ ubuntu*CLI> dialplan reload $ exit this is the real output of asterisk: Now when I look into the content of temp-log-asterisk.txt I ...
  • 135
1 vote
2 answers
490 views

Directing not empty output into a file

I want to save only non-empty output of find command into a file. If there is no output file should not be created. $ ls folder aa $ find . -name 'bb' | tee file $ cat file $ ls folder aa file How ...
  • 1,526
1 vote
0 answers
2k views

The right way to configure USB power in ubuntu

echo on | sudo tee /sys/bus/usb/devices/*/power/level > /dev/null The command above is used to keep USB power on (Turns off USB power-saving). I execute the command every time I log in to Ubuntu ...
1 vote
0 answers
52 views

how to print for multiple files differently? [duplicate]

Give a single command line for searching a file ‘datafile’ for the string “Internet”, sending the output of the command to a file called ‘Internet.freq’ and any error message to a file ‘error.log’. ...
0 votes
1 answer
216 views

Cannot duplicate all ouput to a file with tar/pigz [duplicate]

I'm using in my script: tar cfh - "$SRC_DIR" --exclude-from <(find $SRC_DIR -size +$EXCLUDE_MB_FILES) | pigz -9 --quiet --keep --recursive --rsyncable > $BACKUP_TARGER_DIR/$ARC_NAME | tee $...
3 votes
1 answer
2k views

Why is the tee command necessary?

On Ubuntu my Brightness keys don't work. So instead to open Ubuntu settings every time, I want to write a shell script to use in my .bashrc. Now I don't understand at all why the tee command in the ...
  • 358
0 votes
2 answers
193 views

Editing a text file does not save changes

I am trying to follow instructions from here to enable backlight for my keyboard on Dell Vostro 3350. I want to change the contents of a /sys/class/leds/dell::kbd_backlight/brightness file, which ...
186 votes
1 answer
159k views

How to append tee to a file in Bash?

These are commands I type in the terminal echo -e "First Line" | tee ~/output.log echo -e "Second Line" | tee ~/output.log When I look in the file output.log I only see 'Second ...
  • 2,021
9 votes
5 answers
18k views

Debugging preseed/late_command for ubuntu 16.04 server: tee not found vs nonexistent directory

I am trying to run the following preseed file on a ubuntu 16.04 server machine (during a packer build): d-i preseed/late_command string \ in-target mkdir -v -p -m 0440 "/etc/sudoers.d"; \ in-target ...
0 votes
1 answer
46 views

Running tee from alt+f2

For some reason this works from term and does not from "run" dialogue or Openbox shortcuts... echo 200 | sudo tee /sys/class/backlight/intel_backlight/brightness
9 votes
2 answers
11k views

lint: command not found

Does Ubuntu have a lint utility? How is it installed? In computer programming, lint is a Unix utility.. https://en.wikipedia.org/wiki/Lint_%28software%29 thufir@mordor:~$ thufir@mordor:~$ gcc ...
  • 4,423
14 votes
4 answers
6k views

Reading and writing a file: tee command

It is well known that a command like this: cat filename | some_sed_command >filename erases file filename, as the output redirection, being executed before the command, causes filename to be ...
3 votes
2 answers
4k views

'sudo tee' command gone wrong | Removing a source.list that can't be read?

This has happened twice where I followed instructions on installing software and then having the software center open then close immediately as a result of running the commands from the instructions. ...
3 votes
2 answers
124 views

tee results in a null file

I try to change Apache configuration with this: sudo awk '/<Directory \/var\/www\/>/,/AllowOverride None/{sub("None", "All",$0)}{print}' /etc/apache2/apache2.conf | sudo tee /etc/apache2/...
  • 175
18 votes
2 answers
21k views

Tee doesn't get whole output from the pipe

I have a script executing commands like: export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH;./some_app -i $INDEX | tee $LOG echo "Number of errors: $(grep "ERROR" $LOG | wc -l)" The problem is probably in ...
0 votes
1 answer
717 views

GPS nmea output, saving only last record to external file linux

I'm using a globalsat G-STAR IV GPS for my Vehicular Ad Hoc networks project. In this, the nmea output coming from the GPS gets updated every 1 second. I want to know if there is a way to save just ...
1 vote
3 answers
10k views

How to Automatically save terminal command output to file [duplicate]

Is there a way that I can save the terminal command output to a file, without having to write the command ' | tee /abc.txt' every-time around?
  • 225
71 votes
3 answers
51k views

Is there any significance to using tee?

Why is it that almost all instructions regarding appending text to system files like fstab and /etc/apt/sources.list.d/<name>.list involve using tee and echo to append said text? Take the ...
1 vote
1 answer
1k views

Capturing text output to a log, while printing REALTIME to terminal

My output prints approximately 1 line per second to the terminal, maybe 100-200 lines in total. I've tried to capture the output using tee, but it prints all the lines at the end of the process, not ...
3 votes
1 answer
6k views

how to redirect output to a log file without tee? normal redirection is not working

why not use tee? because the terminal rendering of the output makes the application run slower. for some reason, this is not working: application 2>&1 >"$logFile" the output keeps going ...