io redirection is the process of changing where the output and input of a program originate

learn more… | top users | synonyms (1)

2
votes
1answer
43 views

One of several file-append redirections of “python --version” is repeatably 'overlooked' by bash, but the others aren't [on hold]

Why is bash consistently passing one, specific redirected output from python --version to the console rather than appending to file, while every other output is redirected properly? I am developing a ...
0
votes
0answers
21 views

Redirect keyboard input to unfocused program

I'm looking for some help with a computing issue. I'm running Openbox 3.5.2 on Raspbian/Pi3 and a single monitor. I want to have one program focused and in fullscreen while the keyboard outputs to ...
5
votes
0answers
28 views

Piping the output of a bash script after redirecting stderr

because of the way my hoster does things I have to use a system for services. This service has a run file which it executes and pipes into a second run file. But I use a (given) python package that ...
1
vote
0answers
13 views

How to limit/monitor a cgroup process's blkio when process has output redirection

I have some questions on cgroup blkio controller. I want to limit the IOPS on a specific process. This process uses IO redirection to write the stdout contents into a file. I tried to put the ...
1
vote
1answer
33 views

Redirect bash variable into netcat

I am attempting to write a bash loop that passes a bash string into netcat. The command that I execute is: nc -nv [ipaddress] [port] << EOF 10000 EOF I am writing a bash loop to perform this ...
2
votes
1answer
30 views

How do I discard unwanted fail messages from an ssh command?

I'm trying to avoid printing messages to the console received when a lun is not found during an ssh command. SSH is to a NetApp filer. Command is being run on a Solaris 10 host. Here is some of the ...
1
vote
2answers
55 views

Bash redirection doesn't work for SQLite command

Bash allows for piping to stdin from another command in this way... $ ls /bin/aud* | cat /bin/audacity /bin/audiocompose /bin/audiosend ... ...and this way as well: $ cat <(ls /bin/aud*) /bin/...
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. ...
0
votes
0answers
21 views

Bash Script to start a service on Ubuntu Linux 16.04

Does the following Ubuntu 16.04 bash script command: exec /usr/lib/mono/4.5/mono-service.exe \ /home/frank/Debug/My_Camera_Recorder.exe "$@" >& /dev/null start the My_Camera_Recorder ...
1
vote
1answer
57 views

stderr not redirected to stdout

I run a TACACS+ server which sends debug information to stderr. As I would like to grep specific data from this debug information, I redirected stderr to stdout: tac_plus -f /usr/local/etc/tac_plus....
0
votes
1answer
36 views

How to redirect the warning message from command line to a log file?

I have a below loop that is used to check the active namenode in Hadoop cluster and if the first node is inactive it picks up the second. for (( i=0;i<$(($(wc -l < $LOCAL_DIR/'tempip.txt')/3));...
0
votes
1answer
22 views

Cache not filling error when using mplayer to read from stdin

I have a program that's generating audio and I can't get mplayer to play it. I'm doing ./myprogram | mplayer - -cache 1024 -cache-min 30 -noconsolecontrols And I get the message Cache fill: X% (Y ...
2
votes
1answer
47 views

redirect split output

I split a gz file using gunzip piped to split: time gunzip -c file.gz | split -l 500 -d -a 4 - pref_ Which generates the following files: pref_0000 pref_0001 I'd like to pipe those files to zip ...
0
votes
2answers
52 views

Can sed save its output to a file?

> can do it. echo "text" > file tee can do it. echo "test" | tee file Can sed do it without using either of the above? Is it possible to save the output of a sed command to a file without ...
1
vote
0answers
15 views

Redirect all output, including input prompts [duplicate]

I know that doing command &> /dev/null suppresses all output file descriptors. But I notice that it does not work for commands that request input from the user, most notably ssh: > ssh ...
2
votes
2answers
59 views

What does the < (left chevron / triangle bracket) do? [duplicate]

I am having a difficult time wrapping my head around this. I understand that the > (right chevron) is for redirecting the STDOUT of a program to a file, as in echo 'polo' > marco.txt will ...
0
votes
1answer
57 views

Redirect output of: yum repolist all

If you run the command: yum repolist all you will see there are basically four columns of data. repo id, repo name, status, install count. If however your run something like: yum repolist all > ...
0
votes
2answers
30 views

nohup with at the end <&- [duplicate]

nohup grunt server:debug >grunt.out 2>&1 <&- & I have a nohup command that ends with <&- . What does this direction do? Can some explain with pointers. I did search ...
0
votes
2answers
30 views

operate on different sections of stdin without intermediate file

Is there a simple way to do this with redirection or pipes without creating FILE1? I want to apply process2 to the body of the output of process1, without touching the first and last few lines. ...
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 ...
0
votes
2answers
39 views

Why cant I overwrite a file with processed value?

This question prompted a thought I was not sure I understood well. I know that it is not possible or correct to use pipelines like cat myfile | grep -v mypattern > myfile due to how file handles ...
5
votes
2answers
32 views

What exactly happens if input and output file is the same?

Let's say that I execute following command: tr a-z A-Z < file > file There are two redirections: < file and > file. Both are processed before tr command and as far as I know, if there ...
0
votes
1answer
37 views

unzip without replacing original file and report to log

I want to write a bash script to decompress a file without overwriting the original one and redirect the operation result into a log file. I found an answer to the first part of my question at: How ...
8
votes
4answers
579 views

Bash program not executed if redirection would fail

In bash, I notice that if a command using redirection would fail, any programs which run prior to that are not run. For example, this program opens the file "a" and writes 50 bytes to file "a". ...
2
votes
2answers
364 views

How can I redirect the output of a child process?

I am running the following git clone command through sudo and bash and I want to redirect STDOUT to a log file: % sudo -u test_user bash -c "git clone https://github.com/scrooloose/nerdtree.git /home/...
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....
1
vote
0answers
29 views

Deleted file being written to by running process, can I recreate it? [duplicate]

I've started a long running process with nohup and redirected it's output to a log file Example: nohup ./bin/zkServer.sh start-foreground > /usr/local/myuser/logs/zkout.log 2>&1 & I ...
0
votes
1answer
43 views

How to generate a text report in Linux?

I have a command I'm using to find all of the *.xml files on our server. I'm using: find -type f -exec grep -il "xml" {} \; This is great, but there are maybe a thousand files like this on the ...
0
votes
2answers
52 views

How is redirection implemented?

Is redirection a concept of the shell, not of the OS kernel? How is redirection implemented in terms of system calls? Is redirection implemented similarly to pipe?
0
votes
1answer
31 views

Change a file while redirecting it as stdin input to a command

In Bash, while running mycommand < myfile, I modify myfile's content. What content of myfile does mycommand get? Does mycommand get the original content of myfile when i started running it, or ...
1
vote
2answers
80 views

Why is this script looping on the first line of the txt file?

#!/bin/bash usernameFile="/home/netadmin/username_list.txt" logFile="/var/log/netvpn-mag-archive/netvpn-mag-20160" while read -r line < $usernameFile; do if [[ "$line" != " " ]]; then ...
2
votes
1answer
28 views

Connect via telnet and doing certain operations

I'm trying to code a script where I can connect via telnet to another server and execute certain operations, but I'm having problems with the result of this process. The objective is to connect to a ...
0
votes
0answers
21 views

Emptying a log file getting updated with 2>&1 output redirection [duplicate]

I have a server which constantly writes outputs and errors to stdout and stderr. The command line I use for running my server is: Server options-list > log.txt 2>&1 & Now the problem ...
0
votes
2answers
55 views

Piping sed/grep output does not work

If I run the commands bellow, only out1 has output, the out2 and out3 are empty. # this is just to generate a self-signed certificate openssl genrsa -out /tmp/ssl.key 2048 openssl req -sha256 -new -...
1
vote
2answers
113 views

How to redirect STDIN of background process?

In my Ubuntu, i run java application in background. I use bash script to run it and now it looks like: nohup java -jar app.jar & exit 0 The problem that i want to be able to write an input ...
10
votes
1answer
814 views

Shell variable $_ not behaving as expected

What the reason the number of lines differs? $ head -n 100000 ./access.log > ./data/log.sample $ cat $_ | wc -l 1933424
0
votes
1answer
21 views

Archlinux'es pacman + tee == unclear console IO [closed]

I have a small issue with capturing the pacman's IO with the tee utility. I try this command line: pacman -S group-1 group-2 | tee pacman.log And there is an issue: when the pacman query which ...
1
vote
1answer
41 views

“time > time.txt” refuses to work propely

I just started learning Linux commands. I was experimenting with the > command, that, as far as I understand, makes the command before it write it's output to the file after the sign. This ...
0
votes
1answer
31 views

Redirection Error in Function [closed]

I'm trying to figure out why the code below doesn't work, and gives me an error Bad file descriptor. It is sort of a follow-up to this question as applies to the script I'm currently working on. ...
3
votes
2answers
85 views

Returning a String and Understanding Redirection and Output

I'm trying to figure out how redirects could be used to selectively output a string from a bash function which needs to print multiple lines to the terminal. I found an answer on this question at ...
1
vote
2answers
51 views

Difference between 1> and >

Is there any difference between (# comments taken from documentation) command > filename # Docs: Redirect stdout to a file. and command 1> filename # Docs: Redirect stdout to file "filename....
2
votes
1answer
31 views

Sending `time` command into text file [duplicate]

I want to get the result of time command into a text file but it's not working it only put blank space in the text file. I already tried this commands, A- $ x=`time` $ echo $x > log.txt $ cat ...
4
votes
1answer
78 views

File descriptors and redirect in bash

Can someone explain why this command works: gpg --enable-special-filenames --verify --batch \ <(curl -s https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.0.29.tar.bz2.sig) \ <(curl https://www....
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. ...
0
votes
2answers
61 views

How can I clear/empty a file being piped to?

Say I have some process which pipes to a file: yes > foo I know want to clear/empty the file foo, but still want the process to write to the file, i.e. start filling the file again after ...
0
votes
1answer
87 views

avahi-daemon fails to start with “Failed to chroot(): Permission denied”. But only without stderr-IO-redirection

After a recent upgrate, avahi-daemon is not starting up anymore. Furthermore, the behaviour differes weather if I redirect stderr to a file or not. If I start avahi-daemon --debug with debugging ...
2
votes
1answer
48 views

redirect to a named pipe

I know the difference between > and >> when redirecting to a plain file. But is there a difference when redirecting to a named pipe (fifo)? Assume the namedpipe is a named pipe. Are the ...
3
votes
3answers
58 views

redirecting output of a command as if it was file input

I find myself always having to arrow up and going backwards through the command line to change one part of an earlier command that is pipped to a later grep or head or whatever command. For a crude ...
2
votes
1answer
33 views

Possible redirection bug in zsh 5x

[This post's title needs some work; suggestions welcome.] The following command produces different outputs in zsh v. 4.x and 5.x: { ( printf "X\nY\n" printf "WARNING: foo\nWARNING: bar\n"...
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 ...