The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [redirect]

Redirection is the switching of a standard stream of data so that it comes from a source other than its default source or so that it goes to some destination other than its default destination.

Filter by
Sorted by
Tagged with
1
vote
2answers
163 views

What does >&2 mean in a shell script? [duplicate]

I am doing my homework and I have a question about one line. I don't understand what this >&2 means: if test -d $2 then echo "$2: Is directory" >&2 ; exit 21 fi
0
votes
0answers
41 views

Whats the difference between 0> and > redirections?

I cant redirect the output of a particular program using > , but it works if i use 0> , e.g ./foo > ouput.txt ./foo 0> output.txt this program writes to the standard using the C ...
1
vote
1answer
40 views

How to redirect a command's output to file, when the command is via a wrapper's system call?

I want to redirect both output and stderr to a log file. Easy enough, right? python3 /home/user/Utilities/gpu.py L1.py &> log_L1.py.txt & However, when instead of calling the command ...
1
vote
0answers
31 views

Permanent redirect on Ubuntu for Mosquitto bidirectional MQTT traffic

I need to permanently redirect all traffic in the short term from an old mosquitto server to a new one until the firmware updates have been completed on the edge devices. I tried using iptables as ...
0
votes
1answer
44 views

Redirection cannot open for reading

I ran the following command and I am not able to understand why I am getting this error : tail /var/log/fontconfig.log 1 >> /home/myuser/b.log tail: cannot open '1' for reading: No such file or ...
0
votes
0answers
51 views

Purpose of < or > in this terminal command? [duplicate]

I have to call a program in this way via the terminal: ./program < input.txt > output.txt What purpose do < and > serve in this case?
12
votes
3answers
2k views

How to pass 2>/dev/null as a variable?

I have this code that works: # Hide irrelevant errors so chrome doesn't email us in cron if [[ $fCron == true ]] ; then google-chrome --headless --disable-gpu --dump-dom \ "$RobWebAddress"...
1
vote
2answers
59 views

understanding bash redirection using > char

I am learning bash and am not able to understand what is going wrong with the output redirection in the following example: I have a file called myfile.txt with the following content. Practice makes ...
0
votes
0answers
37 views

Redirect file paths

Is there an easy way to filter and redirect file accesses to certain files? For example all requests to /D/00/*.jpg should access the physical file /mnt/sdb1/00/*.jpg. Is there a tool providing a ...
1
vote
1answer
756 views

How do I select a USB drive folder for an application output?

I'm attempting to install a new app on an Ubuntu 18.04 system. I want to redirect the files outputted to a USB drive, rather than on my SSD. eg: /var/snap/sabnzbd/common/Downloads/incomplete to ...
0
votes
0answers
22 views

How i connect my home ubuntu server with any domain and access outside network

I have an old computer and i have converted into ubuntu server i have installed openssh apache2 and php .I can access it on the network but now i am find a way to connect my server with my domain and ...
11
votes
5answers
950 views

Shorten or merge multiple lines of `&> /dev/null &`

Every time starting the machine, I run the following program: $ cat start.sh #! /bin/bash google-chrome &> /dev/null & lantern &> /dev/null & xdg-open . &> /dev/null &...
2
votes
3answers
545 views

How do I suppress GtkDialog warnings in zenity and yad using Bash redirection in a script?

I'm trying to suppress GtkDialog warnings in zenity and yad: $ zenity --error --text hello Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged. Error redirection and ...
0
votes
0answers
45 views

Reset debug/verbose mode logging in bash script

I use a cronjob as root to check via lsof if some remote machines have established an ssh tunnel to the main server (root, otherwise lsof and netstat won't show the username and sshd pid). Then for ...
0
votes
0answers
607 views

How to prevent 'Bad Request' error while opening HTTP address on a Apache server with SSL (with non-default port)?

as you may know if you configure apache2 with SSL (non-default port) and open it with 'HTTP' address you will get this error: https://[ip-address]:20443 --> http://[ip-address]:20443 Bad Request ...
0
votes
0answers
165 views

Redirecting input from a file with youtube-dl

I am trying to redirect input from a file in which some youtube links are stored, I am using given below command to download those videos.. youtube-dl < link_file.txt but above command gives an ...
0
votes
1answer
120 views

Bash: sudo -S <<< “mypassword” - interactive shell issue

I'm trying to use sudo with -S to issue the password via command line. $ sudo -S <<< "mypassword" command This works, but it doesn't allow for interactive commands. Like nano for example: $...
2
votes
1answer
353 views

how input redirection works?

On my understanding, any command that reads from standard input (i.e keyboard), that it gets its input from a file. $echo < text_content.txt $ But echo command does not read and display the ...
0
votes
0answers
20 views

Why do I get different output from the same commands? (redirect and piping) [duplicate]

So I'm learning to use the CLI and I'm playing around with redirecting and piping and then I get different output from executing the same commands. Basically I'm listing all executables from /bin/ ...
1
vote
1answer
470 views

How to redirect in local domain web site www.mydomain.com/website to www.mydomain.com

I have install simple web service (MediaWiki) in my local server. In my DSN server I have set IP address to this webserver, so now when I call in browser (this works only in my domain IP range) www....
-2
votes
1answer
74 views

What is the stdout output in stream-redirection labs?

Inside the ‘stream-redirection’ folder there is a program called ‘program’. When you run this it will output to stdout and stderr. What is the stdout output? I have tried ./program, but it did not ...
2
votes
1answer
123 views

Can I redirect a file to the terminal? [duplicate]

I know I can redirect all terminal output to a file, but does that work the other way around? Can I have a terminal window open, in Tmux or elsewhere, that is receiving redirected output from a file ...
3
votes
1answer
188 views

Bash file redirection bug?

From what I understand about program IO, there are stdin, stdout, and stderr data streams (and a return code). stdout and stderr are the two data output streams. So if I use bash redirection to close ...
1
vote
1answer
74 views

How to write to crontab using here document syntax << >>? [duplicate]

I'm trying to add a cron job without actually opening vim or nano. Something like this: $ crontab -e << echo '* 0/10 * * * some command' I'm seeing stuff online like this and this, but ...
0
votes
0answers
70 views

need help with commands in terminal [duplicate]

I am stuck trying to figure this out. the question for my homework goes like this: For this question, run the script at /var/standardStreams.sh. This script will create some output text on different ...
1
vote
0answers
211 views

'tail -F' behaving unexpectedly on truncated file

I'm trying to follow everything written to a log file in a terminal. In terminal 1 i do: tail --retry --follow=name /tmp/test_log or alternatively: tail -F /tmp/test_log In terminal 2 i ...
2
votes
3answers
453 views

How to insert a line break between stderr and stdout

This question helped me understand how to combine stderr and stdout: How to redirect stderr to a file with this command: gunzip -vc /opt/minecraft/wonders/logs/20* 2>&1 But how may one ...
0
votes
1answer
54 views

how to know which iptable is matching?

I am new to working with iptables, I have created several rules and I need to know which of them is blocking my traffic, in other words, I need to know which of them is matching
4
votes
2answers
347 views

Redirection executed before a command

In many Linux books is written that 'redirection is executed before a command'. Let's consider: $ cat bar hello $ ecno "foo" > bar bash: ecno: command not found $cat bar If bar would not exist, ...
0
votes
1answer
67 views

Re-route connections to another external server

I am trying to redirect a game that makes a HTTP request from one host to another host, so that I can intercept the value, and change the value as I need. The game does not use TLS. How can I ...
2
votes
2answers
99 views

Need to clean user home folder and organize game folders (with saves, configs, etc)

I have many installed games, from various sources/stores/frontends (Steam, GOG, Humble Store and Lutris with modules like DOSBox, Libretro, WINE and ScummVM). Unfortunately many game developers elect ...
0
votes
1answer
4k views

Apache displays “Default Page” when using https://www.example but works for https://example

I am having trouble with my Apache config and cannot get it to serve up my main webapp when I enter the URL that includes WWW (https://www.example.com) but it works fine when I don't (https://example....
1
vote
1answer
214 views

How can I redirect standard error to standard output in R - Sniny [closed]

I am looking for a way to capture standard error and redirect it to standard output in R (Shiny). I can not find any information any where in the web. Is there a way to do this?
0
votes
0answers
252 views

Chromium browser automatically using Yahoo search engine?

I'm using Ubuntu 16.04. I use the chromium browser and one feature it has is that whenever you type something in the address bar and hit enter (and is not a web address) you are redirected to a ...
3
votes
1answer
35 views

When you direct output to a file, is that file opened and closed exactly once?

When you redirect the output of a command to a file using >, and that process takes a while (like apt-get update) will the file being written to be opened and closed only once for the entire ...
1
vote
3answers
702 views

google search results page hijacked by search.interactivesplash.com

I noticed after unsubscribing from a junk mail, not sure this was a good idea, when I did a Google search using Chromium Web browser, the results page showed up, but very quickly before I could click ...
1
vote
2answers
130 views

Directing not empty output into a file

I want to save only non-empty output of find command into a file. If there is no output file should not be created. $ ls folder aa $ find . -name 'bb' | tee file $ cat file $ ls folder aa file How ...
1
vote
0answers
4k views

Nginx, reverse proxy : how to redirect https to http?

Beginner in nginx, I have to understand how to configure a reverse proxy for redirecting https requests to http : Actually, my nginx is configured to redirect https request to differents servers (in ...
0
votes
1answer
524 views

How to redirect all subpage to its main page?

I have migrated a static site to WordPress, now I need to redirect its pages, I have many URLs those will go one page, I can redirect one by one but those are many so I need a redirect rule that works ...
5
votes
1answer
1k views

Spaces in commands with redirection

program 2> error.log program &> filename program >> filename 2>&1 program 2>&1 I was able to figure out what these lines mean. However I don't quite understand where ...
0
votes
2answers
102 views

Troubles with chaining commands

Sooo, I am trying to log my ethminer hashrate, however I am having some troubles to chain the output of a egrep / grep into another one, I even tried with different commands (sed/cat...) none seems ...
0
votes
1answer
92 views

url redirects to another url with ssl

Bit of a strange one, but here goes: I have created a new vhost for website1.com an uplaoded files in var/www/html/website1.com. The site previously had an SSL on the previous server. On the new ...
16
votes
3answers
1k views

What does & mean exactly in output redirection?

I see stuff like command 1> out or with 2>&1 to redirect stderr, but sometimes I also see &> by itself, etc. What is the best way to understand & and what it means exactly?
10
votes
3answers
799 views

How to understand the ordering of output redirection? [duplicate]

So I am trying to learn how to pass standard out and standard err to various areas. Let's say I have a folder with here.txt alone. So if I do ls here.txt not-here.txt 1>out 2>&1 Since ...
1
vote
0answers
507 views

Redirect output audio into microphone without triggering focusout event in browser

Source1 : Official Web-Application for Video/Audio chatting Source2 : Skype for outsourced team Requirement : Wants to redirect all output audio to input mic, Nearest Solution : Redirect speaker ...
0
votes
1answer
2k views

What is the meaning of `ls directory > something` [duplicate]

I don't understand the meaning of this command. ls ../slc > dates How does it work?
1
vote
1answer
1k views

Redirecting serial ports with multiple instances of socat

I have multiple serial device servers for a home automation system. I need to be able to create multiple (5 or 6) virtual com ports. I am guessing there is a way to do this with socat but so far I ...
4
votes
2answers
8k views

How does curl print to terminal while piping

When I curl a file, and pipe it to a file or another command, I see output in my terminal. I am not sure how this happens, as the pipe is supposed to take all the output from curl, right? For example:...
0
votes
1answer
52 views

Measuring the time of an interactive command called from a script

Assuming I want to track the times I spend editing a set of files, and log them to a file, as I could do from the commandline using the time command: time vim test.txt I get real 0m8.149s user ...
7
votes
4answers
13k views

Make URL point to local folder

I have a URL to be mapped, on my Ubuntu 16.04 machine, to a local folder. E.g. I need https://domainxxx.xxx to point to /home/user/folder. My specific need is to include domainxxx.xxx/file.js not as ...