Questions tagged [stdout]

Stdout is the standard output stream is the default destination of regular output for applications.

124 questions
607
votes
13 answers

Can I make cURL fail with an exitCode different than 0 if the HTTP status code is not 200?

I was always assuming that when curl got an HTTP 500 response it was returning an exit code that meant failure (!= 0), but that seems to be not the case. Is there a way I can I make cURL fail with an exitCode different than 0 if the HTTP status code…
knocte
  • 6,381
335
votes
7 answers

How do you redirect wget response to standard out?

I have a crontab that wgets a PHP page every five minutes (just to run some the PHP code), and I want to send the output of the request to standard out, while sending the normal wget output to /dev/null (or otherwise hide it). I couldn't find it in…
78
votes
11 answers

Log rotation of stdout?

I have a Linux program which can write information to stdout and stderr. I have a shell script which redirects that output to a file in /var/log. (Via >> and 2>&1.) Is there a way to make that log file rotate? (max size, then switch to a different…
Miral
  • 1,269
49
votes
5 answers

tee for Windows?

Does Windows provide the basic tee facility for copying standard input to an arbitrary set of files and then back out to standard output? I generally download a generic tee program, but curious if something like this exists in powershell or…
Jé Queue
  • 970
43
votes
3 answers

How to tar/untar the output on the fly

What is the idiomatic way to do the following tar to stdout read this tar output from stdout and extract to some other folder. My solution is tar --to-stdout .. | tar -C somefolder -xvf - But may be there is more idiomatic way to do it.
shabunc
  • 820
40
votes
4 answers

Windows: Command line redirection to text file while also seeing output

I'm writing a C program in Windows, my printf calls print to the command line, and I know that I can redirect all this output to a text file using: myProgram.exe > mylog.txt However, I wish to also see the output that would have been printed to the…
user79397
  • 503
36
votes
4 answers

Determine if output is stdout or stderr

How can I determine if what a process is outputting is stdout or stderr?
Rauffle
  • 694
  • 2
  • 8
  • 13
31
votes
3 answers

Pipe gunzip and mysql to gunzip a dump and import it

I have a .gz sql dump file (example: foo.sql.gz) that i want import in my database with the classic mysql command. gunzip -c foo.sql.gz > foo.sql mysql -uroot -ppassword foo < foo.sql foo is the database. How can i pipe these two commands in a…
31
votes
1 answer

Copy terminal output to Mac clipboard?

I need to directly copy the terminal stdout to the clipboard on Mac. How would I do this? Example: echo sometext | copy_to_clipboard or echo sometext > /private/clipboard.txt
26
votes
5 answers

Watching something be written to a file live with tail

I have a python program which is, slowly, generating some output. I want to capture that in a file, but I also thought I could watch it live with tail. So in one terminal I'm doing : python myprog.py > output.txt and in another terminal : tail -f…
interstar
  • 853
21
votes
4 answers

Why does the output of some Linux programs go to neither STDOUT nor STDERR?

Why does the output of some Linux programs go to neither STDOUT nor STDERR? Actually, I want to know how to reliably capture all program output, no matter what 'stream' it uses. The problem I have is that some programs do not seem to let their…
21
votes
3 answers

Windows how to redirect file parameter to stdout? (Windows equivalent of `/dev/stdout`)

Windows console: Tool A can write binary data to a file, but has no option for telling it to use stdout. Tool B can read binary data from stdin and process the info in it. How can I get the output from A piped through B without using an…
17
votes
2 answers

How does ls know how to output its results?

While creating a bash script, I found that this code ls puts all files on one line: pi@raspberrypi:~/ptlrestinterface$ ls update.sh web.config MyApp.runtimeconfig.json still ls | head -n1 still prints only the first…
Bart Friederichs
  • 1,876
  • 6
  • 25
  • 43
14
votes
4 answers

How can I stop cat output immediately despite massive output?

I'm looking for someway to stop the output to STDOUT when I realize a command is wrong. For instance, if I accidentally cat a very large file. Usually it will eventually stop if you hold down ctrl + c, but it takes a long time. Is there a way to…
CHK
  • 607
14
votes
3 answers

Two Programs having their StdIn and StdOut tied

Suppose I have two programs called ProgramA and ProgramB. I want to run them both simultaneously in the Windows cmd interpreter. But I want the StdOut of ProgramA hooked to the StdIn of ProgramB and the StdOut of ProgramB hooked to the StdIn of…
1
2 3
8 9