-3

What is the use of:

2>

in an SSH command?

3 Answers3

0

That is not related to ssh, it's a shell function to redirect the standard error messages. Read about shell redirection

Philippos
  • 13,453
0

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:

  1. VeraCrypt is an encryption program, that floods terminal with all kinds of messages

  2. > redirects output

  3. /dev/null is the black hole in Linux

  4. 2>&1 combines standard error output to standard output, so all the possible printed messages will go to the black hole

  5. & runs the program into background

0

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.

Amit24x7
  • 666