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
-1
votes
3 answers

Redirection using tee and sed

What am I doing wrong here? I don't get any STDOUT from tee but test.log is populated correctly. perl test.pl | tee -i | sed 's/\x1b\[[0-9;]*m//g' > test.log My goal is to sent everything printed by test.pl to STDOUT and dump a filtered…
Jean
  • 21,665
  • 24
  • 69
  • 119
-1
votes
1 answer

How to use "tee" with "source" command in Linux?

On Linux I'm using "tee" to capture the output of "source" command and print it to output log file, but failed. The command I'm using is like this: source ./my_run.sh 2>&1 | tee -i my_run_log The intention of my_run.sh is to "make" some compile…
katyusza
  • 325
  • 2
  • 12
-1
votes
1 answer

tee won't write to file until script finishes executing?

I'm trying to automatically collect performance data (loading and screen rendering times) from an Android app. I use test-runner.py (an internal tool) to build the app and run the tests before using the adb command to get the performance data. My…
Danny
  • 705
  • 1
  • 7
  • 23
-1
votes
1 answer

Print and read from xterm in a multithreaded C program using cat, tee and fifos

I am trying to create a chat interface in my C program. The program use two fifos to communicate with a forked xterm running the commands cat fifo_out and tee fifo_in > /dev/null at the same time. Then a thread is opened for reading input in the…
-1
votes
3 answers

'Killed' after curl | tee

I have centos image in virtualbox. When I do curl [url] | tee -a [file] where [url] is the url for a large file, the system start to kill all new proccesses and I get Killed answer in console for any command but kill and cd. How can I disable OOM…
maxbr
  • 1
  • 2
-1
votes
1 answer

Ant SecureInputHandler: prints password in clear text when used with tee

We use Ant's secure handler to enter passwords: That, of course, does work: input is not printed. When though (to save the build log) we…
Vladimir Dyuzhev
  • 18,130
  • 10
  • 48
  • 62
-2
votes
1 answer

capture only stderr from command

I want to run a command. I want to continue to pipe stdout and stderr to stdout/stderr of the console, but I also want to capture stderr in a variable. To do this with stdout is trivial stdout=$(command | tee), but I can't see any way to do this for…
Yair Halberstadt
  • 5,733
  • 28
  • 60
-2
votes
2 answers

Replace each 2 nth occurs from a string in separate files using line range from another file

I have three files: 0.txt e 0-1.txt with same content bellow: "#sun\t", "car_snif = house.group_tree(home_cool)\t", "machine(shoes_shirt.shop)\t", "car_snif = house.group_tree(home_cool)\t", "machine(shoes_shirt.shop)\t", "car_snif =…
7beggars_nnnnm
  • 697
  • 3
  • 12
-2
votes
1 answer

bash script cd command affecting tee command

I've a script to perform git operations. Parse the file for the repo, source and new branch Clone the repo check if the new branch already exists. skip this repo if it does create new branch: cd into the folder git branch new_branch git checkout…
RockyK
  • 3
  • 2
-2
votes
1 answer

How to execute a command after a shell script ends and save the output while still showing the results at the screen at the same time

How can I execute a shell script and save the output to a file while still showing the results in the screen at the same time (both STDOUT and STDERR), and them executing another command after the script ends? Should I use nohup?
SA RA
  • 15
  • 1
-5
votes
2 answers

Vim: sudo errors in writing a selection

How can I circumvent the errors, such as E212 and E13, in the commands? :'a,'bw set_question_tags.php :'a,'bw >> set_question_tags.php In some cases, even with Pavel's command: "create_a_file_and_save.php" E212: Can't open file for writing
hhh
  • 50,788
  • 62
  • 179
  • 282
1 2 3
35
36