'ls' Command Not Working On Windows

Question

Why doesn’t the ‘ls’ command work when I try it on my computer or in the Codecademy terminal?

Answer

If your computer is running Windows, you’ll need to make sure you’re trying this command inside PowerShell. Otherwise, the command for Windows to do the same thing is dir.

If you’re trying the command in Codecademy’s environment and find it isn’t working as expected, make sure you’re typing it exactly as asked: ls. Note that Ls will not work – commands are case-sensitive! Any other variation will not work.

24 Likes

Try reloading the page. The command line wasn’t appearing for me until I did this.

5 Likes

To access the Windows command prompt just type **cmd** on your start button. Then type dir.

Powershell’s ‘ls’ command is an alias of a command-let, “Get-ChildItem”. Command-lets are built-in functions that perform specific tasks!

For further reference: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-childitem?view=powershell-7

I tried it on PowerShell but didnt see the typed text. Instead, it just skipped to the next line.

Hi palinalyze,

Can you tell us what you have typed in Powershell?

Thanks for the promptness. I realize that for PowerShell, I do not need to type the Shell Prompt ($) just the command “ls”. As soon as I did, it displayed a directory of my location…

One question @tbruck, so PowerShell is sufficient for taking this section of the course? I dont need a unix-based system?

1 Like

You’re right, the prompt $ does not have to be typed in the command line.

Regarding your question, I am not sure, I am not associated with Codecademy, nor a frequent user of Windows-based systems, but from what I know Microsoft has tried to mimic basic bash functionalities in PowerShell, so I think you will be fine with what you learn in the course.
If you’re interested in how PowerShell and bash are different, here’s an article I’ve found that tries to compare PowerShell to bash:

Microsoft also seems to (plan to) implement bash on Windows 10,

1 Like

The courses teaches bash. Codecademy provides the environment to run bash in the lesson.

If you rather want to use powershell, you should learn powershell.

powershell is very powerful, especially when used with c# and .net.

If you want to run bash on windows, there are several options, like WLS (windows linux subsystem).

Which Codecademy courses would you recommend for Windows based users if that is the case?

2 Likes

Codecademy doesn’t have a powershell course so far i know, cmd isn’t much

but i am sure there are powershell tutorials on the internet :slight_smile:

Does it mmean that the Command Line course at Codecademy will not be helpful for windows users? I really want to learn and pratice it, I’m also a pyhton learner and a pro-member)) … what could you please recommend?

1 Like

There isn’t really a fixed answer for that. If never need a *nix system, then you are very likely better of learning powershell.

1 Like

hello again, I decided to continue learning this chapiter “eventhough i was thinking comand lines in macs or *inux are != windows …” just to realise that the last point in the chapiter suggests “git gui” on windows with the same “comands” I’ve learned.
Thank Jesus !!! Thank you #Codecademy.

Actually, there are a bunch of different solutions. Git bash works, but windows 10 also has WSL (windows linux subsystem), given this was created with collaboration between microsoft and Canonical (company behind ubuntu, one of the most popular Linux distros), I would give WSL a try

I personally run a dual boot (two operating system installed along each other on the same machine), at boot you simply select the OS you want to run

2 Likes

Can’t we also use VM box or VM WARE where we can virtually run linux OS instead of WSL?

That is certainly possible, each approach has its pros and cons. You could even install Linux alongside windows.