Linux Commands in Windows Command Line

It never fails. When I want to view the contents of a directory from the Windows Command Line, muscle memory kicks in, and I type ls, which is a Linux command. Hence, I get the annoying error, and have to revert to dir /p. This is perpetually annoying.

Fortunately, a quick Google search of [Linux Commands in Windows CMD](linux commands in windows cmd) quickly reveals the solution on Lifehacker. The short version is install Cygwin, and add the Cygwin's bin directory to the Windows system path environment variable. While Lifehacker provides the GUI version, mine is slightly more succinct, and can be accomplished with two command line commands from a CMD session being run as Administrator.

  1. Install Cygwin using Chocolatey.
    choco install cygwin -y

  2. Add the bin path to the Windows System Path Environment variable
    setx path "%PATH%;C:\cygwin64\bin"

Now close the CMD session, and open an new one. If the ls command works, you are successful. Nice work! If you are like me, and perpetually fall back to Linux commands only to encounter errors all the time, this will make your life much easier.