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
5 votes
1 answer
378 views

sudo with tee displays staircase

Previously I ran without sudo and used tee to display on terminal and log to file: ./my_app | tee path/to/log_file Now I need sudo: sudo ./my_app | tee path/to/log_file However, because of tee when ...
intrigued_66's user avatar
1 vote
1 answer
67 views

How can I write my input down to file?

Recently, I needed to write my terminal output down. And I've read this question to find the answer. But now, I would like to write my commands down (which I type in terminal, for example:sudo apt ...
Reiji Akkerman's user avatar
0 votes
1 answer
243 views

tee: invalid option -- 'f'

sudo echo «deb http://nginx.org/packages/ubuntu `lsb_release -cs` nginx» \ | sudo tee /etc/apt/sources.list.d/nginx.list curl -fsSL https://nginx.org/keys/nginx_s tee: invalid option -- 'f' How to ...
Aleksey's user avatar
0 votes
0 answers
231 views

Warning: apt-key is deprecated, when installing Microsoft Edge

To install Microsoft Edge, the suggestion is to: wget -q https://packages.microsoft.com/keys/microsoft.asc -O- | sudo apt-key add - however, this is now deprecated. So the suggestion is to now use ...
Nicholas Saunders's user avatar
2 votes
1 answer
1k 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 ...
intrigued_66's user avatar
1 vote
2 answers
2k 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 ...
yung peso's user avatar
  • 121
3 votes
2 answers
1k 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, ...
Marc Bouvier's user avatar
1 vote
1 answer
520 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 ...
cdevd's user avatar
  • 21
0 votes
1 answer
551 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 ...
mysterium's user avatar
2 votes
1 answer
186 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" | ...
Guntis Endzelis's user avatar
0 votes
0 answers
194 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 ...
Tahlor's user avatar
  • 291
1 vote
1 answer
841 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, ...
An Ignorant Wanderer's user avatar
2 votes
1 answer
676 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/...
Mehmet's user avatar
  • 107
0 votes
1 answer
4k 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, ...
Qinsheng Zhang's user avatar
1 vote
1 answer
942 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/...
Mosky's user avatar
  • 13
1 vote
0 answers
53 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 ...
ssssstut's user avatar
  • 667
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 ...
Tono Nam's user avatar
  • 135
1 vote
2 answers
749 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 ...
Josef Klimuk's user avatar
  • 1,596
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 ...
Manar Zaboub's user avatar
1 vote
0 answers
55 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’. ...
hannan imtiaz's user avatar
0 votes
1 answer
242 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 $...
Yura Shinkarev's user avatar
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 ...
v217's user avatar
  • 358
0 votes
2 answers
204 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 ...
Nick To's user avatar
210 votes
1 answer
183k 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 ...
Bluebeep's user avatar
  • 2,261
10 votes
6 answers
19k 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 ...
MetalArend's user avatar
0 votes
1 answer
48 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
mekkanizer's user avatar
10 votes
2 answers
13k 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 ...
Thufir's user avatar
  • 4,551
15 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 ...
VeryHardCoder's user avatar
3 votes
2 answers
5k 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. ...
GhostRavenstorm's user avatar
3 votes
2 answers
127 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/...
MikkoP's user avatar
  • 185
18 votes
2 answers
24k 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 ...
Ladislav Mrnka's user avatar
0 votes
1 answer
768 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 ...
Shezwan91's user avatar
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?
Zuhayer's user avatar
  • 225
71 votes
3 answers
61k 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 ...
Alexej Magura's user avatar
1 vote
1 answer
2k 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 ...
brastein's user avatar
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 ...
Aquarius Power's user avatar