Problem in running commands on jupyter notebook

I have a problem in running “ls , head, wc” commands in notebook all this commands show me an error message "‘head’ is not recognized as an internal or external command,
operable program or batch file. "

Any help please…
with appreciate.

1 Like

Welcome @lolo_henata.

It looks like you are trying to use Linux/Unix commands on Windows. You may want to install a package that provides such commands into your environment. It is hard for me to know what exactly would help you without knowing more about your environment: How did you install Jupyter? Are you using conda? Are you using Windows Subsystem for Linux?

If you are using conda you may only need to install m2-base which should give you some of the Unix commands:

conda install m2-base

This is a subset of MSYS2 which includes some of commands like ls, head, and wc; the alternatives include using full cygwin or WSL (Windows Subsystem For Linux, or currently WSL2; I would only recommend this for advanced users because it is more difficult than it seems) and some of the differences are explained in: What is MSYS2? - MSYS2.

I see that this question is tagged JupyterHub. Does it mean that you are using a Jupyter instance prepared by someone else (e.g. at your university?). This would be a bit unusual to host it on a Windows machine, but not impossible; if this is indeed the case (and not just a mis-click when selecting tags) then you may want to contact the IT support of your university/company who provides the JupyterHub instance and request them to install some basic UNIX shell utilities. In that case feel free to direct them to this post :slight_smile:

4 Likes

Thank you so much @krassowski !
I used this command in Anaconda Prompt conda install m2-base and it’s works!
Appreciate your response.
Have a nice day.

1 Like

Thank you!! That command helped to solve my problem.