Questions tagged [tee]
tee is a command line utility that reads the standard input and writes to the standard output as well as a file specified as an argument. Use this tag for questions about the tee command.
236 questions
0 votes
2 answers
466 views
Capturing terminal output from Debian upgrade, but tee breaks ncurses dialog?
I'm trying to capture all of the terminal output during an in-place upgrade of my Debian system. Here's the command I've tried to use: $ sudo apt full-upgrade -y -o Dpkg::Options::="--force-...
15 votes
2 answers
2k views
Why does "seq 1000000 | tee /dev/stdout" produce more single-digit numbers than expected?
I'm in Linux and in Bash. I expect seq 1000000 | tee /dev/stdout to always output 9 numbers from 1 to 9 and their duplicates (18 in total). But when I do seq 1000000 | tee /dev/stdout | grep -c '^[1-...
0 votes
0 answers
35 views
Why does `<command> | tee /dev/tty | :` (where `:` is the "no effect" or "does nothing" bash builtin) display nothing? [duplicate]
I wanted to use tee /dev/tty to look into the stream passing through a pipeline. While making some tests, I observed the following: ~$ cd /proc/self/fd /proc/self/fd$ ls 0 1 2 255 # Ok /proc/self/...
5 votes
2 answers
363 views
Duplicate stdout to pipe into another command with named pipe in POSIX shell script function
mkfifo foo printf %s\\n bar | tee foo & tr -s '[:lower:]' '[:upper:]' <foo wait rm foo This is a working POSIX shell script of what I want to do: printf %s\\n bar is symbolic for an external ...
2 votes
2 answers
532 views
what is the meaning and usage of 2>&1 | tee /dev/stderr
for the following command output=$(cat $file | docker exec -i CONTAINER COMMAND 2>&1 | tee /dev/stderr) what is the meaning and usage of 2>&1 | tee /dev/stderr? I google and 2>&...
1 vote
1 answer
264 views
bash: script running in pm2 unable to access file descriptors files at /dev/fd/
I have script script.sh: #!/usr/bin/env bash # pm2 seems to always run in `bash` regardless of `#!` echo "running in $(readlink -f /proc/$$/exe)" # Redirect to both stdout(1) and stderr(2) ...
0 votes
1 answer
129 views
How can I get stderr from mbuffer written to log file when using tee?
Having a bash script that essential only doing: mbuffer --md5 -i dummy.tar -o /dev/null A user of this script wants to use tee and store the output messages in a log file. ./script.sh 2>&1 | ...
0 votes
1 answer
190 views
can tee 'save' to stderr?
I know how to use tee, of course, I have used it many times. However, it is normally something like: du -h /some/directory | sort -h | tee census While this works fine, it means I don't see anything ...
0 votes
1 answer
246 views
Use grep to search stdout, without replacing stdout
At the moment, I have this in a wrapper script: 2>&1 ./update.sh | ts | tee -a ./update.log and this in update.sh: if apt full-upgrade -y | grep linux-headers then echo echo Need to ...
8 votes
1 answer
1k views
What is the '.tee_history' file?
This is a plaintext file, apparently limited to 300 lines. I use tee frequently on my system. $ file .tee_history .tee_history: Unicode text, UTF-8 text $ wc -l .tee_history 300 .tee_history $ tee --...
2 votes
1 answer
178 views
How to "render" ouput from a command playing with tput so only the final terminal-postprocessed result is kept? [duplicate]
I captured the output of a script that uses tput to draw certain things on screen. When I perform cat myoutput then everything is well seen (looks like terminal reinterprets it from beginning), but ...
0 votes
1 answer
194 views
Why is tee stopping in the middle when piped with nohup?
I'm running a script (in a Laravel project) that takes a few hours to complete. nohup to prevent it from exiting if my ssh session is disconnected. nohup php artisan do:thing 2>&1 | tee ~/tmp ...
-1 votes
1 answer
106 views
What does the tee l2r or r2l argument mean?
I saw a socat example here, where they use tee l2r | socat - "TCP:remote:5555" | tee r2l what does the l2r or r2l mean?
0 votes
1 answer
115 views
Can I use tee to display output that other utilities tend to suppress?
The macos pbcopy utility grabs its input stream and stores it in the system clipboard, without displaying anything. So, when I want to copy/paste the output of a command in the terminal, I typically ...
19 votes
3 answers
16k views
What is the `tee` command in Linux?
I am trying to interpret the following tee command: cat colors.txt words.txt | tee colorsAndWords.txt | wc Is my understanding, as follows, correct? cat colors.txt words.txt: This command ...