Questions tagged [tee]

For questions related to Linux syscall and a user program that duplicates the contents of a pipe. For security frameworks, use the tags [trusted-execution-environment] or [op-tee].

Introduction

The tee command reads from standard input and writes to standard output and files.

Examples of writing standard output include:

# print output of ps to a file
$ ps aux | tee ps_aux.txt

Using tee with sudo command

$ echo 'foo' >> file 
zsh: permission denied: file

As part of a pipe, tee can take the input and elevate permissions

$ echo "foo" | sudo tee -a file 

Links

How do I “tee” variable number of times in a bash “for loop”?

Linux and Unix tee command

536 questions
0
votes
1 answer

MySQL tee (\T) command doesn't output my queries or my comments

GOAL: to output all SQL queries and their outputs into a text file SQL CODE: \W /*enable warnings*/ USE bookdb; /*doesn't exist because I WILL DROP DATABASE booksdb BEFORE RUNNING THIS SCRIPT (to avoid duplicate entry errors from testing out the…
CoffeeAndCream
  • 21
  • 1
  • 1
  • 5
0
votes
1 answer

updating a file using tee randomly fails in linux bash script

when using sed -e to update some parameters of a config file and pipe it to | tee (to write the updated content into the file), this randomly breaks and causes the file to be invalid (size 0). In Summary, this code is used for updating…
0
votes
1 answer

BASH save stdout to new file upon execution

please bear with me if my terminology or syntax is less than stellar (still learning). I currently have a simple bash script that checks the arguments of the command and outputs files names with matching text. This part of my script works correctly…
0
votes
1 answer

Writing a log file with tee

There is my problem, I work with ksh script and i try to make a log file with function tee and with : informations that will be shown on screen informations that will not be shown on screen. So i used tee to handle all echo in my script and i…
Adhin37
  • 57
  • 2
  • 8
0
votes
1 answer

tee /dev/null consuming input?

Somehow it seems as though running ./program | tee /dev/null is consuming its output. When run on its own, the program prints some text, then continues running while communicating over UDP sockets. It produces a lot of log messages that I wanted to…
LambdaBeta
  • 1,479
  • 1
  • 13
  • 25
0
votes
1 answer

How to write to file the data received in an infinite loop

Is there some way to write to file the data received while in an infinite loop? I have a script that displays web content in my terminal as it appears on the web page. But all my attempts to tee the data have resulted in an empty file. I suppose…
I0_ol
  • 1,054
  • 1
  • 14
  • 28
0
votes
2 answers

Inspect stdout from the middle of chained apps

Consider this example chain: cat foo.txt | grep -v foo | grep -v bar | grep -v baz I'd like to inspect the contents stdout of the second grep as well as the resulting stdout: cat foo.txt | grep -v foo | grep -v bar | UNKNOWN | grep -v baz So I…
0
votes
2 answers

Writing to a file from a subprocess and parent process simultaneously

I have a script (Python) that uses subprocess to call another script. The parent script writes to the console and a log file at the same time (I used the code from the accepted answer to this question to split the output), but the child process…
Eliezer Miron
  • 388
  • 5
  • 18
0
votes
1 answer

Using linux "tee" command in bashrc

How to use linux "tee" command in bashrc for automatic logging everything you write in shell and get on screen parallel to somefile ?
Leone
  • 19
  • 1
0
votes
5 answers

isinstance with tee objects

As a part of memoizing mechanism, I have a generator, I tee it, and I need to check its type with isinstnace. >>> gen = (i for i in range(5)) >>> one, two = itertools.tee(gen, 2) then >>> type(one), type(two) (itertools.tee, itertools.tee) as…
meto
  • 3,425
  • 10
  • 37
  • 49
0
votes
1 answer

How can I run a command using 'tee' and save the output?

I need to take the output from one command, tee it into two different commands and save their output in variables. So something like this: command1 | tee >(command2 > var1) >(command3 > var2) >/dev/null Where var1 and var2 are variables not…
0
votes
1 answer

Why does tee wait the end of the .exe program?

I am on a Windows 7 host with cygwin 1.7.0 installed. I want to see the output of myTest.exe on the console and in the meanwhile have it written to myTest.log, but all output is shown only when myTest.exe is concluded. I tried the solution suggested…
S. Inder
  • 77
  • 1
  • 9
0
votes
1 answer

can i integrate team explorer everywhere and intellij 15.02?

we are trying to use tfs2012 as a Version Control and Intellij 15.02/14.04 as IDE for Java Projects. been trying to integrate TFS2012 and intellij, was successful in that part, but unable to find some kind of integration with team explorer…
kris5599
  • 23
  • 1
0
votes
3 answers

Using tee command with soft linked file

I have a script start.sh which runs another script run.sh. run.sh starts my executable. I wanted to record what run.sh does and I used a tee command to log it into a file loglink, start.sh: exec run.sh | tee -a loglink loglink is a soft linked…
Clobbered
  • 15
  • 6
0
votes
2 answers

Why does fgets(STDIN, 1024) not work anymore?

Question 1 I used to use that line for my PHP parser file for a game server, but it does not work anymore. I know there is the fopen("php://stdin") thing but that's now 3 lines of code instead of just one, why would PHP do this? Question 2 Also,…
animuson
  • 53,861
  • 28
  • 137
  • 147