Skip to content
David Refoua edited this page Nov 13, 2022 · 14 revisions

Linux command-line tools on Windows

You can use the common Linux/Unix command lines on Windows (such as ls, mv, nano, vim, etc), by installing either Cygwin or WSL.

These familiar GNU/Posix tools can be installed on Windows, to provide the same experience as other Linux/Unix based operating systems, such as Ubuntu and macOS.

Cygwin is a free and open-source implementation of GNU/Posix tools, while WSL is a Microsoft product that allows the installation of a Linux distribution on top of Windows.

👉 NOTE: The Cmder full edition comes with Git for Windows, a project that already includes some of the tools mentioned above. However, since it's based on a light fork of Cygwin (called MSYS2), it may lack some of the other binaries you may want to use.
You can install Cygwin alongside with Cmder full; However, to avoid duplicated binaries, it is recommended to install Cygwin alongside the Cmder mini edition and install Git within Cygwin.

Integrating Cygwin with Cmder

  1. Install Cygwin
  2. Install the 'chere' package in Cygwin (e.g. by running apt-cyg install chere inside Cygwin console).
  3. Create a new task by clicking the + button in Startup > Tasks
  4. Edit the name to something more recognizable (Cygwin)
  5. Figure out the install directory of Cygwin and replace <cygwin_dir> with it in the following instructions
  6. Change Task parameters to /icon <cygwin_dir>\Cygwin-Terminal.ico
  7. Change Commands to <cygwin_dir>\cygwin.bat -c "/bin/xhere /bin/bash.exe '%V'"
  8. (Optional) Set a Hotkey like LShift + Alt + 3 to open Cygwin in Cmder

Add Cygwin to Path

After the installation, you can add Cygwin binaries to PATH so that you can use them natively in a Windows shell (e.g. Cmder).

  1. Open System Properties using either:

    • Control Panel → System → Advanced system settings
    • Win + Pause/Break
    • Win + Rsysdm.cplEnter
  2. Click on Environment Variables… in the Advanced tab

  3. From the System variables (or User variables if you are not an admin),
    select the Path variable and click Edit…

  4. Depending on what version of Windows you have:

    • Windows 10: Click on New… button and enter the binaries path.
    • Windows 7: Append a ; character to the end of line, then enter the binaries path.

    Note: This should the installation directory followed by \bin for the binaries directory.

    Example for default installation path:
    e.g. for 64-bit: C:\cygwin64\bin
    e.g. for 32-bit: C:\cygwin\bin

    In case you have installed Cygwin in a custom folder, you should substitute C:\cygwin with your installation directory.

    Tip: Don't forget to prepend the ; on Windows 7 and older, e.g.:
    [current_path];C:\Cygwin\bin

  5. Press the Ok button where needed, until all open windows are saved.

Further discussions can be made here.