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

1
vote
1answer
123 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
44 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
81 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
188 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
341 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 ...
0
votes
2answers
586 views

Redirecting stdin with stdout to file

So I have a program that takes in user input and outputs text based on the input. EDIT2: I want to create a script that runs a C executable and the script feeds the C program input from a file and ...
5
votes
3answers
3k views

Output to stdout and at the same time grep into a file

I have a script that outputs text to stdout. I want to see all this output in my terminal, and at the same time I want to filter some lines and save them in a file. Example: $ myscript Line A Line B ...
8
votes
1answer
333 views

Output of command not in stderr nor stdout

I've stumbled on this issue, so I'm wondering how is this possible? Standard run of command: # zabbix_sender -c zabbix_agentd.conf -k mmysql.QCInserts -o 14 info from server: "Processed 0 Failed 1 ...
3
votes
2answers
459 views

Read data from a pipe for a certain amount of time (in seconds)

Is there an easy way to create a pipe that only lasts for a given amount of wall time? I want to be able to take a "snapshot" of what's being written STDOUT for a period of time (rather than bytes or ...
2
votes
2answers
80 views

redirecting std output and std error

I have been trying to figure out the relationship between file descriptors. One thing I don't understand is, how is: ls -l /bin/usr > ls-output.txt 2>&1 different from: ls -l /bin/usr ...
1
vote
2answers
175 views

Turning standard output hyphen into a single command

I am working with scripts that output xml and I am using xmllint to format the output. Xmllint requires a source argument, so I use the hyphen to pipe standard output to it: $> script.php ...
5
votes
1answer
37 views

IO and other shell commands when a program is not started by a terminal

I have several launchers on my desktop for various programs, and there is a "run in a terminal" setting for those launchers. When I check that setting, the program runs from a terminal, and logs its ...
3
votes
2answers
1k views

Tail -f piped through grep not outputing to file, but outputs to console

I'm using the following command tail -f /mydir/myfile | grep "searchterm" >> outfile Without the -f it works fine, but with the -f, which I need, nothing is written to the file. The ...
6
votes
2answers
2k views

GNU screen: print a detached session to stdout

I just want to have a quick overview of my detached GNU screen sessions. Is it possible to dump the current content to stdout ? Something like screen --print SESSION_NAME > file.txt
4
votes
1answer
628 views

Ksh loses data after piping 16K bytes

I recently found that ksh may lose some data after printing more than 16K bytes to the stdout if it is blocked for a couple of seconds. This test.sh script prints out 257*64 (16448) bytes: ...
2
votes
3answers
902 views

grep how to suppress display of non-matched file?

I am trying to find files containing a specific word using grep. There are many files in the directory (> 500) Command I run $ grep 'delete' * Output validate_data_stage1:0 validate_data_stage2:0 ...
1
vote
2answers
4k views

How can I get vsftpd version into shell variable?

I want to get vsftpd version into shell variable. I can get it to console with ease: # vsftpd -version vsftpd: version 2.2.2 Also I can get a lot of other info into variable: # i=`bash --version ...
0
votes
2answers
338 views

sudo: script launched from another script won't redirect standard output

I'm using AIX 5.3 with sudo 1.6.9p23. Sudoers file grants user fcomartin permission to run any command as user oas: fcomarti ALL=(oas) ALL User oas has a bash script called menu, which launches ...
9
votes
2answers
271 views

How a piped shell programs balance their output/input rates? [duplicate]

Possible Duplicate: Bash while loop and reading from pipe I come from web programming background, and find myself interested in one peculiarity of using a local shell. I understand that ...
2
votes
2answers
5k views

How to redirect error to a file?

I have this simple script which redirects the output and append it to a file. filename="/home/ronnie/tmp/hello" date=$(date) echo "$date" >> $filename Now, lets suppose I change date=$(date) ...
1
vote
2answers
616 views

Redirecting tr stdout to a file [duplicate]

Possible Duplicate: How can I make iconv replace the input file with the converted output? Can I read and write to the same file in Linux without overwriting it? $ cat test.txt This is a ...
3
votes
1answer
409 views

limit stdout to terminal output speed [duplicate]

Possible Duplicate: How can I limit the output speed of stdout? What's the easiest way to limit the speed at which stdout is output in a terminal, so that, for instance, tail -f outputs ...
7
votes
3answers
2k views

How do I make python programs behave like proper unix tools?

I have a few Python scripts laying around, and I'm working on rewriting them. I have the same problem with all of them. It's not obvious to me how to write the programs so that they behave like ...
3
votes
2answers
3k views

Merge two command results to one line when redirecting stdout

In a cron script I want to log CPU temperatures in the format [datetime] temp using date and acpi -t. How can I redirect (>>) these two commands to a single line in the log file?
7
votes
5answers
3k views

Output file contents while they change

I want to output a file's contents while they change, for example if I have the file foobar and I do: magic_command foobar The current terminal should display the file's contents and wait until, I ...
13
votes
2answers
761 views

Redirect stderr from an already running script

I've been running a script for several days now. I redirected stdout to $HOME/mylog, but didn't redirect stderr since I thought there would be nothing on it. Suddenly thousands of lines started coming ...
6
votes
1answer
1k views

Append output to a file and redirect stderr to null

How can I append the result of a command to a file and redirect stderr to null?
24
votes
4answers
5k views

How to do nothing forever in an elegant way?

I have a program which produces useful information on stdout but also reads from stdin. I want to redirect its standard output to a file without providing anything on standard input. So far, so good: ...
4
votes
1answer
182 views

Discard stdout of a command for t seconds

I am working on some batch scripts involving the following: Run some non-terminating sub-processes (asynchronously) Wait for t seconds Perform other task X for some time Terminate subprocesses ...
5
votes
2answers
642 views

Wrapping a shell script with tee

There is a bash script which prints some logs and allows some arguments. The script prints the logs to STDOUT. Let's say the script's name is AAA.sh I'd also like to make the script to print the logs ...
5
votes
2answers
1k views

Why does `cat`ing a file into itself erase it? [duplicate]

Possible Duplicate: IO redirection and the head command I just wanted to remove all but the first line of a file. I did this: head -1 foo.txt ... and verified that I saw only the first ...
3
votes
1answer
220 views

Supress startup messages on stdout?

I'm using tcsh, and have to source a group .cshrc file. This file echoes some messages, which is fine for normal shells, but causes problems with programs like scp and rsync. I can see the solution ...
7
votes
2answers
5k views

Execute command in remote active terminal

Suppose you have a terminal emulator (T1) open with a PID of 6350. From another terminal, type this command (C1): echo "ls\n" > /proc/6350/fd/0 This writes ls and the new line in T1 but does ...
7
votes
3answers
6k views

bash: /dev/stderr: Permission denied

After upgrading to a new release version, my bash scripts start spitting errors: bash: /dev/stderr: Permission denied in previous versions Bash would internally recognize those file names (which is ...
4
votes
2answers
915 views

Can I read and write to the same file in Linux without overwriting it? [duplicate]

Possible Duplicate: How can I make iconv replace the input file with the converted output? I frequently connect to amazon ec2 using their public DNS names ...
1
vote
1answer
143 views

How to see output of a running program over ssh

I use debian 6 on an embedded system which is supposed to run a program called pilot. The OS is configured to login as root without asking password (there is no monitor nor keyboard connected). After ...
3
votes
1answer
428 views

Redirecting/grep'ing an existing shell's STDOUT

I run a lot of long running processes (simulations) that print progress to STDOUT. I occasionally forget to redirect to STDOUT to a file I can grep, and it's usually too far along to restart. ...
29
votes
4answers
9k views

Can I pipe stdout on one server to stdin on another server?

stdout on one CentOS server needs to be piped to stdin on another CentOS server. Is this possible? Update ScottPack, MikeyB and jofel all have valid answers. I awarded the answer to Scott because, ...
21
votes
3answers
796 views

How can I limit the output speed of stdout?

I'm running CentOS 5.7 and I have a backup utility that has the option of dumping its backup file to stdout. The backup file is rather large (multiple gigabytes). The target is an SSHFS filesystem. To ...
5
votes
2answers
838 views

Why jobs aren't killed at logout when executed with “> /dev/null 2>&1 &”?

When you run jobs like the example below, they're killed when you logout: $ ./job.sh & However, when you execute them as in the below example, redirecting stdout to /dev/null and stderr to ...
3
votes
1answer
336 views

Shell script doesn't paint last line of stdout to screen without user input

I have a shell script that's happily doing all my backup process and writing progress to stderr and stdout, with one exception — the last line doesn't get written to my terminal (if I call the script ...
1
vote
1answer
317 views

selective stdout , stderr and logging using the script command [duplicate]

Possible Duplicate: Show only stderr on screen but write both stdout and stderr to file stdout , stderr and logging using the script command cat test.sh: rm -v foo.tmp date pwd cat ...
1
vote
2answers
409 views

stdout , stderr and logging using the script command

I have remove.sh which contains: rm -v test.tmp And I have install.sh which contains: script remove.log -c './remove.sh' What can I do so that whether or not test.tmp exists, I don't see any rm ...
6
votes
2answers
3k views

what is meant by connecting STDOUT and STDIN?

This is a newbie question. I'm reading a book, it says: Every process has at least three communication channels available to it: “standard input” (STDIN), “standard output” (STDOUT), and ...
1
vote
4answers
6k views

Can I access Nth line number of standard output?

Assuming a script that outputs a list of files: $> bash someScript.sh path/to/some/file path/to/the/file/i/want/to/work/with path/to/yet/another/file Now I want to have the second file-path as ...
8
votes
3answers
7k views

bash: Use a variable to store stderr|stdout redirection

Is there any way to redirect stdout and stderr via variable like adding command options in script? For example I have a script: #!/bin/bash -x TEST=">/dev/null 2>&1" OPT='-p -v' mkdir $OPT ...
1
vote
3answers
1k views

routing wget --recursive to stdout (as in -O -) rather than a file

I want to "scan" a website content, recursively, and pipe it to another program. When I run: wget -r -O - $SITE I get WARNING: combining -O with -r or -p will mean that all downloaded content ...
4
votes
1answer
2k views

Writing to stdout except for output redirection C

I have to make a simple app for school. I have to write arguments one per line on the terminal, and return on stdout the user choices. For example, I write cat my_app main.c main.h, if the user ...
1
vote
1answer
68 views

Can I use tail with a file both as input and destination?

I have a log file that gets big fast. I tried using tail with this syntax but it didn't work. tail logfile.log -n 100000 > logfile.log The output file is 0 bytes and blank. What am I doing ...