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

0
votes
1answer
16 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
53 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
33 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 ...
2
votes
1answer
39 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
226 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
62 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
45 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 ...
4
votes
6answers
777 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
124 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
80 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
291 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
59 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
127 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
108 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
79 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
104 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
148 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 ...
13
votes
2answers
848 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
183 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
59 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
83 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
106 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 ...
9
votes
3answers
913 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 ...
4
votes
4answers
226 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
1answer
209 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
732 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
109 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 ...
2
votes
1answer
2k 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
167 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
108 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?
1
vote
2answers
3k 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
433 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?
5
votes
2answers
292 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 ...
7
votes
2answers
295 views

Kill a process if it goes quiet for a certain amount of time

I have a utility that has a nasty habit of going quiet and staying there, I already know how long into the process it does this so I am using timeout to fight this, but sometimes it does it before ...
-4
votes
2answers
93 views

What is the utility of piping to `/dev/null`?

Seeing that /dev/null's utility isn't immediately obvious to me, what is the use of /dev/null piping?
4
votes
1answer
136 views

Can redirecting stdout and stderr to the same file mangle lines?

I've read that when redirecting stdout and stderr to the same file using 2>&1, stdout is usually block buffered while stderr is unbuffered. If a very long line is written to stdout, requiring ...
3
votes
1answer
78 views

What is the relationship between a program's output, standard output, and its file descriptors?

Let's assume that I am running wget which is downloading something. It's printing some text to my terminal and writes the downloaded data into a file. From a terminology point of view, what is the ...
2
votes
2answers
136 views

Show a sliding window of output from a program

I want to run a command (rsync -av) and only display 10 lines of output at any time. I have found a similar post, but I don't want to redirect it to a file. I want the output to be displayed ...
3
votes
2answers
239 views

Bash if script is called from terminal echo stdout to terminal, if from cron do not echo output

I would like to have a service watchdog script echo the status to the screen if called like ./watchdog.sh but if it is run by cron, there is no need to echo output. What is the proper method? Where ...
4
votes
4answers
234 views

Any way to cat few lines of man page to show on stdout for reference?

This is a simple question. Trying my best to put it in simple word. Hope you get it without much confusion - I read a man page for some command-switch/option which has a long description. I read it, ...
5
votes
1answer
476 views

`unbuffer` or `stdbuf` for removing stdout buffering?

Is there a difference between unbuffer(1) and stdbuf(1)? From what I gather, unbuffer makes more than the "best effort" of calling the libc function set(X)buf at the beginning, and then letting things ...
2
votes
3answers
122 views

How can a command have more than one output?

In this answer, at the very bottom, Gilles mentions that a command can have more than one output or input. Yes, there's cat foo bar | something, for having both foo and bar as inputs, and there's tee ...
3
votes
5answers
1k views

How to use filename arguments or default to stdin, stdout (brief)

I want to handle filenames as arguments in a bash script in a cleaner, more flexible way, taking 0, 1, or 2 arguments for input and output filenames. when args = 0, read from stdin, write to stdout ...
1
vote
1answer
119 views

Pipe not picking up stdout

I am running a java program from a OS X 10.8 bash terminal, and are trying to rederect the output it is producing. However, when either running this throug a pipe, or rederecting it to a file, the ...
2
votes
1answer
42 views

aptitude produces output twice

For quite a while, I get a double output of some messages from aptitude. Here’s an example: > sudo aptitude install mpw Couldn't find package "mpw". However, the following packages contain "mpw" ...
10
votes
2answers
1k views

Script to quickly test all keyboard keys

I need to check some notebooks for bad keyboard keys, and so I'd like to speed that up as much as possible. I found nothing for this specific task, so my idea is a script that reads the pressed keys ...
5
votes
1answer
79 views

Is it possible to create sticky redirection from stdout/stderr

Consider such code: echo hello >> log.txt echo world >> log.txt I execute command with stdout redirection. Is it possible to create sticky redirection? Something like this: redir ...
4
votes
3answers
178 views

Where does the output from an application started from the window manager go?

If you start an application from a terminal you can see the output to stdout and stderr, but if an application is started from the window manager, where does the output to these files typically go? To ...
1
vote
2answers
333 views

Getting specific line from terminal output

"Hmm, I need to edit file-i-must-edit-2, but I cannot remember where it is." locate file-i-must-edit /home/user/file-i-must-edit-1 /home/user/file-i-must-edit-2 /home/user/file-i-must-edit-3 ...