Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

linux questions. need help?

Use the following transcript to answer the next 6 questions.

[elvis@station elvis]$ ls -R / 2> /dev/null | grep etc | less

[1]+ Stopped ls --color=tty -R / 2>/dev/null | grep etc | less

[elvis@station elvis]$ ps

PID TTY TIME CMD

1603 pts/2 00:00:01 bash

2391 pts/2 00:00:00 ls

2392 pts/2 00:00:00 grep

2393 pts/2 00:00:00 less

2394 pts/2 00:00:00 ps

[elvis@station elvis]$ ls -l /proc/2391/fd

total 0

lrwx------ 1 elvis elvis 64 Sep 23 09:49 0 -> /dev/pts/2

l-wx------ 1 elvis elvis 64 Sep 23 09:49 1 -> pipe:[20966]

l-wx------ 1 elvis elvis 64 Sep 23 09:49 2 -> /dev/null

3. Which file (or pipe) is tied to stderr of the ls process?

A. A pipe to the grep process

B. /dev/null

C. /dev/pts/2

D. A pipe to the less process

E. None of the above

4. Which file (or pipe) is tied to stderr of the grep process?

A. /dev/null

B. /dev/pts/2

C. A pipe to the ls process

D. A pipe to the less process

E. None of the above

5. Which file (or pipe) is tied to stdin of the grep process?

A. A pipe to the less process

B. A pipe to the ls process

C. /dev/pts/2

D. /dev/null

E. None of the above

6. Which file (or pipe) is tied to stdin of the less process?

A. A pipe to the ls process

B. /dev/pts/2

C. /dev/null

D. A pipe to the grep process

E. None of the above

7. To what expression would the symbolic link /proc/2392/fd/0 resolve?

A. /dev/pts/2

B. pipe:[20966]

C. /dev/null

D. /tmp

E. /dev/tty2

8. When bash reports the stopped process group, the ls alias has been expanded to ls --color=tty. The --color=tty option tells the ls command to generate color control sequences only if its stdout is tied to a terminal. Which of the following is true?

A. The ls command generates color control sequences, which can be observed by the less pager.

B. The ls command does not generate color control sequences.

C. The ls command generates color control sequences, but they are filtered out by the grep command.

D. The ls command never generates color control sequences (the --color=tty is only included for purposes of backwards compatibility).

E. None of the above apply.

9. Which of the following command lines would allow the less pager to browse grep's error messages, as well as output?

A. grep root /etc/* 2>&1 | less

B. grep root /etc/* | less 2>&1

C. grep root /etc/* >>| less

D. grep root /etc/* 2| less

E. None of the above

1 Answer

Relevance
  • ?
    Lv 7
    1 decade ago
    Favorite Answer

    9. It depends on the shell, which users can change. See the manpage under redirect, e.g. "man bash"

    See the manpage for proc, and/or try stuff on a live system.

Still have questions? Get your answers by asking now.