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
156 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
29 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
56 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
87 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
31 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
91 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
86 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
52 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
  • 999
1 vote
1 answer
188 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
135 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
231 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,589
0 votes
1 answer
137 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
  • 729
1 vote
1 answer
517 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
32 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
270 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
69 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
334 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
  • 710
0 votes
1 answer
879 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
0 votes
1 answer
116 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
  • 193
3 votes
1 answer
153 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
108 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
0 votes
0 answers
76 views

Access /dev/stdout from wine process

Is it possible to write to /dev/stdout from a Wine Win32 (gui) process? I don't see Z:\\dev\ or Z:\\proc\ available using the file explorer from within the Wine process. The process is started using ...
Martijn's user avatar
  • 125
1 vote
0 answers
164 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
197 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
  • 105
0 votes
3 answers
241 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
41 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
  • 131
2 votes
2 answers
911 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
  • 611
1 vote
1 answer
293 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
  • 367
3 votes
3 answers
1k 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
  • 2,990
0 votes
0 answers
130 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
147 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
1k 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
250 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
653 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
877 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
65 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
  • 9
1 vote
1 answer
1k 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
3k 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,361
1 vote
0 answers
337 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
424 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
362 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
331 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
0 votes
1 answer
750 views

echo "Hello World" > /dev/stdout prints nothing

Scenario: $ echo "Hello World" > /dev/stderr Hello World $ echo "Hello World" > /dev/stdout $ uname -a CYGWIN_NT-10.0 xxx 3.3.4(0.341/5/3) 2022-01-31 19:35 x86_64 Cygwin ...
pmor's user avatar
  • 509
3 votes
1 answer
123 views

Send stdout to multiple downstream processes in a chain

I have a series of commands I run like this: cmd1 < input > foo cmd2 < foo > bar cmd3 foo bar > output Is there a way to do this without the intermediate files foo and bar? I'd also ...
obk's user avatar
  • 133
1 vote
0 answers
22 views

cut file and overwrite file [duplicate]

Let's say I have file.txt water 1 lorem 0 ipsum 0 I cut the last column and redirect output to file itself with this: cut -d' ' -f 1 file.txt > file.txt I expect current content of file.txt is ...
Muhammad Ikhwan Perwira's user avatar
0 votes
0 answers
249 views

Listening to stdout of a remote machine

I'm looking for a way to get a local terminal tail log from an stdout execution on a remote machine without directly executing with ssh. The general procedure is: The local client machine runs a ...
Oron Port's user avatar
  • 101
0 votes
0 answers
28 views

Behaviour for output of Command Substitution working with String variable with Pipes [duplicate]

For simplicity and how source/input of this post for the coming scenarios, observe the following java --version openjdk 11.0.13 2021-10-19 OpenJDK Runtime Environment Temurin-11.0.13+8 (build 11.0.13+...
Manuel Jordan's user avatar
0 votes
1 answer
236 views

mount cifs: how to retrieve the status of the command execution from the terminal?

The following mount cifs code works fine: sudo mount -t cifs //192.168.1.77/something /mnt/192.168.1.77/something \ -o username=alpha,rw,uid=alpha,gid=tango,dir_mode=0770,file_mode=0770,...
Manuel Jordan's user avatar
1 vote
0 answers
139 views

What is the proper way to check whether stdout was deleted

I need to check from a running C program whether stdout was deleted. By "deleted" I mean a situation when in /proc/pid/fd is written "deleted": ll /proc/91495/fd total 0 dr-x------ ...
ibse's user avatar
  • 257

1
2 3 4 5
10