Skip to main content
retag, as no linux specific. rephrase title to better fit the topic.
Source Link
Anthon
  • 81.4k
  • 42
  • 174
  • 228

I can understand the statements like.

  1. bzip2 --version >/tmp/list_right 2>/tmp/list_error
  2. bzip2 --version >/tmp/list 2>&1
  1. bzip2 --version >/tmp/list_right 2>/tmp/list_error
  2. bzip2 --version >/tmp/list 2>&1

But I don't understand the statement below.:

bzip2 --version 2>&1 < /dev/null | head -n1

bzip2 --version 2>&1 < /dev/null | head -n1

I can understand the statements like.

  1. bzip2 --version >/tmp/list_right 2>/tmp/list_error
  2. bzip2 --version >/tmp/list 2>&1

But I don't understand the statement below.

bzip2 --version 2>&1 < /dev/null | head -n1

I can understand the statements like.

  1. bzip2 --version >/tmp/list_right 2>/tmp/list_error
  2. bzip2 --version >/tmp/list 2>&1

But I don't understand the statement:

bzip2 --version 2>&1 < /dev/null | head -n1
retag, as no linux specific. rephrase title to better fit the topic.
Source Link

Redirect the standard IO streams explain this shell command with redirection and pipe

I can easily understand the statements like.

  1. bzip2 --version >/tmp/list_right 2>/tmp/list_error
  2. bzip2 --version >/tmp/list 2>&1

But I really don't understand the statement below. Please help.

bzip2 --version 2>&1 < /dev/null | head -n1

Redirect the standard IO streams

I can easily understand the statements like

  1. bzip2 --version >/tmp/list_right 2>/tmp/list_error
  2. bzip2 --version >/tmp/list 2>&1

But I really don't understand the statement below. Please help.

bzip2 --version 2>&1 < /dev/null | head -n1

explain this shell command with redirection and pipe

I can understand the statements like.

  1. bzip2 --version >/tmp/list_right 2>/tmp/list_error
  2. bzip2 --version >/tmp/list 2>&1

But I don't understand the statement below.

bzip2 --version 2>&1 < /dev/null | head -n1

Source Link

Redirect the standard IO streams

I can easily understand the statements like

  1. bzip2 --version >/tmp/list_right 2>/tmp/list_error
  2. bzip2 --version >/tmp/list 2>&1

But I really don't understand the statement below. Please help.

bzip2 --version 2>&1 < /dev/null | head -n1