Monday, 28 January 2019

command line - Difference between UnxUtils and GnuWin32?


I am a Windows user who wants programs like grep and sed along with other utilities like ls, cut etc in my command prompt. I came across 2 packages which would accomplish this



I would like to know what is the difference between the two both feature wise and more importantly performance wise before I choose between them. From what I have seen GnuWin32 is a super set of UnxUtils. Is this correct ?


Note by Barlop
this question was asking about coreutils and unxutils, but since he was talking about grep and sed, it's clear he meant to ask about gnuwin32 and unxutils, and that is a much more useful and important question than the mistaken one. If people want to revert it to coreutils and unxutils then i'd be happy to go with that and post another question for gnuwin32 and unxutils. Also, any proper answer to his original question would correct or answer regarding his mistake but also answer what he meant. So there's no loss in correcting his question.



Answer



unxutils has really old versions of a bunch of some of the most useful utilities. including grep for example.


gnuwin32 versions are also many years out of date, though not nearly old as unxutils. Gnuwin32 has a much larger number of utilities. That's obviously a major advantage.


Bear in mind that gnuwin32 has that major advantage over unxutils.


As an example..


The extremely old unxutils


C:\unxutils>grep -V
grep (GNU grep) 2.4.2

Copyright 1988...

The rather old gnuwin32


C:\blah>"c:\Program Files (x86)\GnuWin32\bin\grep.exe" -V
GNU grep 2.5.4

Copyright (C) 2009 ...

Contrast with software that is kept more up to date than gnuwin32 e.g. cygwin


$ grep --version
grep (GNU grep) 2.21
Copyright (C) 2014 Free Software Foundation, Inc.

With unxutils, you can run into issues as it uses really old versions, and when looking for help people will expect you to have the latest version of this or that command.


There are some smaller advantages that unxutils has, that makes unxutils very useful.



  • unxutils has xxd, gnuwin32 does not. (Note, VIM 7 also has xxd, so does cygwin)


  • gnuwin32 as of writing(2014) has a broken tail -f, unxutils's tail -f is older but works. (mentioned here Cygwin's tail also works ). On two different occasions i've run into bugs in gnuwin32 grep which have been fixed in later versions of grep and cygwin's grep was much later and fine(and can be run straight from cmd.exe and doesn't have to be run from the cygwin shell).




  • the following is a smaller advantage, but if you're very lazy, or just want to use it quickly, then unxutils is just a zip you can extract the executables and go. Gnuwin32 involves a wizard to install various bits, and even some individual utilities have to be installed separately like a setup executable for wget, one for grep e.g. (grep-xxxx-bin.exe). with unxutils you just extract from their wbin directory within the zip. Bear in mind though they are older versions so if possible, if not being too lazy, one would generally see if gnuwin32 has it.



  • unxutils can work standalone where lots of the equivalent gnuwin32 binaries cannot. So if you don't want to or can't install gnuwin32 then you can use a command standalone, from unxutils. For example, gnuwin32's tr.exe requires two dll files in its directory or it says they're not there and won't run. gnuwin32's sed doesn't work standalone, whereas unxutils tr.exe and sed.exe work fine standalone.

  • unxutils has gclip.exe and pclip.exe They are commands to copy to the clipboard and paste from the clipboard. gnuwin32 doesn't seem to have anything like it, and windows natively has clip.exe (to copy to the clipboard), but no command to paste it like pclip.


The unxutils sourceforge link has unxutils.zip and unxupdates.zip (the latter being a subset of unxutils.zip but with later though still old versions). e.g. unxutils has sed from 1998, and unxupdates has one from 2003. That can help e.g. the 1998 sed doesn't have \d or \x notation e.g. e.g. \d34 or \x22 to specify quotes(easier than escaping quotes),. The unxupdates one is from 2003 and does.


The gnuwin32 sed, as of writing, is from 2009. (Gnuwin32's is still out of date as there is a grep version even for 2014 http://ftp.gnu.org/gnu/grep/ but gnuwin32's is much less out of date than unxutils(even when unxutils is considered with 'unxupdates').


The http://unxutils.sourceforge.net/ site's unxutils.zip is down but is available https://archive.org/details/UnxUtils and officially https://sourceforge.net/projects/unxutils/ and if you're going to get it then download unxupdates too


Comparing gnuwin32 to unxutils, generally look to Gnuwin32, but know that unxutils has some advantages.. Gnuwin32 has almost all the commands that unxutils has, plus a lot more.


And also, look to Cygwin, it has a huge collection of utilities kept much more up to date than gnuwin32, (they should be run from cygwin's bash shell, which is fine by me), you generally don't really need to look at something ancient and not updated like unxutils, though it does have pclip and gclip.


besides gnuwin32 and unxutils, there are also MinGW and cygwin and Windows SUA(which as of writing, MS still maintains and would be up to date) and GOW(which is small, though the GOW github page shows it as last updated 2014) and smaller still, BusyBox(famous for android but is available for Windows, here and is still very small. The two most impressively featured for me are gnuwin32 and cygwin (and cygwin has xxd and a working tail -f. so I don't need to resort to unxutils) With cygwin, programs should really be run from the cygwin shell but its a linux shell e.g. bash shell and bash and other linux shells are powerful so no loss there. Also bear in mind that nowadays many people use linux virtual machines instead of cygwin or gnuwin32, which really gets up to date proper versions of the commands, rather than windows ports that can be older and can behave differently with quotes.


Added Note- coreutils aka gnu coreutils, is a bunch of commands that run on linux (..), and no doubt the GNU OS with Herd (a less widely used OS!), and probably has some decent implementations done for other *nix OSs. GNU Coreutils is well known and extremely widely used and useful and updated. On the other hand unxutils is a very old implementation/port of some commands people use on linux or unix, (which would no doubt include some coreutils commands), done for the windows OS. The two wouldn't normally even be mentioned in the same sentence and the only reason why they were in the original question, was due to some confusion in the original question. GnuWin32 does have an implementation of coreutils for Windows, called Gnuwin32 coreutils , though as mentioned, Gnuwin32 is old/not updated, just not as old/not updated, as unxutils.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...