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.
219
questions
0
votes
0
answers
58
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
1
answer
3k
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
0
answers
155
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
1
answer
2k
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 ...
17
votes
3
answers
7k
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
3
answers
106
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 ...
1
vote
1
answer
956
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
...
16
votes
5
answers
4k
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 &...
3
votes
3
answers
3k
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
0
answers
499
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
0
answers
4k
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
0
answers
883
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 ...
2
votes
1
answer
3k
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
1
answer
1k
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
0
answers
23
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
1
answer
2k
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
1
answer
418
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
1
answer
281
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
1
answer
426
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 ...
2
votes
1
answer
536
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 ...
1
vote
0
answers
1k
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
3
answers
2k
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
1
answer
797
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
2
answers
1k
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
1
answer
366
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
3
answers
755
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
1
answer
12k
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
1
answer
534
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?
3
votes
1
answer
44
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
3
answers
904
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
2
answers
750
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
0
answers
6k
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
1
answer
2k
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 ...
8
votes
2
answers
4k
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
2
answers
229
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
1
answer
211
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 ...
22
votes
3
answers
3k
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
3
answers
1k
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
0
answers
1k
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
1
answer
4k
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
1
answer
3k
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 ...
12
votes
2
answers
35k
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
1
answer
84
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 ...
10
votes
4
answers
41k
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 ...
1
vote
0
answers
461
views
How to redirect traffic between VPN
I have many interfaces and subnets (local and vpn) on ubuntu router
but i need to remap traffic from openVPN to IPSEC tunnel trough defined subnet
destination ip is 1.2.3.4
ipsec tunnel accept ...
0
votes
2
answers
378
views
KDE Redirect application links to wrong address
I am using ubuntu 16.04 with kde 5.
I am trying to authorize calibre to access my goodreads account. When I click on the link the browser opens the login page instead of opening the authorization ...
0
votes
0
answers
44
views
Changing default save/load directory
I'm writing python scripts in pycharm. When I run them from pycharm, the files that they write are saved in their directory. When I run scripts from terminal using the command
/usr/bin/python3 /home/...
0
votes
1
answer
6k
views
Redirecting dns ip to url locally
So I have this ip http://172.20.1.96:8080. I would like to redirect it to something like http://mywebsite.corp.com. I think I changed all the configurations that need to be changed, but I can only get ...
0
votes
1
answer
108
views
How to write "gzip -c foo.txt > foo.txt.gz" with 2 redirection operators instead of 1
A bit of an arbitrary question, but it's part of a school assignment so I don't really have a choice.
The problem in question is this: compress foo.txt into foo.txt.gz while keeping the original ...
11
votes
1
answer
7k
views
How to set up localhost to redirect a website
I am asking this question from an awkward situation. As you may know or not know, Google is blocked in China. A discouraging consequence (at least to me) is that visiting Stack Exchange sites, like ...