Multiple choice technology operating systems

What will the following command do? echo *

  1. It is similar to 'ls -a' command and displays all the hidden files in the current directory

  2. displays all the files in the /etc directory

  3. displays all the files in the root

  4. It is similar to 'ls' command and displays all the files in the current directory

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The echo * command expands the * wildcard to match all files and directories in the current directory and prints their names. This is similar to the ls command but displays output in a single line. Option A is incorrect because echo * does not show hidden files (those starting with .). Options B and C are wrong because * operates on the current directory, not /etc or root.

AI explanation

In the shell, * is a glob pattern that expands to all non-hidden filenames in the current directory before being passed to echo, so echo * prints the same file list you'd get from a plain ls (hidden dotfiles are excluded unless dotglob/-a behavior is enabled).