Questions tagged [tee]
In computing, tee is a command in various command-line interpreters (shells) such as Unix shells, 4DOS/4NT and Windows PowerShell, which displays or pipes the output of a command and copies it into a file or a variable. It is primarily used in conjunction with pipes and filters.
20
questions
16
votes
3
answers
16k
views
tee and assigning to variable?
I need to see output on the screen and at the same time grep the output and send grep result to variable. I think it can be done with tee but I can't figure out how exactly. I tried
mycommand | tee ...
7
votes
1
answer
979
views
screen causes "tail -F | grep" to echo unmatched lines
This is Ubuntu (3.13.0-29-generic #53), trying to do a simple bash script to monitor a log file for matching lines.
If I do the following, there is no output in the bash shell except for matches, ...
6
votes
2
answers
7k
views
Why is this tee losing stdout?
Simple script:
#!/bin/bash
remote_ssh_account="depesz@localhost"
directory_to_tar=pgdata
exec nice tar cf - "$directory_to_tar" | \
tee >(
md5sum - | \
ssh "$remote_ssh_account"...
4
votes
1
answer
2k
views
iptables + TEE doesn't work correctly
On my server, I want to duplicate all the traffic to an other host. I use iptables with TEE module:
iptables -t mangle -A PREROUTING -i eth0 -j TEE --gateway IP_SERVER2
I check the rule: iptables -...
3
votes
2
answers
4k
views
Execute command over SSH while logging live output
I'm trying to log the output of a remote ssh command.
I'm current using
ssh USER@IP | tee -a ~/random.log
and then run the command I need to run on the remote server which then logs to random.log.
...
2
votes
1
answer
4k
views
UDP Proxy with cloned packets
Having UDP messages sent from dynamic public IP periodically to public IP X:20000.
Need a proxy that listens in IP X:20000, then forwards duplicate/clone packets to X:20001 and a different machine ...
2
votes
1
answer
259
views
Tee command is reducing the lines?
I have the code like this :
54 08 * * * /usr/local/bin/curator --dry-run --config /home/itadmin/.curator/curator.yml /home/itadmin/.curator/daily.yml 2>&1 | /usr/bin/tee -a /home/itadmin/....
2
votes
1
answer
619
views
Linux shell: Pipe stderr and stdout to one file AND to individual files at the same time (using tee?)
I would like to form a pipe-stream that captures stdout to one file and stderr to another file AND both in a third file (so also the complete terminal output is in one file)
somehow like this:
process ...
1
vote
1
answer
1k
views
Bash: Output of a command is written only to screen and not to another file while using tee, what could be the reason?
In order to troubleshoot some ftp connection error, I've been instructed to write a bash script which will infinitely connect to a remote frp server and get one file from there.
ftpuser="ftpuser"
...
1
vote
2
answers
1k
views
rewrite destination IP of TEEed traffic
Server 1 and Server 2 (Centos 7) both host the same application, which listens on UDP port 1514. Server 1 receives traffic on this port. The goal is for the application on Server 2 to receive a copy ...
1
vote
1
answer
6k
views
Debugging rsync over SSH in verbose mode using tee to redirect stdout to log file
I have been having issues with various rsync operations over SSH, on a particular machine on our network, failing and giving errors like:
rsync: connection unexpectedly closed (45482 bytes received ...
1
vote
1
answer
419
views
How do I pipe stdout and std error to a file and back to stdout on Windows?
On Windows when running a batch script I want to record the output of I run:
myprogram.bat 1> mylog.log 2>&1
Which is great - but I have to run a separate tail process to read the output ...
0
votes
1
answer
117
views
logger and tee running in background?
Sometimes I notice the server is running slowly and at those times a ps -e shows that logger and tee are running but I can't think of why. Is this a known issue? Why would these need to run without ...
0
votes
2
answers
711
views
How to output a stdout both to a process and the shell screen
Do someone knows a way to send the stdout of a command both to another command and display it in the shell screen? Note: without using files.
An example (in this case I use wc -l to make it simple )
...
0
votes
1
answer
1k
views
Trying to send output to log file with tee using systemd but the log file isn't being created?
I want to run a node application via systemd and have its output go to both stdout and a log file. The node app is in the folder named www/www.appname.com and I want to have the log file in www/log....
0
votes
1
answer
758
views
Where does cron store the real-time stderr logs?
I've got a cron job configured to run a command like
some-command 2>&1 >/dev/null | tee -a /tmp/some-command.STDERR.$(date +\%Y-\%m-\%d.\%H.\%M)
I've also got a tmpreaper cron job that ...
0
votes
1
answer
2k
views
How can I gathering Network Traffic on AWS?
I am building packet mirroring using the Linux type's iptables tee module. In the case of instances(EC2), we confirmed that promiscuous mode can be set on AWS console configuration. than, I wonder if ...
0
votes
1
answer
21
views
Slow apache restart or gracefull when tee is in use
I have this in each virtual hosts in my Apache HTTPD confs:
CustomLog "|$tee -a /www/domainX/logs/apache/acces_log" combined
On servers with more than 100 domains, there is an issue with ...
0
votes
0
answers
699
views
How to ensure output from "tee" is shown when used in a script run under systemd
I have a script that I'm running under systemd which has some debug logs that I'd like to send to both stdout (which should end up in the system journal, viewable with journalctl) as well as to a log ...
0
votes
1
answer
84
views
Can't empty log files
The servers at my work have a script made by me that every midnight copies log files to a folder, copies this folder to Amazon S3 and zeroes the original files.
However, I saw that the original files ...