Skip to main content

Questions tagged [stdout]

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 the [io-redirection] tag for questions on how to redirect output, use [file-descriptors] for questions on how to manage file descriptors, use [lock] for questions of file locking, and use [files] for general questions on file operations.

Filter by
Sorted by
Tagged with
0 votes
1 answer
72 views

How to put all function/command call output results to different corresponding vars: for stderr, for stdout, for string result and for return code?

I want to extend question How to store standard error in a variable and get general solution (bash function or functions) to extract from the called function/command together with standard error also ...
Anton Samokat's user avatar
0 votes
1 answer
45 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 ...
AaronD's user avatar
  • 153
2 votes
1 answer
53 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 ...
Whimusical's user avatar
0 votes
1 answer
51 views

How to bring disowned command back into current terminal (stdout)

I executed a command which I then disowned so that it can continue to run in the background, even if I closed the terminal. The command is: badblocks -v -s -w /dev/sdb > badblocks_result.txt 2>&...
LogicalDeveloper's user avatar
0 votes
1 answer
56 views

How to identify what file descriptors are associated to STDIN, STDOUT etc

I seem to remember some command or envvar that tells you this. I'd like basically something that executed on terminal, for instance, give you echo $STDIN /dev/tty echo $STDOUT /dev/tty fdescribe 0 or ...
Whimusical's user avatar
0 votes
2 answers
97 views

Where output of Bash itself goes?

For one script I wanted to redirect "[1] 00000" message that appears my shell after sleep 100& command. I don't need that anymore, but while struggling with that problem, I start ...
Basher's user avatar
  • 1
0 votes
1 answer
62 views

Capture output from SOX "-n stat"

I am trying to capture/pipe the output from the following: arecord -f S16_LE -qd 5 file && sox file -n stat output: Samples read: 8000 Length (seconds): 1.000000 Scaled by: ...
Mark Miller's user avatar
1 vote
0 answers
43 views

Why can't I cat a file, pipe it to jq, and redirect the output to another file? [duplicate]

I want to use jq to pretty-print a JSON-format file, and pipe the result to another json file. My first instinct was cat foo.json | jq > bar.json but this results in an empty bar.json: $ cat <&...
StoneThrow's user avatar
  • 1,787
3 votes
3 answers
800 views

When and where are the standard in, out, and error file descriptors first opened in linux?

Where are stdin, stdout, and stderr (the fds) first opened? Is it the kernel that does it? And when and where are the symlinks /dev/std{in,out,err} made? Where is the code that does it? I assume it is ...
Elfen Dew's user avatar
4 votes
2 answers
1k views

How do I reliably capture the output of `ls` in this script?

The following script, play_movie.sh is meant to automatically select a movie if there is only one in the current directory and play it with ffplay. Otherwise it is meant to display a selection of ...
John Smith's user avatar
-2 votes
1 answer
126 views

let background process write to stdout of foreground process

I have an nginx docker container, which needs to run an extra node server in the background (I'm not able to use two containers/docker compose). I can add a script into /docker-entrypoint.d/ and nginx ...
Devin Rhode's user avatar
2 votes
1 answer
386 views

Force rsync to output messages line-by-line

(I'm not sure if this question should go on StackOverflow or here. But the actual problem is with rsync, so on balance I reckon it's a Linux question. If admins disagree, by all means please migrate ...
Sod Almighty's user avatar
0 votes
2 answers
185 views

Why might I want to avoid such echo-like way of using `printf` when printing to stdout? [duplicate]

I wrote the following script when trying to understand how printf works: #!/usr/bin/bash printf "Give me your three preferences.? " read p1 read p2 read p3 printf "%s\n" "${...
John Smith's user avatar
0 votes
0 answers
60 views

Bash script ignores all terminal input following an underscore [duplicate]

Goal My server manages jobs using SLURM. Each job in the queue has a job ID, which can be either a single integer or two integers separated by an underscore, e.g., 123_4. You can use scontrol show job ...
Jamin's user avatar
  • 1
0 votes
3 answers
441 views

retrieve std out redirect to /dev/null

is there a way to retrieve std out redirected to /dev/null? I tried tail -f /proc/{PID}/fd/1, looks like only works except redirects to /dev/null. i.e. tail -f /proc/${cmd_pid}/fd/1 works on cmd > ...
furynerd's user avatar
3 votes
1 answer
131 views

How to ensure that SSH client leave stdout file descriptor clean for reuse?

This code terminates with error : ( ssh localhost seq 100000 seq 100000 ) | wc #-> seq: write error: Resource temporarily unavailable This is a minimal code to reproduce the write error. ...
Thibault LE PAUL's user avatar
1 vote
1 answer
59 views

How to search for strings in the output of previously run commands

Say, for example that after running a number of commands: $ cd /opt/something $ find . -name *aa | grep 11 $ clear $ <more commands go here> there was a part of the output that was needed ...
Sebi's user avatar
  • 1,029
1 vote
1 answer
570 views

How to write a script's output to both a rotating log file and to stdout?

we run our microservices inside containers as K8s pods. To make sure that our app gets any signals sent to the container (in particular the SIGTERM on pod eviction), we usually use exec at the very ...
PalatinateJ's user avatar
0 votes
1 answer
247 views

Pipe zip & unzip together to form the identity function

Update: On closer inspection of the man page it appears that it is not yet supported by unzip to read archives from standard input. The man page refers the user to funzip instead. I guess this makes ...
Rewbert's user avatar
  • 131
0 votes
0 answers
475 views

How to read an arbitrary process's stdout pipe in Linux?

I have a child process launched via Supervisor that's somehow become disconnnected from its parent and is running but not outputting to the parent's log file anymore. However, it's still running, and ...
Cerin's user avatar
  • 1,727
0 votes
1 answer
283 views

Archive verify `gzip -v -t` prints success to stderr or I'm doing something wrong? [duplicate]

I want to add gzip file verification to my backup script. My backup script creates logs for stdout and stderr like this: scp -i $BCKIDENTITYFILE $BCKLOG "$BCKREMOTEUSER"@"$BCKHOST":...
Kamil's user avatar
  • 749
2 votes
1 answer
1k views

Systemd limit StandardOutput file size

I created a systemd service on my Pi 4 that writes std output to a file using StandardOutput=file:/file/location/file.log. Is there a way to limit the file size of the log file to prevent it from ...
SudoObey's user avatar
1 vote
0 answers
34 views

Probe the output of "screen" every 30 minutes

I have a program running in a "screen" session. It displays one line every 5 seconds to the console. I would like to "probe" this output twice every hour and initiate another ...
SEU's user avatar
  • 219
0 votes
1 answer
446 views

why isn’t all the output (`stdout` and `stderr`) redirected?

I have some understanding of how the stdout and stderr file descriptors work. But sometimes they don’t catch all the output and I trying to understand why. For example, cloning into a git repo gives ...
alex23ro's user avatar
0 votes
0 answers
343 views

How to view the output of a running process in another bash session on mac?

I have a process running and I would like to know what it prints to stdout and stderr. On linux I would do tail -f /proc/<pid>/fd/1 See here How do I do this on macOS?
User12547645's user avatar
0 votes
1 answer
701 views

how to NOT show syslog info messages on terminal TTY

I have a home media server in the kitchen (OMV / Debian). I have one physical terminal open - display and keyboard running musikcube player that shows browses and plays the music library. Looks very ...
r0berts's user avatar
  • 730
0 votes
1 answer
2k views

SSH client connection without banner (on client)

I am developing a simple script, which connects to certain computers and executes, through an ssh session, certain commands: sshpass -p 'password' ssh $target_ip << EOF echo \$PATH # ...
Fco Javier Balón's user avatar
1 vote
1 answer
209 views

How `stdio` recognizes whether the output is redirected to the terminal or a disk file? [duplicate]

#include <stdio.h> #include <unistd.h> int main(void) { printf("If I had more time, \n"); write(STDOUT_FILENO, "I would have written you a shorter letter.\n", 43); ...
arka's user avatar
  • 253
3 votes
1 answer
213 views

Why is the stdout line buffering for cut -c differ from cut -b?

Our RHEL 7 machines have great long Log files and I asked about buffering of cut in this question. That question remains but a bit of experimentation showed a different issue. I decided to try using ...
user1683793's user avatar
0 votes
1 answer
182 views

Is there any way to view older stdout in zsh (or anything else)?

I ran a command today that: printed some stdout text that stdout is no longer viewable by scrolling through the shell (because zsh's scrolling stops) Is there some way to access that output? ...
Raphael Rafatpanah's user avatar
1 vote
0 answers
237 views

How to suppress php output in one-line chained terminal command

I use the following &&-chained one-line command in Linux terminal (Ubuntu desktop): cd /opt/lampp/htdocs/detailed_payouts && for FILE in *; do dos2unix $FILE; done && php /opt/...
mercurio's user avatar
0 votes
0 answers
302 views

Is it possible to create PDF with Generic CUPS-PDF Printer to stdout, no to file?

I know that Generic CUPS-PDF Printer can read bytes from stdin. For example, so: cmd = ["lp", "-d", "PDF", "-stdin"] process = Popen(cmd, stdin=PIPE, stdout=...
maskalev's user avatar
  • 185
0 votes
3 answers
429 views

save tar stdout to files using pipelines

I try to download a archive to a remote computer using SSH and also extract the archive on the remote client due to it having better performance. I have a very simple script that downloads the archive ...
Lumnezia's user avatar
  • 111
3 votes
1 answer
51 views

Ambiguous bash stream redirection

I am trying to understand the Bash redirections (3.6. Redirections). I prepared the test envronment and I'm trying to understand the order of operations with redirections and order of created file ...
Benjamin's user avatar
  • 141
3 votes
3 answers
2k views

Accurately overwriting previous lines of bash terminal output when text is wider than terminal (e.g. wraps mutliple lines)?

TL;DR - I know how to overwrite lines of output normally but none of the methods I've used previously (e.g. printf '\e[1A\e[2K') or have found online seem to work when the line being overwritten is ...
zpangwin's user avatar
  • 891
1 vote
1 answer
844 views

pipe and tee doesn't receive output in a file..(bash)

I wanted get the resout of ps command to a file like this. (in bash) $ps -eax |& tee list1 and I see many lines from the ps command but the file list1 is empty. How should I do it?
Chan Kim's user avatar
  • 397
3 votes
3 answers
2k views

How to print to stdout after exec >/dev/null

In a script, I have a long list of commands that print to stdout. I want to hide all output. So instead of redirecting each command, I put exec >/dev/null at the beginning. What options do I have ...
finefoot's user avatar
  • 3,132
0 votes
0 answers
176 views

How to pass standard streams through a pseudo-terminal (in C)

Here is my contrived use case: write a C program that hooks into stdout and stderr in order to passively examine those text streams before sending them along to the console as usual. Each time the ...
mszinger's user avatar
1 vote
1 answer
191 views

clarification on how the shell redirects stdin for two built-in commands in the background and foreground

I have a really small question. Let's take this command as an example cat < file.txt. When the shell sees the <, it redirects stdin (0 file descriptor) by forking a new process and only changing ...
Kenshie van Assche's user avatar
0 votes
1 answer
2k views

How to save a result of any command into a variable?

Let's take this command sudo doveadm pw -s SHA512-CRYPT -p '$$!!!555;###..>^$$' How can redirect its output into a variable?
kesha933's user avatar
0 votes
2 answers
338 views

Fork stdin to stdout & stderr?

I am wondering if it's possible to fork standard input to stdout & stderr? Something like this, $ echo "hi" | fork > std.out 2> std.err $ cat std.out hi $ cat std.err hi Or, am I ...
David Streid's user avatar
-1 votes
1 answer
915 views

Why is “echo $SHELL” not captured by remote SSH output?

When I capture the output of a remote SSH call using cat, whether in bash or in Python, things work as expected. E.g, this works just fine: import subprocess rc = subprocess.getoutput(“ssh user@host; ...
Scott Skiles's user avatar
3 votes
2 answers
1k views

How to get the "process IDs" which are logging output to stdout?

How do I get the PIDs of all the processes which are dumping output to stdout.
Always_Beginner's user avatar
0 votes
0 answers
69 views

Questions on shell redirection [duplicate]

I am studying for my RHCSA and already have my Linux+ and I'm trying to better understand shell redirection beyond just understanding the basic use cases and I am trying to grasp it at a deeper ...
Kyle's user avatar
  • 109
1 vote
1 answer
2k views

Why dmesg output displayed on /dev/tty1

This is still related to my yesterday thread, so there's alert or maybe it's just log that displayed on my terminal on /dev/tty1. Ofcourse it's annoying because it's displayed in my bash prompt, so ...
Muhammad Ikhwan Perwira's user avatar
1 vote
1 answer
4k views

Why does this screen session exit when the command is finished? [duplicate]

I know screen -dmS mysession command to start a screen, launch a command and detach. When we need to redirect the stdout to a file, this works: (see How to run a program in a screen, redirect all ...
Basj's user avatar
  • 2,549
1 vote
1 answer
646 views

How to call pinentry from bash script

How to call pinentry from bash script so I am prompted for single input on the same terminal from which my script was invoked from and then pipe the entry to some other command via stdout for the sake ...
Hnus's user avatar
  • 111
1 vote
1 answer
655 views

websocat / wscat save a new file per seconds

This question is about saving a wss:// stream into multiple files... while execution (NOT AFTER) EXAMPLE : websocat "wss://stream.binance.com:9443/ws/btcusdt@depth" > /path/$(date +%s)....
John R's user avatar
  • 115
2 votes
2 answers
424 views

Watch output piped to /dev/null

I have a few scientific programs that can run from a few minutes up to several days. The program prints progress information to stdout which ends in a carriage return. If the program runs for several ...
Kilian's user avatar
  • 23
0 votes
0 answers
385 views

How do I capture binary output from a process different from the console output?

I'm currently able to launch a process from within Java's ProcessBuilder, which continually appends to a (binary) file output.WAV, and is continually dumping lines of console updates. That works ...
Benjamin H's user avatar

1
2 3 4 5
10