113
votes
Accepted
Is redirection with `>>` equivalent to `>` when target file doesn't yet exist?
tl;dr
No. >> is essentially "always seek to end of file" while > maintains a pointer to the last written location.
Full answer
(Note: all my tests done on Debian GNU/Linux 9).
Another ...
60
votes
why it is 2>&1 and not 2>>&1 to append to a log file
When you redirect something to &number, you are not opening a new file at all; you're reusing an already open file along with whatever mode it was opened.
The numbers refer to "open file" handles ...
45
votes
How to prevent URL redirects in Chrome?
I realize this is far from a perfect answer, as this will only work for responses that serve up content, but I decided to post it as there are currently zero useful, actionable answers.
As a quick-...
44
votes
Accepted
Watching something be written to a file live with tail
You may also need to explicitly flush the buffer for it to get piped upon generation. This is because output is typically only printed when the pipe's buffer fills up (which is in kilobytes I belive), ...
43
votes
Prevent automatic redirects in Firefox
As of Firefox 56, the menu has now been "simplified" and the option is no longer available.
To turn on the redirect warning:
Type about:config in the address bar
Search for accessibility....
40
votes
Save the output of command in file MS-DOS 1.x
It seems that [COMMAND]>[FILE] does not work in the early versions of MS-DOS.
I am using MS-DOS 1.25 and the above expression gives the statement invalid argument
That is correct. What you want to ...
35
votes
In windows, can I redirect stdout to a (named) pipe in command line?
I am surprised that this has't been answered correctly already. There is indeed a UNC path assigned to named pipes by the system, accessible on any machine in the network, which can be used like a ...
35
votes
Watching something be written to a file live with tail
Run python with the unbuffered flag:
python -u myprog.py > output.txt
Output will then print in real time.
31
votes
Prevent automatic redirects in Firefox
Go to about:config and set network.http.redirection-limit to 1. At each redirection you will get a message "the page isn't redirecting properly". The address bar will show the next URL in the ...
30
votes
How to track url redirects in the browser?
Now, when FireBug is integrated into developer tools you may enable persistent logs by next steps:
Open DevTools (F12)
Go into Toolbox options (forth icon from right top)
Find Common preferences ...
22
votes
Accepted
Chrome keeps redirecting url
Browsers these days often times cache redirects. You need to clear your file cache from before your mistaken change. From Stackoverflow
To force clear htaccess/redirect caches in Google Chrome:
Go ...
19
votes
Watching something be written to a file live with tail
Instead of trying to tail a live file, use tee instead. It was made to do exactly what you're trying to do.
From man tee:
tee(1) - Linux man page
Name tee - read from standard input and ...
16
votes
How to find out the real download URL on download sites that use redirects
This is the answer you have been looking for!
There is only one fool-proof one-click solution: cliget
It gives you a curl command with headers, cookies and all, with a copy to clipboard button, right ...
15
votes
Accepted
Chrome redirecting http -> https
Go to chrome://net-internals/#hsts.
scroll down to the Delete
domain security policies area.
Type in the domain for which you
want to prevent redirection. Click on Delete.
Then, go to history, and ...
14
votes
Accepted
Chrome persistently redirecting to HTTPS for HTTP site
I found it !! I found it !!
For me, I had to perform this extra step :
Click on the icon of HTTPS on the left of the URL bar, and choose "Settings for this site".
Scroll and find "...
14
votes
why it is 2>&1 and not 2>>&1 to append to a log file
The sequence command >> logfile 2>&1 has two redirection stages:
command >> logfile will append to the logfile
2>&1 will redirect stderr to stdout (which itself appends to ...
12
votes
How to stop redirect from http:// to https://
Exit Firefox and edit the file
/Users/Chloe/AppData/Roaming/Mozilla/Firefox/Profiles/xxxxx.default-999999/SiteSecurityServiceState.txt
Delete the line with your domain in it. Then restart Firefox. ...
11
votes
How can I prevent Microsoft Online login Portal from redirecting to an old SSO page?
One way that worked for me: delete the cookies for login.microsoftonline.com in Chrome.
You can go directly to the relevant cookies in Chrome's Settings if you cut'n'paste this into the address bar:
...
11
votes
Accepted
Writing to a file from a udev RUN command
Operators like |, >> etc. mean something while inside a shell, but when sole /bin/echo 1 | … is run, there is no shell and | is just another argument to echo itself.
To use these operators you ...
11
votes
Accepted
All my Chrome searches are redirected through www.getsearchredirecting.com
A colleague solved it for me.
It was a web colour picker extension for chrome:
https://extpose.com/ext/241212
Fortunately it was delisted.
Be careful out there guys, it's a bad world...
10
votes
Chrome persistently redirecting to HTTPS for HTTP site
I have been able to get around this by deleting the domain security policy for the domain:
Go to chrome://net-internals/#hsts
Go towards the end and enter your domain in this textbox and hit delete.
...
10
votes
Accepted
How/why does ssh output to tty when both stdout and stderr are redirected?
How?
How is ssh doing this?
It opens /dev/tty. The relevant line from strace ssh … is:
openat(AT_FDCWD, "/dev/tty", O_RDWR) = 4
The file descriptor 4 is then used with write(2) and ...
9
votes
How to suppress cUrl's progress meter when redirecting the output?
According to man curl:
-s, --silent : Silent or quiet mode. Don't show progress meter or error messages. Makes Curl mute.
Example usage:
curl -s 'http://www.google.com'
or if you want to capture ...
9
votes
Accepted
Fake “.dev” domain added to hosts file for development purposes redirects to HTTPS in Chrome on Windows even when local dev server is not active
Beginning in 2018 Chrome and Firefox now forces HSTS for the .dev top level domain.
As explained in this blog post, while desktop developers have been using locally redirected (via hosts) .dev since ...
9
votes
Watching something be written to a file live with tail
Terminology: There is no pipe anywhere in this scenario. (I edited the question to fix that). Pipes are a different type of file (a buffer inside the kernel).
This is a redirect to a regular file....
8
votes
how do I echo $something >> file.txt without carriage return?
If you are using command's output, you can use xargs in combination with echo
/sbin/ip route|awk '/default/ { print $3 }' | xargs echo -n >> /etc/hosts
8
votes
Windows CMD Batch, START and output redirection
What did the trick for me was moving the command into a separate batch file:
rem this first batch file triggers the second one:
start the_second.bat arg1 arg2 out.txt
the_second.bat then looks like ...
8
votes
How can I redirect "localhost" to another local IP?
If you’re on Windows, you can use the command:
netsh interface portproxy add v4tov4 listenaddress=192.168.1.101 listenport=21 connectaddress=192.168.1.102 connectport=21
Replace:
21 with the port ...
8
votes
How to prevent URL redirects in Chrome?
Another temporary way to stop a redirect from happening, is to press esc button before the redirect happens.
esc stops the execution of js in the page but also html from rendering, so it it's pressed ...
7
votes
How can I make Chrome stop caching redirects?
.dev domains are forced to use HTTPS on Chrome 63+
Since Chrome 63, out December 2017, all domains ending on .dev (and .foo) are forced to use HTTPS via a preloaded HTTP Strict Transport Security (...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
redirection × 743linux × 124
networking × 80
bash × 78
google-chrome × 66
windows × 64
command-line × 62
dns × 61
firefox × 59
apache-http-server × 54
browser × 46
https × 32
url × 32
pipe × 30
shell × 27
http × 23
windows-7 × 22
stdout × 21
proxy × 20
router × 19
nginx × 18
htaccess × 18
website × 17
domain × 16
ip × 15