# Just how could I bear in mind just how to make use of redirection?

I recognize what

  program > /dev/null 2>&1


does. It reroutes the result to /dev/null and also 2>&1 suggests to reroute the mistake result in the very same area where the result is sent out.

My trouble is I constantly need to google it due to the fact that I never ever remember it.

So, I attempt &2>1, 1>2&, 1>&2 ... I attempt every mix till I google it ...

What's the method to bear in mind it conveniently?

0
2019-05-04 08:37:00
Source Share

Actually, it relies on what shell you're making use of. Celebration is generally really flexible and also you can simply do :

program &> file

0
2019-05-08 02:15:46
Source

Seeing the & as a knot could aid : think of what you intend to do as taking the result of 2, so 2>, and also linking it along with 1, so 2>&1

0
2019-05-08 01:08:40
Source

Currently, seriously, this and also various other standard things I maintained neglecting, so I included a fast pointers food selection to an application I created which I make use of daily. You could intend to offer it a shot or usage something like gnote to maintain a note.

0
2019-05-07 23:02:40
Source

Output is far better than mistake so it precedes (1 vs 2 ).

> is shorthand for 'mosts likely to'. Left wing is what I intend to send and also on the right is where I intend to send it. Given that 'where' is (virtually ) constantly a documents, something like

program > /dev/null 2>1

.

would certainly reroute to a documents called 1. Hence, the ampersand (&) changes the documents to submit descriptor.

However, I have not find neither established my very own mnemonic, yet when I was first understanding * nix, I located this sensible means to function well. After a couple of rundowns, it comes to be acquired behavior.

0
2019-05-07 22:04:26
Source