6

I am using Windows 11. In the terminal, the usual Linux commands are not available. So commands such as chmod and vim return command line errors like:

vim : The term 'vim' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ vim ~/.bashrc
+ ~~~
    + CategoryInfo          : ObjectNotFound: (vim:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

How can I fix this? I am using Windows after a gap of a decade, so kindly bear with me!

tachyon
  • 299

6 Answers6

62

Windows is not Linux. There is no support for Linux commands or utilities on Windows without installing the Windows Subsystem for Linux (WSL), third party tools like MinGW-w64 or Cygwin, or a Linux virtual machine.

Depending on what your requirements are, one of these or another third party tool/suite will very likely suit your needs.

If you edit your question with some more details, we can point you to the most appropriate solution.

Keltari
  • 75,447
10

Windows and Linux are distinguishable operating systems, By default, there is no support for Linux commands or shell commands. But you can install Windows Subsystem for Linux (WSL) to enable the execution of Linux commands on the system.

It is imperative to note that Windows Subsystem for Linux (WSL) is only available for Windows 10 and later versions. It is not compatible with any prior versions of the Windows operating system.

There are several third-party tools available for running Linux commands on Windows systems, such as

Git Bash
Cygwin
MSYS2
Babun
Gow
UWin
MinGW
PowerShell with Windows Compatibility Pack

It is up to the user's discretion to decide whether to install WSL or use third-party applications to execute Linux commands on their Windows system.

You can also use Oracle VM VirtualBox to run multiple operating systems simultaneously on a single computer, without the need for separate hardware, including Linux.

5

In Windows PowerShell, some Linux commands cannot be used because there are predefined aliases for them.

For example, ls is an alias for Get-ChildItems or cat is an alias for Get-Content. But as the other users already said Windows has no native support for Linux executables.

You can see all aliases that are set by using the Command Get-Alias and you can define your own by using Set-Alias -Name "youralias" -Value "yourcommand" and you can persist them by adding them to your profile file. You can find your profile in the $profile variable. PowerShell profile files are comparable to .bashrc.

tachyon
  • 299
Daniel
  • 51
  • 1
1

Linux in many ways follows the POSIX standards and has its own ports of various applications - typically from Gnu userland tools. You'd find subtle differences between the same commands from gnu, busybox, various olschool unixes and BSD varients.

Windows isn't designed to be a POSIX OS, with inspiration from DOS and Windows 9x tools, and its own kernel and userland.

Its a bit like trying to work out why a train and a car have different controls. Simply, someone using windows wouldn't be expected to 'intuitively' expect a unix-alike environment.

The gap's closed a little with WSL, ports for gnu tools to windows and some standard tools in powershell having Aliases.

To an extent this is a user problem - you need to recaliberate yourself to using windows and either finding the native commands (and learning or aliasing them) with things like chmod, or installing the tools you need by installing ports of things like Vim

Journeyman Geek
  • 133,878
0

Yes, you can use VIM inside Windows machine by installing the git bash for windows architecture.

  • Git bash is similar to a linux terminal, so you can use linux commands on it.

Reference0

Reference1

-7

Many of these tools are GPL licensed and can't be shipped together with proprietary windows without Microsoft having to release source code also under the GPL.

DavidPostill
  • 162,382
akostadinov
  • 1,530