Using Unix Commands On Windows
20:21
In our day to day life, we need to debug various issues with
the help of several log files e.g. application logs, server access logs, error
logs etc. and during this process we try to fetch relevant information from the
log file(s).
While working on windows with such files, we use various editors like
Notepad++, JujuEdit etc. But,
what if the log files are really big, somewhere in GB’s…? Most of these editors
get hanged while opening or they simply refuse to open such big files because
these editors support files up to 2 GB.
For such requirements there are few editors
like EmEditor,
Glogg etc. which can
open big files easily. These editors are really good and very fast for big files.
But here clicks a good question - “Can we execute 'grep' like Unix command(s) on such big files in our Windows command prompt...?” It would be great if we can get such luxury
on windows as well.
Fortunately it’s a “Big YES”. There are several open source software’s
which can be used to get most of the Unix
Commands running on Windows machine
in our familiar Windows command prompt.
Few such software's are- UnxUtils, Cygwin etc.
I have been using UnxUtils for a long time now on
my Windows machine. It’s a lightweight alternative among similar software’s. Getting
started with UnxUtils is pretty simple and
easy.
Let’s jump directly on the steps to get UnxUtils working on Windows
machine:
- Download UnxUtils.zip.
- Extract the downloaded zip at some location on your windows machine. On my machine I kept it at “D:\Softwares\UnxUtils”
- In the PATH environment variable set the path of utility till “wbin” directory. On my machine I set the PATH variable as “D:\Softwares\UnxUtils\usr\local\wbin”
- Before moving ahead, verify the PATH setting for “wbin” directory.
It's all set… J
Now, we can to use Unix
commands in our Windows command
prompt. Let’s quickly check the “grep”
command help in Windows Command Prompt:
Hope this article helped. Happy learning!
8 comments
Hey this is great.., thanks :-)
ReplyDeleteThanks so much... :)
DeleteHi Abhishek
DeleteHow does it differ from cygwin
Nilendu
Happy to hear from you... :)
DeleteUnxUtils are native Windows *.exe files that just work. No dependencies, nothing extra is required. Just download, extract and run.
Fame of this api lies in its usage simplicity. But yes, UnxUtils only provides a subset, as it restricts itself to use only the features provided by the Microsoft C Runtime environment. Also, it is less managed. On the other hand Cygwin implements a Unix-layer(via DLLs) on top of Windows. Definitely, Cygwin is more complete and well managed. I think Cygwin is really cool, but I personally don't use it because UnxUtils is just simple and much easier for running most of the day-to-day unix commands like 'grep', 'tail' etc.(used in dev environment) on Windows machine. You may refer the Cygwin wiki link, which gives insight for some Cgwin alternatives-
http://cygwin.wikia.com/wiki/Intro_to_Cygwin
Great work keep it up......
ReplyDeleteThanks, Nitendra! Happy to hear from you... :)
DeleteNice to know buddy
ReplyDeleteThanks so much... :)
Delete