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

tee command not working when run in background

I want a daemon that continuously watches a named pipe for input, and then creates two files: one that contains all the data that went through the named pipe, and one that contains a filtered version of it. When I run this command from the command…
Diego Puertas
  • 87
  • 1
  • 5
0
votes
1 answer

Forward production http request to staging server

I would like to find a nice way to route all my production http traffic temporarly to a staging server (equivalent to the production) to be able to monitor it. How can I do that (we use apache / tomcat 7), but any solution might be helpful as a…
user2854544
  • 851
  • 1
  • 11
  • 23
0
votes
3 answers

how does `ls "*" 2>&1 | tee ls.txt` work?

I was finding a way to save all output to a file and print it. And the command like the following does work perfectly! ls "*" 2>&1 | tee ls.txt But I think I don't understand it well. And I tried ls "*" | tee ls.txt. It doesn't work. The error…
pktangyue
  • 8,326
  • 9
  • 48
  • 71
0
votes
1 answer

how to read a value from filename and insert/replace it in the file?

I have to run many python script which differ just with one parameter. I name them as runv1.py, runv2.py, runv20.py. I have the original script, say runv1.py. Then I make all copies that I need by cat runv1.py | tee runv{2..20..1}.py So I have…
physiker
  • 889
  • 3
  • 16
  • 30
0
votes
2 answers

How to makeprg gcc pipe tee errors.err in vim?

I want to pipe stderr from gcc to tee errors.err but I got no luck trying this two pieces I made up: setlocal makeprg=gcc\ -Wall\ -Wextra\ -g\ -O0\ -ansi\ -pedantic-errors\ %\ -o\ %<.x\ 2>\ >(tee\ errors.err) The file is there, but its blank. At…
DrBeco
  • 11,237
  • 9
  • 59
  • 76
0
votes
0 answers

Screen big data without interrupting data conversion

This thread is an extension of this thread where the interruption (CTRL-c) stop the data transfer into less. I would like to create a similar system monitoring data conversion as is found in fdupes. I think this can be reached with GNU screen.…
0
votes
1 answer

How to use bash tee to redirect stdout and stderr to a file from script which has screen in the hash bang

I have a script which needs to run in screen so I included #!/usr/bin/screen /bin/bash as the hash bang and it works great. The only problem is that when the script crashes I don't know what happened, the output is lost and all I know is that…
Bart C
  • 1,509
  • 2
  • 16
  • 17
0
votes
1 answer

Ho do I undo those steps in Linux

Hello I've tried to install mono by tutorial on mono project website not knowing that I already have mono in my repository on rpi I would like to know how to undo steps I did sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys…
Teamol
  • 733
  • 1
  • 14
  • 42
0
votes
2 answers

how to execute a command everytime I open a new terminal to my server

I am trying to capture all my session logs into a file(s) , I am using "tee" command for doing it. However I want this as a automatic behaviour for all of my new sessions. Can anyone help me to find a way so whenever I open a new window following…
user2809888
0
votes
1 answer

Jenkins Error Connecting to Visual Studio Online

I am running Jenkins 1.595 with the TFS plugin 3.1.1 and TEE 12.0.2 I have been running jobs on Jenkins with Visual Studio Online for some time without issue, but I recently modified an existing job to point at a new branch and it stopped working. …
Josh G
  • 33
  • 5
0
votes
0 answers

tee command in C with option

I have command tee in C, and I should add option -a which :supports the -a option file, which results in adding the data being read to the end of the file, if available. Anyone could help? I try put inside : if ( (option = getopt(argc,argv,"a"))…
0
votes
0 answers

ruby 1.8.7 readline $stdout conflict

Fellow Ruby developers. I am building a prompt interface with Ruby 1.8.7. As such, I'm using 'readline' in my codes. As it is a prompt interface I'm building, I want to create an option such that, should a user specify a logfile, all STDOUT and…
0
votes
2 answers

How can I redirect the same message to both stdoud and stderr (without temporary file)

It is easy to redirect stdout or stderr to the same output (file or one of the 2 std output) with a 1>&1,>&2 and/or >file but is there a way to send the same output to both the std output in KSH (like | tee File but with &2 as file) ?
NeronLeVelu
  • 9,908
  • 1
  • 23
  • 43
0
votes
1 answer

Prepend message to rsstail

I am trying to prepend a message to the output of rsstail, this is what I have right now: rsstail -o -i 15 --initial 0 http://feeds.bbci.co.uk/news/world/europe/rss.xml | awk -v time=$( date +\[%H:%M:%S_%d/%m/%Y\] ) '{print time,$0}' | tee…
ruben1691
  • 353
  • 3
  • 20
0
votes
2 answers

append message to tee

is there any way to add the current date when using tee? For example: ls -al | tee someFile.txt prints something along these lines: == 23.10.2014 - 23:23:23 == ... Whatever the ls returned ... It has to be done as a single command. Thanks!
ruben1691
  • 353
  • 3
  • 20