Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [redirection]

Can be either redirection internet traffic to different IP's or redirection of files from one path to another path.

386
votes
17answers
262k views

How can I make Chrome stop caching redirects?

I am working on a web application that is using redirects (for pretty URLs). I am trying to debug logic in the way the redirects are working. However Google Chrome keeps remembering the redirects and ...
100
votes
5answers
85k views

How to wget a file with correct name when redirected?

So after some time of searching on Google and Super User (and scanning man pages) I was unable to find an answer to something that (I think) should be simple: If you go here: http://www.vim.org/...
79
votes
1answer
6k views

Is redirection with `>>` equivalent to `>` when target file doesn't yet exist?

Consider a shell like Bash or sh. The basic difference between > and >> manifests itself in a case when the target file exists: > truncates the file to zero size, then writes; >> ...
71
votes
4answers
113k views

how do I echo $something >> file.txt without carriage return?

When I echo $something >> file.txt, a new line will be append to the file. What if I want to append without a new line?
58
votes
4answers
101k views

What does “2>&1” do in command line?

I know that the > sign is used for output redirection in the command line, but I'm having trouble finding something that explains the use of 2>&1 in the command line. For example: curl ...
53
votes
7answers
70k views

cURL: how to suppress strange output when redirecting?

I'm trying to print just the verbose sections of a cURL request (which are sent to stderr) from the bash shell. But when I redirect stdout like this: curl -v http://somehost/somepage > /dev/null ...
49
votes
15answers
123k views

How to find out the real download URL on download sites that use redirects

Let's say I want to download something with wget but the website that has the files I need redirects to a site which automatically chooses a mirror for me (and there's no static file URL provided). ...
45
votes
9answers
32k 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 ...
41
votes
5answers
106k views

Remotely run script on Unix, get output locally?

I need to run a (Tcl, or whatever) script on a remote Unix machine, from a (local) Windows command shell, and I want the stdout/stderr of the script to show up in the Windows CLI. The exit code would ...
40
votes
1answer
45k views

Is there an equivalent to /dev/null in Windows?

If I want to ignore stdout of a command, I do this on *nix: myprog > /dev/null How do I achieve the same on Windows (in cmd or a batch file)?
37
votes
5answers
70k views

How to track url redirects in the browser?

When I type http://example.com/load/ in my browser and press ENTER, this website redirects me to http://example.com/load/1/, from there to http://example.com/load/2/ and then I finally landed on http:/...
37
votes
4answers
62k views

Redirect URLs in Chrome?

Is there any extension to Chrome that will let me force a URL from a particular domain to be redirected to another domain? (E.g. Redirect http://www.google.com to https://encrypted.google.com.) Note:...
30
votes
8answers
85k views

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

I have come across several commands that use 2>&1 and 1>&2, but I 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 ...
29
votes
3answers
31k 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?
29
votes
2answers
20k views

Default PowerShell to emitting UTF-8 instead of UTF-16?

By default, PowerShell in Windows seems to be outputting UTF-16 (e.g., if I do a simple echo hello > hi.txt, then hi.txt ends up in UTF-16). I know that I can force this to my desired text ...
27
votes
3answers
2k views

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. Update:Since it is true that it ...
26
votes
2answers
15k 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 \; ...
25
votes
4answers
33k views

Windows CMD Batch, START and output redirection

I would like to run two programs simultaneously from a batch file, and redirect the first program's output into a text file like: start python 1st.py arg1 arg2 > out.txt start 2nd.exe %1 arg2 arg3 ...
25
votes
2answers
20k views

Is there a binary-safe “triple less than” <<< operator in bash?

This is a rather hypothetical question, so please don't ask me why I'd want to do this. Assuming that I have a variable GIF that contains binary data, and assuming that I cannot use the pipe | ...
24
votes
4answers
72k views

Prevent automatic redirects in Firefox

Firefox used to prevent automatic redirects and have a button you could use to opt-in to a redirect. However, a update a couple of months ago eliminated this feature and now Firefox (version 35) ...
21
votes
1answer
4k views

Why does the “>” command in a Windows console not redirect all messages to a file?

I am trying to build a Scala project with sbt, so I run a command: sbt clean test > log.log Which means that any messages that the sbt tool writes to the Windows console should be written to the "...
15
votes
3answers
5k views

Do browsers change URLs of saved bookmarks in response to 301 redirection?

HTTP status code 301 is used to indicate that content has moved permanently, and that the returned URL should be used to access the requested content in future. RFC 2616 says Clients with link ...
15
votes
3answers
25k views

In windows, can I redirect stdout to a (named) pipe in command line?

Is there a way to redirect the standard output of a process in Win32 console to a named pipe? Named pipes are built in to Windows and while they would be an useful concept, I've never seen them used ...
13
votes
14answers
2k views

How to analyze a link to figure out the actual link

Sometimes when downloading something, I find the links are not the direct ones to the files. For example, this is a link to download a PDF file: http://ishare.down.sina.com.cn/15181391.PDF?ssig=...
12
votes
2answers
25k views

How to redirect output to a text file and the console (cmd) window at the same time?

How can I redirect output to a text file and the console (cmd) window at the same time?
12
votes
2answers
19k views

Disable 302 Redirects in Firefox

I need to temporarily disable 302 redirects in Firefox. How can I do this? I tried going to tools > options > advanced > general > check warn me when sites try to redirect or reload the page, but that ...
12
votes
4answers
4k views

Forbid http-equiv=“refresh” redirect

When javascript is off (NoScript), a site redirects me and i can't get back to the page i came to. <noscript><meta http-equiv="refresh" content="0; URL=/badbrowser.php"></noscript> ...
11
votes
3answers
1k views

Two Programs having their StdIn and StdOut tied

Suppose I have two programs called ProgramA and ProgramB. I want to run them both simultaneously in the Windows cmd interpreter. But I want the StdOut of ProgramA hooked to the StdIn of ProgramB and ...
11
votes
4answers
8k views

Is there any way I can force Firefox to NOT cache redirects (301 and 302)?

I am a web developer, and there are many times where I have to create or alter a 301 or 302 redirect. It is cumbersome to test immediate changes in Firefox because it caches redirects, so if I change ...
10
votes
1answer
15k 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, ...
10
votes
1answer
3k 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
10
votes
2answers
929 views

How to avoiding losing your current browsers websites when being redirected by wireless login pages

It is common for public Wi-Fi access points to include login pages, even at times, when they’re free (i.e. Starbucks, many airports, hotels, etc). I’m often in a situation where I’ll open up Chrome/...
9
votes
3answers
20k views

How to ignore error messages in bash on Ubuntu?

I'm trying to show the number of lines, words and characters of all configuration files in /etc/*conf (with command wc). How can I modify the command (or commandline) to not view the error messages?
9
votes
1answer
2k views

Different output when redirecting

$ mysql -e 'select a,b from tablefoo' databasename yields +---+---+ | a | b | +---+---+ | 1 | 0 | | 2 | 1 | +---+---+ whereas $ mysql -e 'select a,b from tablefoo' databasename > file yields a ...
8
votes
1answer
3k views

How can I redirect OS X dtruss output when running with sudo?

I'm running dtruss on Mac OS X 10.9. Simple example is: sudo -c ls But I'd like to capture the dtruss output into a file. I saw something that suggests that I can do something like: sudo bash -c '...
7
votes
4answers
562 views

Documenting Unix commands on the command line

I would like to append both the last command and the output of the last command to a text file for the purpose of a tutorial. For example: After I do an ls in my home directory I see this on the ...
7
votes
1answer
8k views

Replacing cmd.exe with an another console tool [duplicate]

I like to use Console2 instead of the default command line for Windows. Out of habbit i'm still writing "cmd" into Total Commander's command line sometimes to open a DOS console into the current ...
7
votes
3answers
10k views

How to redirect to stdin of a running bash shell?

Theoreticly, if I know the pid of the bash shell which is running, I can run a cat whose stdout is redirected to the stdin of that shell. It seems to be as if I type something on that shell. ...
7
votes
1answer
35k views

.htaccess 301 redirect with regular expressions

If I have: redirect 301 /users/foo http://www.example.com/profiles/foo redirect 301 /users/bar http://www.example.com/profiles/bar Can I do something like? redirect 301 ^\/users/(.+)$ http://www....
7
votes
6answers
2k views

Is there a way to “redirect” a click on a URL in a VirtualBox guest to open in the host OS browser?

I'm using VirtualBox OSE on Ubuntu 10.04. I have a Windows 7 guest VM which I use almost exclusively for MS Outlook to access my Exchange mailbox. If I click a URL in Outlook it obviously opens in IE ...
7
votes
1answer
17k views

Redirect input from one terminal to another

I have sshed into a linux box and I'm using dvtm and bash (although I have also tried this with Gnu screen and bash). I have two terminals, current /dev/pts/29 and /dev/pts/130. I want to redirect ...
7
votes
3answers
4k views

How to redirect output of a command to a file when the command will prompt user inputs?

I have a command which will prompt user for some inputs and then output the result to the terminal. I typed the command like below to redirect the output to a file: $the_command > abc.txt But it ...
7
votes
2answers
10k views

How I could redirect all my traffic to the TOR network?

I need to redirect all my traffic to the TOR network. I have just installed Vidalia, but I think that I have not correctly configured my Tor-client. I have a Java desktop client that has to access a ...
7
votes
2answers
10k views

In Firebug, how can I stop a redirect?

In Firebug, how can I stop a redirect? I want to examine and edit a webpage before it redirects. Under the Net tab, using Persist I can see all the GET including the previous pages and the redirect ...
6
votes
7answers
21k views

Is there any way to bypass ISP-based redirection of webpages after credit finished? [closed]

My ISP has different Internet plans and some of them are limited traffic and once the monthly traffic has reached, any webpages will be redirected to a specific IP address showing that the credit has ...
6
votes
6answers
2k views

Want to use apache, ISP blocking port 80

I am attempting to set up a small web server on my home network, but my ISP is blocking incoming port 80 ( and no, i'm not paying $50/month extra for them to unblock it). I am looking for some ways ...
6
votes
5answers
11k views

Port forwarding software (service) for Windows

I have a server service that uses 8182 port. Somebody want to connect to this, but 8182 port is unavailable for him, only 5118 is working fine. No problem I thought, I just install port forwarder ...
6
votes
2answers
362 views

What does “>> file command” do, and how does it differ from “command >> file”?

Picking up from this highly voted comment to What does `>>` mean in terminal command?: "program before" What does that mean? Command obviously, but redirections can also be written prepended, ...
6
votes
4answers
15k views

Can I get my browser to automatically redirect on some pages?

Is it possible to have a browser (firefox or chrome), when I navigate to a specific page, the browser automatically redirects me to a different page of my choice. I'm wondering if there is some sort ...
6
votes
2answers
7k views

Redirect 7-Zip's command-line output to /dev/null on Windows when extracting a .7z file

I have a command such as "C:\Program Files\7-zip\7z.exe" x foo.7z -y which will extract (with full paths) to the current directory. What it does that I don't want, though, is to spool out the ...