0
votes
2answers
47 views

Redirect two stdout to one stdin in Linux bash

I've got a C program that reads from stdin and does some operations. I am asked to enter information periodically (every 20 sec), and leave the user interaction the same while doing some tests. Is ...
0
votes
1answer
18 views

What is the difference between redirection 2>&1 1>file.txt and >a.txt 2>&1?

What is the difference between redirection ./prog 2>&1 1>file.txt and ./prog >a.txt 2>&1? It looks that ./prog 2>&1 1>file.txt doesn't save stderr to file but this ./prog ...
1
vote
1answer
79 views

Solve this hex riddle! - What went wrong with my output redirection?

Following on from my question TF101 Android: Image block device via adb in which I tried unsuccessfully to save a raw image of a block device by output redirection, this question tries to determine ...
1
vote
1answer
63 views

How to redirect ALL output from a command in Linux

I'm running Gentoo Linux. A program (equery) outputs a massive list of all the currently installed packages (equery list "*"). I want to find out which of them are unstable. Equery marks the unstable ...
0
votes
1answer
33 views

How to make redirected input count as command output

I have a simple C console program that takes some keyboard input and outputs prompts and calculations. I also have two text files: a file with input for the program, and a file that contains the ...
0
votes
1answer
225 views

How do you redirect traffic for all IP addresses on an AdHoc network?

Sometimes when I sign into a businesses WiFi network the server/router redirects all traffic to their sign in page where I have to click accept (or pay) before getting access to any other pages. How ...
0
votes
1answer
191 views

Subdomain redirection to a home server with public IP

If I have a subdomain in my webhost, is it possible to redirect it to a sever that has a public IP? I created a subdomain using CPanel on my webhost. Because hosting costs are relatively high where I ...
0
votes
0answers
112 views

pipe a serial port to a command that blocks? </dev/ttyACM0 nc -l 1234

For practical purposes I have only one shot at testing this, so I wonder how will </dev/ttyACM0 nc -k -l 1234 work when no client is connected. Will the kernel buffer all the serial data, will the ...
0
votes
0answers
40 views

HTTP Redirect to local Webserver

I've got a small Linux machine which I use as an WLAN-Router (hostapd & udhpd). On the same server there's running a webserver with a website. Now I want to redirect everyone who joins the WLAN to ...
0
votes
2answers
46 views

Per executable UDP port redirection possible?

I have a black box program which listens on a particular UDP port. I'd like it to listen to a UDP port of my choosing. Is there a way to trick the executable into listening on a differen port. I ...
1
vote
1answer
45 views

Linux - Output to Folder that Yet Exists (in one command)

Is it possible to achieve this in one command without requiring a script: echo "test" > /folder/that/does/not/exist/newFile.txt
1
vote
1answer
67 views

Upstart and process substitution

So I want to use the following in my script stanza: forever -l >(tee $QW_LOG_DIR/webserver.log | logger -p user.info -t '[QW]') start webserver.js However, that doesn't work for at least two ...
0
votes
1answer
92 views

Bash conditional redirection when testing/debugging

What is the best way to conditionally do a redirection in Bash for testing and debugging purposes? In my scripts I add a debug option to show what would have happened effectively doing a test run ...
0
votes
1answer
123 views

Linux redirect to login shell after login action

I am using CentOS 6.4 operating system and everything was good until power-system crash :/ After successfully reboot I am normally asking for login/pass and after login shell redirects me to login ...
0
votes
1answer
36 views

Redirecting User to Folder Within Apache on Linux

I want the user to access http://www.xyz/internal/, then I need authentication and based on the user I will then send them to a subdirectory. So the scenario is, if user TOM goes to .../internal/ I ...
0
votes
0answers
219 views

Redirect traffic from 80 to 8080 using iptables

I have two interfaces eth0 and eth1. Traffic is copied (reflected) from another machine to my eth0 so that I can analyse it. On eth1, my analysing software listening port 8080 is installed. I want to ...
-1
votes
1answer
95 views

Manually add a DNS “A” record in a text file (no cPanel, ancient server)

My boss has me working on an ancient server at his place where there is no fancy cPanel to create sub/addon domains. Basically what we have is a plain-text file that appears to be controlling all the ...
4
votes
1answer
567 views

Why does redirection fail when passing through ssh, sudo and sh?

After reading this question, I know that I have to do sudo sh -c 'ls -hal /root/ > /root/test.out' to avoid the "Permission denied" error. But when I do ssh hostname sudo sh -c 'ls -hal /root/ ...
3
votes
1answer
368 views

Why can I see password prompts through redirecting output?

So, I've got a command that I'm issuing that is essentially 'ssh'ing into various hosts: command 2&>1 | grep "desired output" Every once in a while, in the midst of the command, it'll run ...
0
votes
3answers
170 views

Redirect a Domain if server is down

I am currently searching for a way to redirect users if my server is down. Is there any way to do such a thing? Like: If someone wants to connect to my Teamspeak-Server but its offline, it should ...
0
votes
1answer
354 views

how to telnet redirect ip and host using iptables

I try to telnet from PC 3 To PC 1 and it's redirect to PC 2 PC 1 : 192.168.0.1 PC 2 : 192.168.0.2 PC 3 : 192.168.0.3 i have command like this in PC 1: iptables -t nat -A PREROUTING -p tcp -d ...
1
vote
3answers
376 views

Obtain both merged and separated stdout and stderr

I am looking for a way to run a program Prog and end up with 3 files: The stdout of Prog The stderr of Prog Both stdout and stderr of Prog combined just as they would be on screen if no redirecting ...
1
vote
1answer
287 views

Redirecting to /dev/null and a file at the same time

I'm trying to execute the following command: find . -name ".[ch]" | xargs grep -in pattern > file There are some errors that are printed on stderr because a few files are not found. How can I ...
1
vote
1answer
349 views

Redirect output of remote python app started through ssh to file

I have a python app in a remote server that i need to debug, when I run the app locally it prints some debug information (including python tracebacks) that i need to monitor. Im trying to redirect ...
1
vote
2answers
249 views

Nested Redirection in BASH

I have a scenario where I want to filter log files. To do this I am wanting to follow the last 10 lines or so of a log file and as new lines are read in, pipe them through an awk program and then ...
2
votes
1answer
549 views

Unix bidirectional pipe on commandline

I've been able to use this linux command to connect Netcat to a serial port: nc -l 80 <> /dev/ttyS0 I would like to be able to log this transaction. My backup plan is to use Wireshark to ...
1
vote
3answers
3k views

Redirect stdout while a process is running — What is that process sending to /dev/null

I've run a command and redirected it's output via > /dev/null Now that it's been running significantly longer than I expected I want to see what it's doing. Is there a way to re-redirect the ...
9
votes
6answers
17k views

Why redirect output to 2>&1 and 1>&2?

I have come across several commands that use 2>&1 and 1>&2 but quite can't get my head around the purpose of using it and when I should be using it. What I understand I know that 1 ...
2
votes
2answers
493 views

Why is find exec grep > file an Infinite Loop?

I was trying to collect all of the Message-ID: headers (lines) in a directory with 200K .eml (plain text) files. A bit naively, I said: find -type f -exec grep -Fi "message-id:" {} \; > ...
2
votes
1answer
314 views

Scripted command line with redirection fails

The following works from the command line, but fails as script: gunzip -c /disk1/hadoop/gunzip_tmp/in/part-00006.gz >> /disk1/hadoop/gunzip_tmp/outfile.000 The following script lines: ...
1
vote
1answer
505 views

Gunzip redirection: “No such file or directory”

When I issue the following command: gunzip -c /disk1/hadoop/gunzip_tmp/in/part-00006.gz>>/disk1/hadoop/gunzip_tmp/outfile.000 I get the following stderr: gunzip: ...
0
votes
3answers
717 views

Redirecting Command output to file

This seems so simple when doing it from command line but I'm not able to accomplish it inside a script. I am trying to put output of following command into a text file: CMD= mysql -uroot -psecret -e ...
9
votes
3answers
2k views

What is the difference between &> and >& in bash?

What is the difference between &> and >& in bash? tldp did not mention the latter one. Is it really a redirection operator? Or does someone know a more complete tutorial?
2
votes
2answers
238 views

When to use pipes and when to redirect?

Although this is a basic stuff, but still i wonder. Consider these two examples. Case 1: [root@dhcppc0 practice]# cat file1 > wc -l cat: invalid option -- l Try `cat --help' for more information. ...
3
votes
3answers
149 views

Distinct Proxying for any TCP-related Protocol

I'm not sure what to call it (proxy/redirection/relay), and I am hoping some software or solution possibly exists for linux. My intention is to be able to listen on a single public facing ip:port ...
2
votes
1answer
242 views

Splitting output to two terminals

How can I split an output of a command to two terminals? one will get stdout and the other will get stderr. The best I could do is: On first terminal: bash command args 2> errors and on second ...
13
votes
3answers
15k views

How to wget a file with correct name when redirected?

So after some time of searching on google and superuser (and scanning man pages) I was unable to find an answer to something that (I think) should be simple: If you go here: ...
10
votes
5answers
6k views

Log rotation of stdout?

I have a Linux program which can write information to stdout and stderr. I have a shell script which redirects that output to a file in /var/log. (Via >> and 2>&1.) Is there a way to ...
7
votes
1answer
650 views

Is backwards redirection the same as a pipe?

In Linux if you type sort < txtfile is that the same thing as cat txtfile | sort
1
vote
3answers
1k views

Why does a redirect from a local IP address assume localhost?

I am developing a web application on my desktop and it is running on port 80. I am able to access the application from my laptop connected to the LAN by entering my desktop's LAN IP address ...
2
votes
4answers
2k views

How to redirect the output of a program to the linux diff command

I have a program that writes to stdout. Is there a way that I can redirect the output to the linux diff command or do I have to write the output to a file and then compare that. For example I have a ...
11
votes
2answers
4k views

How can I use '{}' to redirect the output of a command run through find's -exec option?

I am trying to automate an svnadmin dump command for a backup script, and I want to do something like this: find /var/svn/* \( ! -name dir -prune \) -type d -exec svnadmin dump {} > {}.svn \; ...
0
votes
2answers
229 views

Local URL Redirector

Is a free/open source software available where I can create simple aliases that will redirect to different servers? For example, if I were to type: "http://go/wp" it would redirect me to ...
2
votes
1answer
510 views

Getting back to “stdin” after redirecting a file to a particular program

I need to achieve a particular effect using bash's redirection facilities. I know that I can redirect a file to some program's standard input: [user@host]$ application < file.txt The thing is, ...
0
votes
2answers
331 views

Linux redirectors not logging errors. Does Linux have the equivalent to Windows' 2>&1?

I run the following file with the > log.log redirector, and it does not capture errors. #!/bin/bash echo ************************BEGIN LOG****************************** date +"%m/%d/%Y %H:%M:%S ...
0
votes
3answers
179 views

File redirection in bash

What's the difference between using > and >>? How can I use both < and > (redirection operators) in a single command?
0
votes
2answers
572 views

Why does nginx redirect to a strange URL?

I had just set up nginx on my server. I have PHP and everything working okay. Except when I try the URL http://xxx.xxx.xxx.xxx/123 I get redirected to http://_/123 but when I try the url ...
0
votes
1answer
281 views

How to stop redirection to /dev/pts/x

This is an examination senario. We have mulitple users logging into a RHEL-4 server using putty. These people are part of a same group. They are giving UNIX shell script exam. They are helping each ...
3
votes
1answer
152 views

output redirection with sudo [duplicate]

Possible Duplicates: How to append to a file as sudo? sudo unable to write to /etc/profile The following command does not work because the elevated privileges do not apply to the ...
1
vote
2answers
3k views

Redirect Domain Name to Localhost

I have a linux test machine which I would like to run a copy of a production webserver. This is a legacy application which does not use a property file for its server name. Throughout the application, ...