200-901 exam dumps

200-901 practice question 130 of 204

Cisco DevNet Associate. Associate level, Cisco. Free question with the correct answer and a full explanation.

200-901 Question 130

Single answer

A network automation engineer is working on a Linux system and needs to perform the following actions:

  1. Navigate to a directory named 'projects'.
  2. List all files in the directory, including hidden files.
  3. Display the value of the 'HOME' environment variable. Which sequence of Bash commands should they use to achieve these steps?
  1. A

    cd projects; ls -a; echo $HOME

  2. B

    cd projects; ls; echo HOME

  3. C

    cd projects; ls -l; echo $HOME

  4. D

    cd projects; ls -a; echo HOME

Show answer and explanation

Correct answer: A

Explanation

In Bash, 'cd' is used to change directories, and 'ls -a' lists all files, including hidden ones (files starting with a dot). Environmental variables like 'HOME' need to be referenced with a '$' symbol, so 'echo $HOME' displays the value of the 'HOME' variable. The correct sequence of commands is 'cd projects; ls -a; echo $HOME'.

  • A. Correct.

    This is the correct sequence. 'cd projects' navigates to the 'projects' directory, 'ls -a' lists all files including hidden ones, and 'echo $HOME' correctly displays the value of the 'HOME' environment variable by referencing it with the '$' symbol.

  • B. Incorrect.

    'ls' without the '-a' flag will not include hidden files, and 'echo HOME' will print the string 'HOME' rather than the value of the environment variable.

  • C. Incorrect.

    'ls -l' lists files in a detailed format but does not include hidden files unless combined with the '-a' option. Additionally, 'echo $HOME' is correct, but the wrong 'ls' option is used here.

  • D. Incorrect.

    'ls -a' correctly lists hidden files, but 'echo HOME' will print the string 'HOME' rather than the value of the 'HOME' environment variable because the '$' symbol is missing.

Timed practice exam

Take a 200-901 practice test under exam conditions

75 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam