stdout is the name of the default output file descriptor of a process. Since there is nothing special about `stdout`, you *should not* use this tag. Use [tag:io-redirection] for questions on how to redirect output, use [tag:file-descriptors] for questions on how to manage file descriptors, use ...

learn more… | top users | synonyms

1
vote
3answers
72 views

Store stdout and stderr in file, then recreate the output later

I've redirected output to a file like so: $ ./test.bash 2> >(sed 's/^/stderr: /' >> output) > >(sed 's/^/stdout: /' >> output) $ cat output stdout: Hello World! stderr: ...
4
votes
3answers
100 views

How to not show the stdout output of a running process?

When a running process gives lots of stdout output throughout its lengthy running process, you don't want to kill it and rerun it. How can you not show the output? Thanks.
0
votes
0answers
40 views

How to use stdout/stderr from multiple program

I'm working with Docker-containers. An important part of Docker is to log error, etc., to stdout/stderr. For example, I want to run the following program by using this command: nginx -g "daemon ...
14
votes
4answers
2k views

Write Python stdout to file immediately

When trying to write the stdout from a Python script to a text file (python script.py > log), the text file is created when the command is started, but the actual content isn't written until the ...
20
votes
2answers
1k views

Pipes, how do data flow in a pipeline?

I don't understand how the data flows in the pipeline and hope someone could clarify what is going on there. I thought a pipeline of commands processes files (text, arrays of strings) in line by line ...
0
votes
1answer
45 views

Redirect all bash script output (from inside the script) to two files: one append, one rewrite; but discard output to the console

I can easily redirect both standard and error output of a bash script to the file, while discarding an output to console with simple exec statement: exec &>>/var/log/backup.log But how do ...
0
votes
1answer
117 views

How do I grep on a live log (stdout)?

I'm not sure if that what stdout is, but that's what I think. What I want to do is filter out a certain log message when running an executable. I tried this: Executable 2>&1 /dev/null | ...
17
votes
3answers
1k views

Is it safe to type another command into STDIN while the previous command is writing to STDOUT?

Perhaps this has been answered previously, I would welcome a link to another answer... If I execute a shell command (in a bash shell) like the following: make Then while the output from make is ...
0
votes
1answer
79 views

Redirecting Standard Output And Standard Error to One File [duplicate]

I have come to understand that we have two methods of redirecting both stdout and stderr to the same file. The first method is: ls -l /bin > ls-output.txt 2>&1 As the author of this book ...
3
votes
1answer
102 views

stdout redirect. sh: resource temporarily unavailable

I have large batches of bash processes. Each bash script invokes executeables which have their stdout redirected to distinct log files. About 5% of the runs end up with: sh: [name of log]: Resource ...
1
vote
1answer
35 views

Why does the -v option with rm show entries with a backquote and a normal quote?

When I do rm -v on a set of files, I see the output list of files being deleted with a backquote and a regular quote, eg: rm -v rsl.out.0??? removed `rsl.out.0579' removed `rsl.out.0580' removed ...
0
votes
1answer
91 views

Pipe stdout to command on stdout

If I had a running process like tail -F watch.txt and I wanted to capture the stdout from this running process and pipe it to another command on stdout how could this be done? Here's an example of a ...
3
votes
2answers
355 views

How does Bash get the output of an executed program?

When I execute a program in Bash, for example, [ls][2], it sends its output to standard output (fd &1). And the ouput of the executed program is displayed in the terminal. How does Bash/terminal ...
1
vote
1answer
28 views

capture log of ufsdump when backup to stdout

I am backing a file system with ufsdump. In order to gain space in the remote file system I backup to stdout then pipe the output to compress. I find is more efficient that backuping up and then ...
0
votes
1answer
34 views

Force ping to write before interrupt

I am trying to get ping to continuously write some times to a file. When I run $ ping 10 10.1.10.28 | perl -ne '/time=(\d+\.\d+)/ && print "$1\n"' It returns one number every several ...
1
vote
1answer
45 views

Dynamic ~/.ssh/config

I'd like make my ~/.ssh/config file dynamically generated by a shell script (or anything else that prints to STDOUT). Is there a UNIX trick to make reading a file result in executing a command & ...
0
votes
1answer
46 views

Keep PHP's output with tee -a

Normally when running PHP script in web server mode, this would show up: $ php -S 0.0.0.0:12345 PHP 5.6.1 Development Server started at Mon Nov 24 14:09:22 2014 Listening on http://0.0.0.0:12345 ...
1
vote
2answers
460 views

Redirect stdin and stdout to ports

I'd like to take a program P that reads from stdin & writes to stdout, but connect it to nc or whatever such that it reads from a certain port and outputs to another port. # The reading is easy, ...
0
votes
2answers
57 views

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

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. Is there a way to send the same output to both the std ...
3
votes
1answer
214 views

Output of a python script running as unit is out of order while shells seems unnafected

How would I get all outputs of systemd managed python2 script instantly into journal, just like it appears in terminal I'm on centos 7, but seems to be same on arch according to systemd manual, ...
-2
votes
2answers
380 views

Corresponding 7zip command for unzip -p -a

I have a question regarding unzip command in Unix. As of now my Unix command unzip -p -a is able to zip the file which are lesser in size. But if the file size is larger then the command is not able ...
0
votes
0answers
110 views

Text replace literally *all* instances of a string through stdin, stdout

Linux, or specifically Ubuntu 14.04 LTS Server if necessary (and CENTOS 6.5/7 minimal would be nice). If I enter "FOO" at the command line, (regardless of whether as a word or as a substring), I'd ...
2
votes
2answers
60 views

Output piped content to file and show number of lines in the file on stdout

I would like to use tee to pipe content from stdout and stderr respectively into files (in fact append it with > >(tee -a $filename)). However, instead of seeing the contents appended to the ...
5
votes
6answers
2k views

Command to output file content to stdout?

I know cat can do this, but its main purpose is to concatenate rather than just displaying the content. I also know about less and more, but I'm looking for something simple (not a pager) that just ...
1
vote
5answers
199 views

How to overwrite stdout using echo? [closed]

We know to overwrite bar.txt, we can use this: echo "foo" > bar.txt but how can we overwrite to the standard output? I tried this command: echo "foo" > but it failed. I want this because ...
4
votes
1answer
95 views

unexpected output with grep

I am using pyrit. For those who dont know, pyrit allows among other things to check if a wpa handshake key is valid: pyrit -r file0.cap analyze when a file does not contain a valid key, here is ...
4
votes
4answers
309 views

A command that generates both standard error and output

I want to do some troubleshooting on my bash script. Is there a short and simple command that generates both stdout and stderr so that I can use 2>&1 on it? Sorry if this looks trivial, but I ...
1
vote
2answers
138 views

Call background process back to stdout

Is it possible to "call" a background process output to be shown in the terminal? Example: cron starts apt-get to update the system and I want to see the output of apt-get
5
votes
1answer
240 views

Rotating log files while process still running

I have a process running that writes standard output and standard error to a log file /var/log/dragonturtle.log. Is there anyway to rotate the log file, and have the process continuing to write to the ...
2
votes
4answers
217 views

Command line 'buffer' [duplicate]

I wanted to tail the last 100 lines of a file to the same file, but the command tail -n 100 file > file doesn't work, I assume because the stdout gets written to the file 'live', before everything ...
1
vote
0answers
16 views

Test execution output of a command before a pipe [duplicate]

I would like to test the execution of a php script that redirect its stdout and stderr to a file with tee. php /path/to/script --param 2>&1 | tee -a /path/to/log if ( test $? -ne 0 ); then ...
3
votes
2answers
90 views

Decoding “prog > file 2>&1”

I am having some difficulty understanding the construct prog > file 2>&1. I have read that it means "Send stdout and stderr to file". But my question is how? I understand that prog > ...
5
votes
2answers
134 views

How can I pipe stdout to another program?

I'm trying to setup a linter for my code and I only want to lint the coffeescript files that have changed in the current branch. So, I generate the list of files using git: git diff --name-only ...
4
votes
2answers
366 views

How to redirect stdout to a file and read from the same file simultaneously with another task?

I want to run a task (which takes quite a long time) remotely in Ubuntu Linux Bash via nohup and redirect stdout to a file, e.g.: nohup task > out.txt & From time to time I would like to ...
14
votes
2answers
966 views

How to find out what process is writing to STDOUT?

I have two instances of a process running. One of them is "frEAkIng oUT!" and printing errors non stop to STDOUT. I want to kill the broken process but I have to make sure I don't terminate the wrong ...
1
vote
3answers
408 views

Inserting the command line text before output in stdout (for pipe / redirection)

Consider the following bash constructs: ls /usr/include/asm > list-redir.txt ls /usr/include/asm | tee list-tee.txt In this case, list-redir.txt and list-tee.txt will be identical, and will ...
2
votes
1answer
89 views

stdout is empty

When a run the command: cellprofiler --get-batch-commands "/users/pmrotem/CellProfiler/example_project/output/Batch_data5_8.h5" in the shell, I get an output: CellProfiler -c -r -b -p ...
1
vote
2answers
133 views

grep a keyword from Mplayer output and send the rest to file

I am using mplayer. I want to send everything to a log file (/tmp/server.log), but I want the Volume output to be written to the terminal. I have seen that there is a way to split the output with tee, ...
2
votes
3answers
109 views

Script needs to read echoed line

So, I need to write a Bourne-shell script, where my script has to work with the line, that was just echoed to stdout - e.g.: echo *something* | myscript.sh [parametres...] This may be a basic ...
12
votes
3answers
1k views

tee stdout to stderr?

I'd like to send stdout from one process to the stdin of another process, but also to the console. Sending stdout to stdout+stderr, for instance. For example, I've got git edit aliased to the ...
5
votes
4answers
474 views

How do I break up a file like split to stdout for piping to a command?

I have a large .sql file full of SELECT statements that contain data I want to insert into my SQL Server database. I'm looking for how I could basically take the file's contents, 100 lines at a time, ...
5
votes
3answers
331 views

Piping commands, modify stdin write to stdout

echo Hello World | nano - | less I want to modify Hello -> Goodbye while in the the text editor. It does not have to be with nano. I am stuck with nano reading stdin but requiring me to write to a ...
4
votes
3answers
1k views

Dynamically trim stdout line width in Bash

Lately, I have been experimenting with the ps command, and sometimes long paths wrap to the next line (or two) and make it hard to read. I want to pipe the ps output into another program to limit the ...
2
votes
3answers
131 views

Is it possible to generate a separate file list when creating a tarball?

When using tar for backups I'd like to create a separate list of the files that is included in the archive for storing alongside the backup tarball. I also want to be able to store the error messages ...
3
votes
1answer
5k views

Linux : how to redirect stdout & stderr to logger?

I have a program I need to run at startup, it has output on stdout and stderr that I want to redirect to the system log using the logger command. What I have in my startup script is thie: ...
2
votes
3answers
203 views

How do I make pasted shell commands invisible?

I'm using an AutoHotkey macro to run some shell commands, i.e. ^`:: SendInput set c=".cshrc-acheong"{ENTER} SendInput set v=".vimrc-acheong"{ENTER} SendInput foreach d ( /home/acheong /home/tcama ...
2
votes
4answers
121 views

Can a running script identify the logging context?

Let us say I redirect the STDOUT, STDERR of a program to files. ./script.sh 1> output.log 2> error.log Can the running program find this out i.e. know the paths to these files?
2
votes
2answers
6k views

In bash script, how to capture stdout line by line

In a bash script, I would like to capture the standard output of a long command line by line, so that they can be analysed and reported while initial command is still running. This is the complicated ...
4
votes
4answers
696 views

Reuse last line of output from shell command

I am compiling something and depending on success (last line of output contains "success"= I want to scp the binary to the target. I'd prefer a piped oneliner. Is there a way to do this?
7
votes
2answers
473 views

Write lines to a file from less

While in vim I can write a range of lines from the file I'm viewing to another file. For example, :1,10 w outfile.txt will write lines 1 through 10 to outfile.txt. Can I do the same while I'm ...