Linux utilities on Windows

By Apr 27, 2017

Description:

We here list installable software in Bash shell of WSL which can be used to develop on Windows.

Preferencesoft

In this article, we will see how to install programs coming from Ubuntu with Bash and how to use them.

The Windows 10 subsystem for Linux does not yet allow a X11 application to run on Windows without an X11 server emulator. So, we're going to be interested exclusively in programs that can run in console mode and that might be of interest to the developer.

In Windows, there are already many free and open source software, for developers. But we do not always find the same programs from one platform to another.

The Windows 10 subsystem for Linux can provide some additional utilities for programming.

Installing and using a program under Bash.

Since we will regularly access Windows directories and the file paths can be long enough, we will create a bash script to declare global variables that contain certain paths.

File Winvars.sh:

#!/bin/bash
export m=/mnt/c/Users/KodFor
doc=/mnt/c/Users/KodFor/Documents
export doc
export pic=/mnt/c/Users/KodFor/Pictures
export w=/mnt/c/Users/KodFor/Pictures/work

dark@pc-atlantic:~$ . ./winvars.sh
Now we can easily list the documents directory:
dark@pc-atlantic:~$ ls $doc
Let's install for example optipng:
dark@pc-atlantic:~$ sudo apt-get install optipng

I placed the following files in the work directory:

transfert1.png Windows.PNG

Let's optimize the transfert1.png file by typing the command:

dark@pc-atlantic:~$ optipng $w/transfert1.png

We get:

 
** Processing: /mnt/c/Users/KodFor/Pictures/work/transfert1.png
300x220 pixels, 3x8 bits/pixel, RGB
Input IDAT size = 94605 bytes
Input file size = 94834 bytes

Trying:
zc = 9 zm = 8 zs = 1 f = 5 IDAT size = 94605
zc = 1 zm = 8 zs = 2 f = 5 IDAT size = 92708

Selecting parameters:
zc = 1 zm = 8 zs = 2 f = 5 IDAT size = 92708

Output IDAT size = 92708 bytes (1897 bytes decrease)
Output file size = 92805 bytes (2029 bytes = 2.14% decrease)

Utilities for developers

We will now give some interesting programs to the Windows developers.

Command line editors/tools

Text editors

Give at least two text editors that incorporates a command mode:

  • vi
  • emacs

Images:

  • imagemagick A software to create and modify bitmap images.
  • jpegoptim A tool to optimize/compress jpeg files
  • optipng A tool to optimize png files

Http

  • wget A network downloader.

Manipulating text

  • dos2unix, dos2unix to convert plain text files in DOS format to Unix format and vice versa
  • awk A tool used to manipulate text.
  • sed A stream editor that is used to filter text in a pipeline. Sed performs operations on a text input and outputs the modified text.
  • Text2html, html2textText to HTML converter and vice versa

Archiving

  • tar A program to create archives from many specified files or to extract files from such an archive.

Compression

  • bzip2 A program used to compress and decompress files at a high rate.

This list represents only a small part of the Linux software available to you. But many of the bash commands have their equivalent in PowerShell. For example, PowerShell implements Compress-Archive and Expand-Archive cmdlets to zip or unzip files. In addition, Windows version of 7-Zip makes available rar, zip, gzip, bzip2 and tar. Many common Linux programs have already been ported to Windows.

Interest of Ubuntu on Windows

To develop on Windows, there are already powerful tools such as Visual Studio, PowerShell, Android studio etc...

Is it necessary to install Ubuntu on Windows?

Some programs may themselves execute bash commands or use Unix specificities. Their Windows version does not always work the same way. Adapting to Windows such programs can be a waste of time. This is currently the case of Jekyll, a static site generator in Ruby which depends on many Linux software (python, Markdown... )


CSharp

Categories

Share

Follow


KodFor Privacy Policy