What is the best way to use linux utilities under windows? [closed] - windows

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
Linux utilities like sed, awk and other shell scripting features are awesome and life becomes a lot harder when I am developing on windows and cant use any of these.
People suggest to use cygwin for those who want the linux like tools under windows. But I feel cygwin will be an overkill for someone who only wants to use the handful commands.
Some say that Windows Services for Unix can also be a good alternative.
I have used none of these. Can some experienced programmer suggest best/simplest way to do this? of course apart from switching to linux itself.

I think the GnuWin32 project is exactly what you're looking for. Unix command line tools ported to Windows.

I've been using UnxUtils which are ports of common GNU utilities to native Win32 for ages.
I should add that I've also used Cygwin (et al.) and Microsoft's Services for Unix and neither of them were any good for me because they don't work as well as native versions from the command prompt, and using ksh/bash/whatever under Windows never really works right, even though I use ksh under unix all the time.

I tried something like this quite often, but to be honest, none of it really works well.
I therefore suggest using a virtual machine (such as VirtualBox) and install a small linux inside that. You can easily move files from and to the guest system with shared folders.
Judging by my experience, it is the best solution I used so far.

I tried Gow for some time, and it's nice. It offers 130 Unix-shell utilities for Windows. The contextual menu in the File explorer, to start a prompt in the current folder, is really handy.

There's a GNU port of many of the utils. I find that quite useful.
If you need Perl, I recommend Strawberry Perl.

The problem with most of the tools suggested here is that they don't get updated very often E.g. the last update GnuWin32 got was on 27 December 2010; UnxUtils was last updated on 01 March 2007.
I suggest MSYS2, a very good option which has a Win32 port of Arch's pacman package management system built-in. It's a spin-off from Cygwin like MSYS but much better than MSYS (lots of packages and gets updated almost daily) and (very light as opposed to) Cygwin.
It's a rolling release distribution that works under Windows and thus you get the latest and greatest of the packages. MSYS2 additionally has MinGW, provided in both x86 and x86_64 flavours. They've their own list of packages - MinGW packages.
Maintainers are very affable too.

MSYS is a common alternative for people who find CygWin excessive. It's still a special prompt, but it was originally intended to set up just enough Unix-compatibility to build programs using the MinGW compilers and the typical configure/make routine.
Using tools like sed and awk isn't going to work quite as expected in a normal Windows command prompt. It can be done to a point, but common usage involves command-line syntax that is normally interpreted by the shell, but which the Windows command prompt doesn't support. One example is wildcard file specifications. I've often found that Unix-centric tools aren't as usable on Windows as they assume the shell has expanded those wildcards into lists of files for them.

Install msysGit (netinstaller), it comes with a (msys/minGW) shell environment.
It also adds a "open shell here" in explorer.
It's faster than Cygwin, but at the sacrifice of unix compatibility.

Maybe it is stupid, but I usually search google for i.e.: "indent windows". You can select tools from mixed platforms. Lot of stuff from open systems has been ported on windows.

Related

GnuWin32 or Cygwin - from a programmers point of view

For a programmer with Linux skills and a love of the command line, what is better to use on Windows - Cygwin or GnuWin32?
I tried to find a good comparison or a list of differences but couldn't find anything remotely complete. Also, I wondered whether this should be a superuser.com question, but decided against it, because I'm asking precisely for use of the tool for a programmer.
I'd like to know the common pitfalls and restrictions of each of the solutions. Interoperability with windows is an important issue, for my main development is done in MSVC...
It is absolutely no contest
GnuWin32 does not include Bash
This is a critical part of the Cygwin distribution. Switching from cmd.exe to Bash was a huge boon to my productivity. cmd.exe is cripped in comparison to Bash.
GnuWin32 is old
Many program go years without being updated.
tar 2003
coreutils 2005
zlib 2005
make 2006
wget 2008
I would not use GnuWin32 unless I had no other choice.

cross-platform scripting for windows, Linux, MacOS X [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
The community reviewed whether to reopen this question 11 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I'm looking for cross-platform scripting (language) for windows, Linux, MacOS X.
I'm tired of .bat / bash .
I would like to do things like for example ,,lock workstation'' at automatic login (I had this in X-Window but the solution was pretty ugly; now, I would like that on MS Windows and not that ugly :-) ).
Generally: automate tasks.
Or would I be better off with Windows Scripting Host?
PowerShell also comes to mind, but that's seems to Windows-only for my taste.
Can languages like Python, Ruby, (Java?) interact (elegantly? sensibly?) with WSH?
Also things like DBUS, DCOM, etc come to mind as part of the picture.
Currently I use a mixture of Java, .bat, bash, Ruby, Scala; some VBA for Excel. Which sometimes gets pretty ugly.
I would like a cross-platform general solution with/using ,,native'' parts close to OS-specifics. Like e.g. Ruby driving some Windows-specific stuff (just a guess).
What do You use?
TIA
I'm a huge fan of Lua:
Syntax is vaguely Pascal-like and works well in scripts.
Superb power-to-weight ratio. Superb engineering. Very good design.
Extremely portable to any platform with an ANSI C compiler.
GUI support through wxLua and other bindings
Some support for hiding OS differences in common tasks, e.g., the Lua File System add-on
The core system and libraries are simple enough that you can understand all of what you're using, but still have excellent leverage compared to bash/bat. Expressive power is comparable to Python or Ruby.
You're not overwhelmed with libraries and frameworks, which can be a plus or a minus.
There is an excellent book: Roberto Ierusalimschy's Programming in Lua; you can get the previous edition free online.
Performance beats tcl, perl, python, ruby
For even faster performance on x86 hardware, there is LuaJIT.
Finally, and this is the ace in the hole: if you run into any kind of platform-specific problem, it is easy to write platform-specific C code and load it into a Lua script dynamically. Lua was designed with this task in mind and does it extremely well. You can also easily dip into C for performance (e.g., compute MD5 checksum).
Over the last 3 to 5 years, I have been gradually migrating scripts from bash/ksh/awk/sed/grep/perl into Lua. I have been very happy with the results.
You could try Batsh
Batsh is a simple programming language that compiles to Bash and Windows Batch. It enables you to write your script once runs on all platforms without any additional dependency.
Perl and Python are both available on almost every platform
I think you're juggling on the edge of contradictory: you would like platform-independent (commendable) but also "close to OS specifics".
If, however, you put a bit more emphasis on platform independence, I've been entertaining the idea of using groovy (a more java-friendly relative of ruby) for general purpose scripting. When you need it, you get OS-specific behaviour by invoking OS shell commands.
My motivation is a bit different: I find groovy code to be more robust than that of bash, although I too will need a good multi-platform scripting tool for a project I'm developing.
You could write your scripts in Tcl.
the syntax is simple and closer to
what you'd expect from a script;
it is cross-platform, and will run on all major platforms;
you can easily create simple GUIs for your scripts in Tk, which will also work everywhere and use native controls;
for the Windows-specific functions,
you can use Twapi (Win32 API
bindings).
you can install a Tclkit, which is a single file that is the whole Tcl distribution. There's no lengthy install process or hidden files or mysterious directories;
you can easily put a linux, windows and mac runtime on a single flash drive so you always have an interpreter handy even if there's not one installed locally.
Like e.g. Ruby driving some Windows-specific stuff
It certainly can and on the Ruby on Windows blog you can find lots of examples also there's a chapter in the Pickaxe book and in the humble one.
there is possibility for UNIX and UNIX like platforms in shell, but I don`t think that this what you are asking for is possible in any scripting language because of windows.
For UNIX systems you can use this:
#!/bin/sh
TYPE=`uname`;
echo 'this is ' ${TYPE};
if [ ${TYPE} = HP-UX ]
then bdf /var;
elif [ ${TYPE} = Linux ]
then df -h /var;
elif [ ${TYPE} = FreeBSD ]
then df -k /var;
else echo "Unsupported OS - ${TYPE}"
fi
I hope it will help you!
source
I would use C# with Mono.
Not sure if you still need it, but if so, try ant ( http://ant.apache.org/ ). It's a cross platform "script language". Basically, a ant file is a xml file interpreted by a JVM programm.

Development Environment in Windows [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
What are your recommendations for setting up a development environment in Windows, especially when not using an IDE. I am attempting to familiarize myself with Windows, and I feel a bit lost. What do developers commonly work on, especially when developing in multiple languages (e.g. Java, Python, C) in the same time.
So far, I have been a hardline using Mac+Linux environments where I love my command line a lot. I pretty much run all my compilations, testing, code repository commands in the terminal and have multiple terminals all the time. Terminal features (e.g. integrated bash completion, easy copy&paste, easy to setup environment variables) and package management tools (e.g. apt-get, port, fink) are quite handy. I dislike hunting down different websites to install their latest binary build.
Coming back to my question. My question is two fold:
What's commonly used? Do developers on Windows commonly use command line, or just be satisfied with an IDE?
For comers from Linux/Mac world: what do you recommend to get up to speed?
NOTE: I realize that a lot of Windows developers haven't used Linux, so they may not know what I'm talking about when it comes to Linux environment.
It's almost unheard of to not use an IDE for Windows development.
I started programming in the early 80's so grew up on the command line, but nothing beats a modern IDE for productivity.
By far the most common choice is Visual Studio, though I have also used #develop (open source) and find it a fine platform to get up to speed with.
I have used Eclipse extensively (on Linux and Windows) and find Visual Studio to be easier to use. I especially miss options for debugging under windows such as moving the instruction pointer around during debug and change-and-continue (change the code, within limits, while debugging, move the instruction pointer back if necessary, and keep debugging).
If you have used Eclipse, Visual Studio or #develop will not be that hard to get used to.
I tend to install cygwin, which is a unix emulation layer and includes many of the standard unix utilities (grep, awk, sed, etc). You can use bash or any other unix shell with cygwin to basically give yourself a unix environment on windows.
There are some downsides, paths are a good example. Windows programs expect windows paths while the unix tools expect unix paths. You can convert between the two using the cygpath program, but sometimes its tricky to know when to use it.
Another thing I do fairly often is create a bunch of batch files that load different programs onto my path. This allows me to have different version of say java installed and I can pick the version I want to use for any given shell session. I link a bunch of these together so that I have a full environment for the program I'm working on. For example, if I require java 1.5, maven, subversion then I would have a batch file to load each into the environment, then have a master file that loads all of them for a standard environment.
This approach gives a lot of flexibility and is really easy to maintain and work with different environment simultaneously.
Most windows developers that develop on the microsoft stack of products probably use Visual Studio. For windows development without Visual Studio, SharpDevelop is the current most popular alternative.
However if you are looking for a user experience more similar to linux you can always use windows command prompt and all of the command prompt compilers still exist. Just like with linux you'll have to modify your environmental variables to make everything work you you'd like it to.
If that still isn't close enough to the feel on linux, you can try out Cygwin.
Many of your common utilities from linux like gdb do have windows builds as well.
And of course there is the Eclipse IDE that is used for many languages, by many people, on multiple platforms. It is very extendable.
Some other tools you may be missing:
GCC - Available Via Cygwin
MS Build can give you similar functionality to what you had with make (I'm not sure if nmake is still used/supported)
Vi/Vim
Grep
SysInternals will have lots of various file/process monitoring utilities to hopefully adequately replace what you miss being able to simply get from /proc
Wireshark(or ethereal) to replace well... wireshark/ethereal/
Tail is available in the Windows Resource Kit
Emacs
Hopefully that covers most of your basic tasks.
Microsoft now has a real shell for Windows: Windows PowerShell.
In addition to Cygwin, there are ports for a lot of the GNU utilities and toolchain to Windows. GnuWin32 seems to be a more up-to-date version than UnixUtils. MSYS is essentially a port of BASH to Windows, but it's fairly useless without the MinGW userland.
C++ / .NET Development: Visual Studio 2008
Java / PHP Development: Eclipse IDE, which also supports C/C++.
For a non-IDE solution, Notepad++ is a very good code highlighter that supports many languages.
Simply install cygwin. The quality has improved dramatically in recent years. I'm currently running cygwin x64 on Vista, and it's great.
One thing to especially take note of in cygwin is your path. Most troubleshooting with scripts and installed software should begin there.
The other tip I'd give is to use the rxvt terminal over the standard issue cygwin terminal. It might be installed by default nowadays, but check to make sure.
Visual Studio for .net/C++ (even the express editions are useful)
The sysinternals tools rock, especially Procmon and process explorer.
If you do native/C++ work knowing windbg can be helpful
Notepad++ and gvim are my preferred editors
For doing command line/shell stuff I often use python to write short scripts (for anything but the simplest batch file)
If you are familiar with .net then learning powershell isn't much of a stretch and there is a ton of functionality available

Universal scripting language for Windows [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Linux user - Windows noob alert ;)
Could someone recommend me scripting/programming language that's functional and works on all Windows (let's focus on XP, maybe Vista too) machines without additional installation? Something that won't make me install new things to run code.
For example on Linux I have shell (heh) and can code basic things without installing anything; python is usually installed by default and I can use it without installing anything, etc. I'm searching for something like this for Windows (I guess that if I wanted to use python on Windows I would have to install it first).
...bat files? Is this used at all now?
.NET (for, let's say C#) isn't installed by default, I guess?
Something else?
VBScript and JScript are two such languages.
you can use batch files withount any additional software
PowerShell is included in Windows 7 (RC) by default and cannot be uninstalled; with XP/Vista you need to install it
Powershell.
Does require an installation, but well worth it.
#OP if you want a "universal" scripting language, why don't you try out Python (for windows, go to ActiveState Python). (Or even Perl/Java etc) As for using batch, powershell, vbscript, the one minor thing to take note is that scripts written in them are not portable to *nix. therefore, cannot be considered "universal"
What about Windows Script Host?
cmd
VbScript will work but you probably want to go through the pain of installing powershell.
This may be surprising to you as installing windows software involves double clicking the installer.
In all seriousness though if you're going to learn a new shell for windows, learn powershell, very very good.
For XP and Vista, you can stick with the enhanced functionality in the cmd.exe shell scripts.
BAT files are still used as well.
Powershell is supposed to replace VBS and JS as the scripting language of choice on Windows machines but I'm not sure if you can assume it's present yet. .Net 1.0 is a pretty safe bet though.
As a Linux user I think you will like portablepython.
PowerShell, without a shadow of a doubt. It's the future (and fortunately also the present) of scripting on Windows.
Download PowerShell

What is the opposite of Wine? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
What if I want to run native Unix-like applications on Windows? What's the best application out there?
Cygwin is closest to what you are looking for, though not exactly like Wine.
Cygwin is a Linux-like environment for Windows. It consists of two parts:
A DLL (cygwin1.dll) which acts as a Linux API emulation layer providing substantial Linux API functionality.
A collection of tools which provide Linux look and feel.
It is not binary-compatible with Linux applications, you still need to rebuild them from source to run under Cygwin. Once rebuilt, however, they should work exactly like on Linux.
Not quite the same, but you could also run a full linux installation inside a VM such as Virtualbox: http://virtualbox.org/
Take a look at andLinux (based on coLinux).
From the site:
andLinux is a complete Ubuntu Linux
system running seamlessly in Windows
2000 based systems (2000, XP, 2003,
Vista; 32-bit versions only).
...
Although this technology is a bit like
running Linux in a virtual machine,
coLinux differs itself by being more
of a merger of Windows and the Linux
kernel and not an emulated PC, making
it more efficient. Xming is used as X
server and PulseAudio as sound server.
andLinux is not just for development
and runs almost all Linux applications
without modification.
Not Cygwin.
What Isn't Cygwin?
Cygwin is not a way to run native linux apps on Windows. You have to rebuild your application from source if you want it to run on Windows.
Cygwin is not a way to magically make native Windows apps aware of UNIX ® functionality, like signals, ptys, etc. Again, you need to build your apps from source if you want to take advantage of Cygwin functionality.
Cygwin will give a Linux-like shell but can not directly run linux applications in Windows. Cygwin "acts as a Linux API emulation layer providing substantial Linux API functionality."
At one point in the distant past, there was LINE Is Not an Emulator, which aimed to be exactly the inverse of Wine: provide binary compatibility for Linux executables running under Windows.
It kinda worked, at least as a proof of concept, but there isn't a big need for it.
If you're interested in porting those *nix applications to a Win32 environment, you might take a look at the MinGW project. I've mainly used it for GCC on windows, but they also provide an interesting environment called MSYS:
A Minimal SYStem providing a POSIX
compatible Bourne shell environment,
with a small collection of UNIX
command line tools. Primarily
developed as a means to execute the
configure scripts and Makefiles used
to build Open Source software, but
also useful as a general purpose
command line interface to replace
Windows cmd.exe.
Microsoft, for a while, offered SFU which sort of works for some things. Cygwin works much better.
If you're hoping for ABI Compatability, as wine offers unix systems for windows binaries, things are quite bleak. CoLinux also sort of works, but generally won't help you at all with any kind of graphical application, unless you configure a windows X11 server as well.
I've used andLinux which is built on coLinux. The organization has compiled an Ubuntu installation (Gutsy, I think, but I upgraded to Intrepid pretty easily).
One warning: development on andLinux is pretty slow -- the last beta has been out for almost a year.

Resources