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 [tag:...

learn more… | top users | synonyms

3
votes
4answers
344 views

How to slow down the scrolling of multipage standard output on terminal?

On a cluster where I am part of the management team, I often have to go through the multipage standard output of various commands such as sudo find / to look for any troubles such as broken links or ...
0
votes
1answer
32 views

System messages in vim

O/S: Arch Linux (Kernel 4.3.3-2-ARCH) While editing files with VIM 7.4 it occassionally happens that system messages appear on the screen, ruining my workflow but obviously not altering the ...
0
votes
1answer
21 views

Redircting stdout to file, but duplicating stderr to both file and terminal [duplicate]

Redirecting stderr to file and duplicating stdout to both file and terminal is easy: $ prog 2>error.log | tee output.log tee will duplicate stdout, printing it to both terminal and output.log. ...
2
votes
1answer
102 views

How to sort files separately without merging?

File1: Brazil New Zealand Argentina Uruguay File2: Chile Russia Latvia Switzerland I realize that the command sort -n File1 File2 will sort all the files merged together and display it ...
0
votes
0answers
27 views

save outputs and errors to external file from lxterminal

I run compiled python program like this on my linux box (runs automatically after start lxterminal LXDE lxsession autostart): @lxterminal -e sudo /home/user/app.exe > /home/user/app.out 2>&...
20
votes
4answers
1k views

How to invoke vim editor and pipe output to bash

Sometimes I need to write text and then pipe that text into another command. My usual workflow goes something like this: vim # I edit and save my file as file.txt cat file.txt | pandoc -o file.pdf # ...
1
vote
1answer
45 views

System is no longer outputting UTF-8 characters

I just had an issue with my server where it responded incredibly slowly, so I forced it to reboot over SSH. When I connected back, I found out my system no longer outputs certain characters correctly. ...
8
votes
5answers
473 views

Is there a tool to dynamically redirect output to a new file on request

I'm currently redirecting the output of a monitoring tool to a file, however what I'd like to do, is to redirect this output to a new file on my request (using a keybinding), without stopping the said ...
2
votes
1answer
50 views

non-blocking/multi-threaded cat

cat is blocking from what I see in the code, i.e. it uses blocking read() and then it uses blocking write(). I want to call some tool where I disable all stdout buffering by purpose (e.g. like ...
3
votes
2answers
36 views

stdbuf supposed behavior for subprocesses

I didn't exactly find something about the following in the man-page. How is the supposed behavior in subprocesses spawned by a process which was itself spawned by stdbuf? E.g.: stdbuf -oL myprog ...
0
votes
1answer
41 views

How do I output stderr/stdout of my script to both a file and the console?

I'm using Amazon Linux and writing a script in bash. I want to output both stderr / stdout (preferably in the order that they occur) to a file as well as the console. However, this command isn't ...
2
votes
1answer
37 views

Unable to redirect stdout/stderr to log file [duplicate]

I have a script tmp.sh #!/bin/bash echo hello sleep 3 echo 3 I want to log the script running time (as well as script stdout) to a log file. user$ time ./tmp.sh >& log.tmp real 0m3....
3
votes
2answers
78 views

What are the default stdin and stdout of a child process?

I would like to know what are the default stdin and stdout of a child process (if there are such defaults). Are stdin and stdout of a child process the same as its parent process? Is this something ...
1
vote
1answer
29 views

Save number of lines output to a variable in a shell script without consuming the output

I have a shell script where I have a if statement based off of the number output lines output from another call. (In my case do something there is more that 1 line of output). LINES=$(function_call | ...
1
vote
2answers
13 views

redirect the output of {time}

I am trying to benchmark a single request agains a webserver, and am having a problem doing so, specifically, I am having an issue redirecting the output of the time command. If i simply run time ...
0
votes
1answer
19 views

Check if stdout is attached to a terminal from an AWK script

Is there any way I can check if an AWK script's stdout is attached to a terminal, just like test -t 1 in a shell?
0
votes
2answers
66 views

Will the stdout output of a background process be taken as the stdin input of the foreground process?

When a background process outputs to stdout to appear on terminal, will the output be taken as stdin input to the foreground process? Note that the background and foreground process are not related by ...
0
votes
2answers
69 views

Redirect stdout to file with nohup doesn't work

I'm trying to run a C-program in the background. I also want to save the stdout-outputs of the program. But if I try the following, nohup only redirects stderr-outputs to the logfile.txt: nohup ./...
1
vote
2answers
31 views

I want to catch the STDERR and STDOUT of Background running script

I have to run a script background and also i have to catch the STDERR and STDOUT . i'm using the below line . test.sh & >> log_file 2>&1 But un fortunately nothing is getting ...
3
votes
3answers
109 views

Direct output to pipe and stdout

I was wondering if there is a way to pipe the output of a command and direct it to the stdout. So for example, fortune prints a fortune cookie and also copies it to the clipboard: $ fortune | tee &...
1
vote
1answer
67 views

`docker logs foo | less` isn't searchable or scrollable but `docker logs foo 2>&1 | less` is

Using either one gives readable text. But only with the stderr redirect can one scroll or type /somepattern and get matches. Without it searching gives "Nothing to search (press RETURN)" and a ...
0
votes
0answers
19 views

Where is the logging of an application launched from the GUI buffered before being sent to a log file?

This is a fairly difficult question for me to word, but I'll try my best. When I launch an application from the terminal, say, Banshee as an example (so banshee to launch from terminal), I can see ...
1
vote
2answers
215 views

Read from and write to file from stdin and stdout

I need to continually read from and write to a (virtual) file in bash, without closing the file in between. I'm looking for a program which will open the file for read and write, read from stdin and ...
1
vote
1answer
22 views

Prevent script from generating stdout if called from given program

I want my gnome-terminal to show my current user and host in its titlebar, and that of the remote when I am using ssh. To do that, I created a script ~/bin/ssh, with ~/bin in my PATH before /usr/bin: ...
4
votes
3answers
194 views

Trying to make sense of bash redirection syntaxes and their outputs

I'm new to Linux and trying to understand how redirections work. I have been testing various syntaxes for redirecting stdout and stderr to the same file, which don't all produce the same results. ...
3
votes
2answers
48 views

vim: Force specific syntax via command-line argument

When I want to easily read my PostgreSQL schema, I dump it to stderr and redirect it to vim: pg_dump -h localhost -U postgres dog_food --schema-only | vim - This gives: vim does not have a ...
1
vote
2answers
72 views

shell stderr to /dev/null

I have PID file and I want to get PID number so this is what I am doing. [root@linux ~]# PID=`cat /usr/local/foo/var/run/foo.pid` [root@linux ~]# echo $PID 3414 sometimes this file doesn't ...
0
votes
1answer
43 views

Create a two line text file without anything written to stdout

So basically I want to write a two line file containing this: This is line one This is line two I can easily do this by doing this command in bash: echo "This is line one\nThis is line two" > ...
2
votes
2answers
60 views

How to store the printout of the last command in a shell variable in urxvt/zsh?

I'd like to have the printout (stdout and stderr) of the last command run within zsh available in a variable ready to use grep, etc on it.
1
vote
0answers
21 views

Suppress warning of rbenv versions if no rubies installed

At the moment I'm working on Ansible role that installs ruby with rbenv. In order not to install same ruby version every time I run setup task I have to check that no needed ruby is already installed. ...
2
votes
2answers
92 views

Output is in console but not part of stdout or stderr

I have a command that outputs the following: READY Listening.... HELLO READY Listening.... TEST It is speech recognition from pocketsphinx_continuous. I need that output redirected to a file, and ...
3
votes
5answers
250 views

Concatenate contents from stdout and from file

How can we concatenate results from stdout (or stderr) and a file into a final file. For example ls -a | grep text1 concatenate with file2.txt into a final result (not file2.txt), without storing ...
16
votes
5answers
957 views

How to trick a command into thinking its output is going to a terminal

Given a command that changes its behaviour when its output is going to a terminal (e.g. produce coloured output), how can that output be redirected in a pipeline while preserving the changed behaviour?...
2
votes
3answers
35 views

What is regarded as “ideal” in relation to using stdout/stderr for output in different situations?

I have seen stdout and stderr used in a variety of different ways - as far as I understand, it is common to use stdout for general information and stderr for errors and the like. However, I have also ...
3
votes
1answer
170 views

vimdiff to compare output instead of files

I am trying to compare two command output (no files) vimdiff "$(tail /tmp/cachain.pem)" "$(tail /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem)" I tried playing with redirection, pipe, and vim - ...
0
votes
4answers
187 views

How to display output of command while also parsing it?

I have two commands, build and deploy. Currently I run build manually, parse its output using my own eyes, and use a value I find in the output as an argument to deploy. The process looks something ...
0
votes
0answers
20 views

Piped sequence - printing

I need to write a piped sequence of commands that prints out a list of all sub directories of a current directory. In order to get all sub directories of a current directory I use: ls -D Since I am ...
0
votes
2answers
327 views

how to redirect output of ssh to a file

I want to make ssh connection to my server but I don't want to enter password. I want to save output to a file like so: $ ssh root@x.x.x.x -p 22 1>output 2>&1 but when I run it the output ...
0
votes
4answers
113 views

How to log from inside the script along with stdout

I am aware that I can log using tee But I want to log from inside my script, at the same time display the content on the stdout. Example, my code looks something like this: names=$(print("name1 ...
0
votes
0answers
105 views

Stop stdout log being clipped (by heroku-local)

I run heroku local with the Procfile: web: start-nginx gunicorn -c gunicorn.conf.py app:app start-nginx does some environment setup, and then ends with: { nginx --some-params & $@ ; } the ...
2
votes
2answers
1k views

pipe stdout-to-file with wc

I'm working on a lab assignment for a class, which exemplifies users | wc -w as displaying the number of users currently logged in. The instructor has asked we write the output of users to a file (...
0
votes
2answers
45 views

Unclear where bash output is going

I made a small script to output the list of vim plugin remotes to a file, so I could figure out what ones I want to keep or remove. However, when I run it, the output doesn't get piped to the file. ...
1
vote
2answers
136 views

Duplicate stdin to stdout and stderr, but in a synchronized way

I need to duplicate the stdout of a producer and feed it to two consumer in a synchronized fashion. consumer 1 producer | duplicator | consumer 2 ...
0
votes
2answers
76 views

Printing on “standard out” and “standard error”

I'm puzzled over some terminology used in my homework: So, the way I understand the question is that I should print echo, cat, etc., which I would do like with the echo command, for example echo ...
0
votes
0answers
36 views

fs_usage: a part of stdout is missing.. Where did it go?

I'm using $ fs_usage -f diskio to spy on processus when I hear my hard drive spinning for no reason, so that I know who is working so hard.. Here is one sample line: 16:14:13.785568 WrMeta[AT3]...
1
vote
1answer
109 views

How to know if output is being redirected to a file? [duplicate]

I am working on displaying output like ls command (just ls, no options). And I have a working program using the system calls. But I experienced a strange behavior while testing as shown below. $ ls ...
1
vote
3answers
170 views

in bash script; a process stdout as filename argument fails when you open it more than one time

Consider this bash script code: #!/bin/bash function bug_part() { cat $1 > sample.first cat $1 > sample.second #second time you open file $1, it contains no data } bug_part <(echo "...
6
votes
2answers
115 views

Notification Listener Behaving Strangely when Backgrounded

I've been struggling to get my IRC-Bouncer/Notification Script working. This is meant to be a script which will automatically login to a remote machine, attach to a screen session (or start one if ...
1
vote
1answer
203 views

Prevent ssh-keyscan from generating output

Problem: When running ssh-keyscan in cron it emails me the output of ssh-keyscan every day. The email simply contains the following. # <hostname> SSH-2.0-OpenSSH_5.3 My (simplified) cron ...
5
votes
6answers
14k views

How to add new lines when using echo

Why the following command does not inserts new lines in the generated file and what's the solution? $echo "Line 1\r\nLine2" >> readme.txt $ cat readme.txt Line 1\r\nLine2