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
0
votes
1answer
23 views

Command output is not redirected to file

I want to execute the following command, which is related to Rational ClearCase. The output of this command should be redirected to the file testout. Command rgy_check -vobs > testout Output ...
1
vote
1answer
40 views

How to get both the output of the time command in a file?

I ran the command time echo "Hello world" | tee output.txt expecting to get the full output to both terminal stdout and the output.txt file. However, the file content is not what I expect : ...
1
vote
1answer
54 views

How can I redirect sox messages to null or a log file

I run the following command to capture the output of audio into a file: $ sox -t pulseaudio alsa_output.pci-0000_00_1b.0.analog-stereo.monitor -t mp3 test.mp3 silence 1 0.1 3% 1 3.0 3% > /dev/null ...
0
votes
0answers
28 views

Apache HTTP to HTTPS redirect works, but “native” HTTPS does not

I'm currently installing a OTRS ticketing system for our company's IT dept. Therefor I followd these instructions: https://computingforgeeks.com/how-to-install-otrs-ticketing-system-on-ubuntu/ I'm ...
3
votes
1answer
119 views

How to completely suppress output of a command?

I want this command to work silently, echo "any_password" | sudo -S true I tried redirecting the output of stdout and stderr to /dev/null. When I provide the correct password it works as ...
0
votes
1answer
39 views

How does redirecting a command output to a file deals with opening and closing that file?

If we redirect a command such as sar -r 1> a_file.txt how does this works with opening, writing the output of the command and closing the file? In other words, how does redirecting a command ...
0
votes
1answer
29 views

/etc/hosts block or redirect domain

I tried blocking domains like this: 127.0.0.1 https://facebook.com 127.0.0.1 https://www.facebook.com But FB open correctly. How can I block or redirect websites on this file?
0
votes
0answers
45 views

Ubuntu 18.04 - SSL Redirection

I'm using Ubuntu 18.04 on DigitalOcean. I tried to install my website SSL and follow some instructions saying that need to add Redirect to https and now the whole website is not loading. Even ...
0
votes
0answers
21 views

How can I make specific URL patterns open via a Chrome application?

Similar as asked in this SuperUser question, I would like to enable a specific website to open through one of my google chrome apps instead of in a regular new browser tab The real case is I wrote ...
1
vote
1answer
31 views

Unable to redirect from http to https

Im sure this question got answered above a hundred times (cause i nearly have read them all), but i cant get my apache2 redirection working. Im a total beginner regarding everything on linux and im ...
0
votes
1answer
113 views

Command that writes to both stdout and stderr

We're doing workshops for internships where we explain the Bash. One topic is redirection, because it's quite important. So far we explained > and 2> independent from each other. Our examples ...
0
votes
0answers
32 views

Redirect output to the terminal screen AND to a file without tee?

I am currently using a tool called probequest for pentesting. I want to see the realtime output as wel as writing it away to a log file realtime. Sadly the output from probequest stops showing if i ...
1
vote
1answer
50 views

Failing to Redirect Output to File

I want to redirect output from "time" to a file. However, my attempts to redirect stdout, stderr, or both, are not working. For example, when I use: time python process-column.py 2>/tmp/times....
0
votes
0answers
101 views

Using the logger command, log a message to log file

Using one command, log a message to /var/log/boot.log and /var/log/messages using the logger command. I tried logger -p local7.info;user.info "Step 2" and it would ask for input. I tried to log a ...
0
votes
0answers
48 views

Aliasing to WordPress and redirects to canonical url in virtual host install

I’ve completed a virtual host installation of WordPress on Ubuntu 19.10 with Apache and MariaDB following instructions online. The nature of the installation with multiple sites using one WP package, ...
1
vote
1answer
70 views

Declaring stdout as stder

$ cat x cat: x: No such file or directory $ cat y This is y. $ cat x y 1> hold 2>&1 cat: x: No such file or directory This is y. Why stder got redirected to hold as well? stder got declared ...
0
votes
2answers
115 views

htaccess redirect problem

So, Say I have my shopping cart at foo.com/a I want to redirect shoppers to foo.com/b At foo.com my .htaccess contains RedirectMatch 302 ^/(index\.html)?$ foo.com/b But people still land on foo....
1
vote
1answer
41 views

here strings versus input redirection

The following example is taken from William Shott's The Linux command line. It is a shell script which gathers user info from the /etc/passwd file. The specific user for which this is done is read ...
0
votes
0answers
57 views

wildcard vhost subdomains with prefix - nginx

I have a nginx server which need to be configured with wildcard subdomains which has a pre-defined prefix. it should accept all wildcard subdomains with the prefix. My nginx conf server_name ~^((.*)-...
26
votes
5answers
7k views

What is the difference between “cat < filename” and “cat filename”?

The simplest way to display file contents is using the cat command: cat file.txt I can get the same result using input redirection: cat < file.txt Then, what is the difference between them?
0
votes
0answers
290 views

Redirect program ouput to screen and file simultaneously

I have a python script. I want to save its result while it outputs something in the terminal. I try python program.py 2>&1 | tee output.txt It seems only after the program finish, it will ...
1
vote
0answers
25 views

Redirect output to file returns permission denied [duplicate]

I'm trying to add some files from a file to another but at time to redirecting output the terminal returns me a message of "Denied permission" and I don't know where I should put sudo. I tried with ...
4
votes
3answers
2k views

What does >&2 mean in a shell script?

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
47 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
279 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
64 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
468 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?
15
votes
3answers
3k 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
3answers
84 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
1answer
776 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 ...
13
votes
5answers
2k 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
3answers
1k 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
139 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
1k 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
353 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
512 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
665 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
21 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
1k 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
90 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
177 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
271 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
137 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
79 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
350 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
784 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
68 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
448 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
75 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 ...