nerdexam
GIAC

GSEC · Question #165

You work as a Network Administrator for McNeil Inc. The company has a Linux-based network. David, a Sales Manager, wants to know the name of the shell that he is currently using. Which of the…

The correct answer is B. echo $shell. The echo command prints the value of environment variables to the terminal, making it the correct way to display the current shell stored in the $SHELL variable.

Linux and Cryptography

Question

You work as a Network Administrator for McNeil Inc. The company has a Linux-based network. David, a Sales Manager, wants to know the name of the shell that he is currently using. Which of the following commands will he use to accomplish the task?

Options

  • Amv $shell
  • Becho $shell
  • Crm $shell
  • Dls $shell

How the community answered

(23 responses)
  • A
    4% (1)
  • B
    74% (17)
  • C
    13% (3)
  • D
    9% (2)

Why each option

The echo command prints the value of environment variables to the terminal, making it the correct way to display the current shell stored in the $SHELL variable.

Amv $shell

The mv command is used to move or rename files and directories, not to read or display the value of environment variables.

Becho $shellCorrect

The echo command outputs the value of shell environment variables to standard output. In Linux, the $SHELL variable (conventionally uppercase, though the question uses lowercase) stores the path or name of the currently active shell. Running 'echo $shell' or 'echo $SHELL' prints that value directly to the terminal.

Crm $shell

The rm command is used to remove files and directories from the filesystem, and has no function related to displaying variable values.

Dls $shell

The ls command lists the contents of a directory and cannot be used to print the value of an environment variable.

Concept tested: Linux echo command displaying shell environment variables

Source: https://www.gnu.org/software/bash/manual/bash.html

Topics

#Linux shell#echo command#environment variables#shell identification

Community Discussion

No community discussion yet for this question.

Full GSEC Practice