user13587772
user13587772

Reputation:

Why is "ls -a" giving me an error in VS Code?

I’m following a video and the instructor needed to show list of folder contents and he typed ls –a on VS Code's terminal which showed a list of the folder contents.

But when I typed same the same command on my VS Code, I got an error:

Parameter cannot be processed because the parameter name 'a' is ambiguous. Possible matches include: -Attributes -Directory -File -Hidden

Then I went to Git Bash and typed the same command, and it gave me the exact result I needed (which is the list of my folder contents).

Why is the same command working well in Git Bash but giving an error in VS Code?

The command I'm trying to execute:

ls -a

Result on Git Bash (which is correct):

./   .eslintcache  .gitignore     package.json       public/    src/
../  .git/         node_modules/  package-lock.json  README.md

Upvotes: 0

Views: 6464

Answers (2)

iceweasel
iceweasel

Reputation: 786

ls -a is a command for listing files on Unix/Linux-based systems.

Git Bash uses bash as its shell so Unix/Linux commands work on it.

You need to either enter dir as the equivalent command in Windows, or change your default shell to bash in VS Code.

Upvotes: 2

Josh Stevens
Josh Stevens

Reputation: 4221

I am guessing your default terminal is not "bash":

enter image description here

You can change your default terminal by pressing F1 in VS Code and typing "Terminal: Select Default Shell".

enter image description here

Select that and then you can select "Git Bash" from this dropdown. Now go back to your integrated terminal and try to execute the command.

enter image description here

Upvotes: 3

Related Questions