What is the use of:
2>
in an SSH command?
That is not related to ssh
, it's a shell function to redirect the standard error messages. Read about shell redirection
This redirects standard error output to somewhere. Non-related to the SSH.
Post exact command if needing more info.
Example of redirection:
/usr/bin/veracrypt > /dev/null 2>&1 &
Parsing:
VeraCrypt is an encryption program, that floods terminal with all kinds of messages
>
redirects output
/dev/null
is the black hole in Linux
2>&1
combines standard error output to standard output, so all the possible printed messages will go to the black hole
&
runs the program into background
These are Single-line redirection commands (affect only the line they are on). File descriptors 0
represents standard input, 1
represents standard output and 2
represents standard error.
e.g.
1>filename
- Redirect stdout to file "filename"
1>>filename
- Redirect and append stdout to file "filename"
2>filename
- Redirect stderr to file "filename"
2>>filename
- Redirect and append stderr to file "filename"
There are many more.