Is there a way to add Unix commands to GitKraken? - windows

How can I use unix commands in Gitkraken?
So I've recently picked up coding again, going back to the basics, and when I was learning previously I used windows and installed Git Bash which uses a Unix command-line environment if I'm not mistaken. The Odin Project (the website I am learning to code from) does not support Windows as an operating system when learning to code due to various reasons listed on their website. I believe that Windows is adequate and would like to continue using it instead of using VMware or VirtualBox to 'install' Linux. The only issue I'm having is executing commands using GitKraken. Some of the commands are different, so I was just wondering if there is a way to use Unix commands in GitKraken? At this point, I am just curious if it is possible. I can continue to use Git Bash, however, GitKraken displaying a visual map of my repos is very helpful.
Ex. How to open a file
$ open ./index.html - macOS
$ start index.html - Windows OS
Any help would be appreciated.

Related

Can't run any commands in zsh: "Command not found"

I am simply trying to set up a dev environment to code on my Windows 10 PC for use alongside my Mac when I need it.
I have installed Bash, Z shell and Node.js.
All I want to do, bare minimum, is simply:
Be able to run npm commands, etc. (npm install X)
Open files with appropriate programs from the terminal. (on Mac, I can run open index.html or atom .)
My problem: Literally no commands work. I can't run node -v, I can't do start index.html, I can't even open the current directory I'm in with explorer.
For every command, I receive an error: zsh: Command not found (:node/start/explorer/etc.)
I am guessing it has something to do with my PATH variables? I'm not sure; I'm relatively new...
Please help - I've spent four hours searching Google, Stack Overflow, page after page, but somehow can't find a solution.
Thanks.
Sounds like you have an 'eco-system challenge'... :)
Perhaps whatever tool you used to install the tools you mention:
did not do a complete install OR
requires a 'reboot' to enable all the goodies?
I suggest using a small footprint Linux OS in a VM for this type of tinkering; there are many challenges in using *nix tools on Windows - better to learn/experiment in a more Bash-friendly environment, and then, when comfy, bring the tool sets to another OS.
If you still want to give things a whirl:
locate your Bash binary
Right-click and select 'run as admin'
then use your favorite online Bash tutorial or book to explore...
:)
Dale

How can I execute a bash file (.sh) on PostgreSQL? On windows [duplicate]

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
I have bought and I use Windows 7 Ultimate, and I like to use it to develop applications. One of the down sides (as with every OS) is that I can not run Bash scripts. Is there a way to run Bash scripts on Windows by installing some software? It is ok if it does not work 100%, but as long as the most common functionality is available it should be great.
Install Cygwin, which includes Bash among many other GNU and Unix utilities (without whom its unlikely that bash will be very useful anyway).
Another option is MinGW's MSYS which includes bash and a smaller set of the more important utilities such as awk (you may also want to check the competing fork - Mingw-w64). Personally I would have preferred Cygwin because it includes such heavy lifting tools as Perl and Python which I find I cannot live without, while MSYS skimps on these and assumes you are going to install them yourself.
Updated:
If anyone is interested in this answer and is running MS-Windows 10, please note that MS-Windows 10 has a "Windows Subsystem For Linux" feature which - once enabled - allows you to install a user-mode image of Ubuntu and then run Bash on that. This provides 100% compatibility with Ubuntu for debugging and running Bash scripts, but this setup is completely standalone from Windows and you cannot use Bash scripts to interact with Windows features (such as processes and APIs) except for limited access to files through the DrvFS feature.
Best Option I could find is Git Windows Just install it and then right click on and click "Git Bash Here" this will open a bash window
This will open a bash window like this:
and the linux commands work...
I've tried 'sh' , 'vi' , 'ssh' , 'curl' ,etc... commands
If you're looking for something a little more native, you can use getGnuWin32 to install all of the Unix command line tools that have been ported. That plus winBash gives you most of a working Unix environment. Add console2 for a better terminal emulator and you almost can't tell you're on Windows!
Cygwin is a better toolkit overall, but I have found myself running into surprise problems because of the divide between it and Windows. None of these solutions are as good as a native Linux system though.
You may want to look into using virtualbox to create a linux VM with your distro of choice. Set it up to share a folder with the host os, and you can use a true linux development environment, and share with windows. Just watch out for those EOL markers, they get ya every time.
Best option? Windows 10. Native Bash support!
You can always install Cygwin to run a Unix shell under Windows. I used Cygwin extensively with Window XP.
After installing git-extentions (http://gitextensions.github.io/) you can run .sh file from the command prompt. (No ./script.sh required, just run it like a bat/cmd file)
Or you can run them in a "full" bash environment by using the MinGW Git bash shell.
I am not a great fan of Cygwin (yes I am sure it's really powerful), so running bash scripts on windows without having to install it perfect for me.
In order to run natively, you will likely need to use Cygwin (which I cannot live without when using Windows). So right off the bat, +1 for Cygwin. Anything else would be uncivilized.
HOWEVER, that being said, I have recently begun using a combination of utilities to easily PORT Bash scripts to Windows so that my anti-Linux coworkers can easily run complex tasks that are better handled by GNU utilities.
I can usually port a Bash script to Batch in a very short time by opening the original script in one pane and writing a Batch file in the other pane. The tools that I use are as follows:
UnxUtils (http://sourceforge.net/projects/unxutils/)
Bat2Exe (http://bat2exe.net/)
I prefer UnxUtils to GnuWin32 because of the fact that [someone please correct me if I'm wrong] GnuWin utils normally have to be installed, whereas UnxUtils are standalone binaries that just work out-of-the-box.
However, the CoreUtils do not include some familiar *NIX utilities such as cURL, which is also available for Windows (curl.haxx.se/download.html).
I create a folder for the projects, and always SET PATH=. in the .bat file so that no other commands other than the basic CMD shell commands are referenced (as well as the particular UnxUtils required in the project folder for the Batch script to function as expected).
Then I copy the needed CoreUtils .exe files into the project folder and reference them in the .bat file such as ".\curl.exe -s google.com", etc.
The Bat2Exe program is where the magic happens. Once your Batch file is complete and has been tested successfully, launch Bat2Exe.exe, and specify the path to the project folder. Bat2Exe will then create a Windows binary containing all of the files in that specific folder, and will use the first .bat that it comes across to use as the main executable. You can even include a .ico file to use as the icon for the final .exe file that is generated.
I have tried a few of these type of programs, and many of the generated binaries get flagged as malware, but the Bat2Exe version that I referenced works perfectly and the generated .exe files scan completely clean.
The resulting executable can be run interactively by double-clicking, or run from the command line with parameters, etc., just like a regular Batch file, except you will be able to utilize the functionality of many of the tools that you will normally use in Bash.
I realize this is getting quite long, but if I may digress a bit, I have also written a Batch script that I call PortaBashy that my coworkers can launch from a network share that contains a portable Cygwin installation. It then sets the %PATH% variable to the normal *NIX format (/usr/bin:/usr/sbin:/bin:/sbin), etc. and can either launch into the Bash shell itself or launch the more-powerful and pretty MinTTY terminal emulator.
There are always numerous ways to accomplish what you are trying to set out to do; it's just a matter of combining the right tools for the job, and many times it boils down to personal preference.
There's one more theoretical possibility to do it: professional versions of Windows have built-in POSIX support, so bash could have been compiled for Windows natively.
Pity, but I still haven't found a compiled one myself...

UNIX script to run on WINDOWS

I got a couple of questions,
Is there any way to make a UNIX script run under a windows OS without any add-on like CYGWIN?
Is there any way to transform a UNIX script to a windows batch script, so that i can run it in windows cmd ?
I searched for that but i get referred to the UNIX command win2unix or unix2win , the ones that transform a file from/to windows/UNIX format.
Thanks for the help.
I know you don't want an "add on", but if this may help : you can download MobaXterm (or a portable version of it), which will come with many things, including many unix utilities (shell, etc) and lots you can download from their website.
The portable version is the most convenient (and you can carry it on your usb key, for example)
It's quite slower than cygwin/etc (most commands are emulated via some master binary, and many shell "builtins" becomes instead invocations of that binary, for example), but very portable and neat.
Other solutions (converting, etc) probably will also entail a binary of some sort, so I recommand the above, as it's very portable and gives you a kind of "mini unix inside windows"
Another answer for this old question is to install and run light Unix-like emulators. Here are some options:
MinGW -- native Windows port of the GNU Compiler Collection (GCC)
MSYS -- command line terminal called mintty, bash, version control systems like git and subversion, tools like tar and awk and even build systems like autotools
GitBash -- BASH emulation used to run Git from the command line. *NIX users should feel right at home
The above list installs micro environments much lighter than a typical Cygwin install. Also, in my experience most Bash scripts run on par with native Linux environments in these environments.
Yet another option is installing a Linux Subsytem like WSL2.
Yet another option is converting Bash to DOS by hand or with partial assistance of something like Bash-to-BAT converter, which isn't very full featured, and the Advanced Bash-Scripting Guide.

How to develop in Linux-Like Shell (bash) on Windows?

I'm Windows user. But according to my project requirements, I need to write Linux Shell Script(Bash shell). How to develop Linux Shell on Windows?
Is there any IDE for writing Linux Shell Scripting? Please share me some ideas and resource links.
You have quite a number of options:
cygwin
Install cygwin. It will give you a bash.
mingw
The minimal GNU for windows. Comes with set of commands, compilers. This came with my Git on Windows and now the default shell for small scripts
VM, such as VirtualBox
There are tons on VMs, VirtualBox being easy to use(it powers the Boot2Docker). You can do development and test on real Linux distros.
Ubuntu on Windows 10
There is new kid on the block. This allows you to run User Space Ubuntu using Windows Subsystem for Linux (WSL). see more on it at Microsoft blog
Other notes/IDE support
Shell scripts should be small, requires less IDE etc. I use VIM with syntax highligthing. But it seems ShellED may be useful in your case. I got the link from answer for this question - Bash script plugin for Eclipse?
IntelliJ has couple of plugins too for Bash..
I prefer Gow (Gnu on Windows) over Cygwin. Both will give you bash on Windows, but Cygwin has unnatural conventions for filesystem access (/cygdive/c/some/path instead of c:\some\path).
The native windows command terminal is pretty lame, take a look at Conemu.
I'm not aware of any bash IDE, but there are a plethora of windows text editors with decent syntax highlight for bash scripts. I like Notepad++ and Sublime text (the multiple cursor feature from Sublime rocks!). I don't recommend bash for anything with more than 30 lines, if you ever feel the need for an IDE, perhaps the task is more suited for Python, Ruby or Perl (IMHO Python is more maintainable).
The Bash shell is coming to Windows 10 in the upcoming Anniversary Update (Redstone).
The Bash shell is coming to Windows. Yes, the real Bash is coming to Windows, said Microsoft's Kevin Gallo at Build 2016 keynote. This is not a VM [Virtual Machine]. This is not cross-compiled tools. This is native."
Here's the steps to run Bash on Windows 10 OS:
Open the Windows Start menu
Type "bash" [hit enter]
Which opens a console running Ubuntu's /bin/bash with full access to all of Ubuntu user space
Yes, you are right, that means apt, set, ssh, rsync, find, ls, grep, awk, sed, sort, xargs, md5sum, gpg, curl, wget, apache, mysql, python, perl, ruby, ruby gem, php, gcc, tar, vim, emacs, diff, patch, nano...and most of the tens of thousands binary packages available in the Ubuntu archives!
Reference
Step-vise Guide to Enable Windows 10’s Ubuntu Bash Shell (Windows Subsystem for Linux)
The Bash shell is coming to Windows 10 in the upcoming Anniversary Update (Redstone).
Run native Bash on Ubuntu on Windows
Since you need to write linux shell scripts, you are learning Linux. So you should install Linux on your machine (preferably on its own partition and boot from it, otherwise in a VM).
Using cygwin or whatever imitation of Linux shell is not using Linux. You'll learn a lot more by installing and using Linux (and by developing on it with an editor like emacs or gedit or gvim ....). Also, take advantage that Linux is almost entirely free software, so you can study its source code and improve it.
Not installing Linux is not doing yourself a favor.
I believe cygwin is for those who love Linux but have to use Windows. It cannot give you the entire Linux feeling (e.g. you won't be able to write shell scripts looking into /proc which does not exist in Windows, even with cygwin).
If you want to use a simple environment emulating all Linux environment as alternative to cygwin (more lightweight) you can try mingw and you can use notepad++ or emacs or vim to provide some syntax highlight on sh scripts.
Everyone has said to go full Linux or use various mocks.
Cloud9.io is a good option if you don't need that much.
You can set up a "workspace" which can be accessed online, lets you write in literally any language similar to np++, but the best part is, it's an online Linux, so you have a terminal, with all your shell commands - no mock up, no dual boot.
The downside to this is that the free users aren't given that much power, so if you wanted to execute some high-level maths or output a large image, it will crash as you will be using too much memory. But it is still really worth getting into, it's only ever crashed once on me, and I do some pretty memory-intensive things.
There is cygwin , that's a linux console for windows.. so you can execute all the linux command with it.
Install Cygwin to execute the commands. However you can use NotePad++ as editor which has native windows binaries.
http://www.cygwin.com/
http://notepad-plus-plus.org/
For Eclipse Luna Should use this one old version fails on UI error
Help > Install New Software… > Add…
Name: ShellEd
Location: http://sourceforge.net/projects/shelled/files/shelled/update/
I had a similar problem.
I like both Linux and Windows, and I am working on both systems, but for programming (and generally, for text editing) I use Windows, for different reasons. For example, I write C/C++ code on Windows, using the Windows DevC++ IDE, then I can compile this project on Linux, by sharing the files on LAN. Now I have to write long scripts, and I would like to do it in a similar way. Ok, maybe its a special request, but maybe I am not the only one who works in such a mixed environment.
First, I tried notepad++ (it is suggested by others as well), but does it support syntax highlight for Linux scripts? I didn't found this feature...
Then I tried gedit compiled for Windows. It requires the GTK library installed (actually it was already on my Windows). Gedit has syntax highlight for scripts!
So I suggest using gedit for Windows for this case. The edited script can not directly be started/tested with it, but for editing, it is fine!

Is there a way to run Bash scripts on 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
I have bought and I use Windows 7 Ultimate, and I like to use it to develop applications. One of the down sides (as with every OS) is that I can not run Bash scripts. Is there a way to run Bash scripts on Windows by installing some software? It is ok if it does not work 100%, but as long as the most common functionality is available it should be great.
Install Cygwin, which includes Bash among many other GNU and Unix utilities (without whom its unlikely that bash will be very useful anyway).
Another option is MinGW's MSYS which includes bash and a smaller set of the more important utilities such as awk (you may also want to check the competing fork - Mingw-w64). Personally I would have preferred Cygwin because it includes such heavy lifting tools as Perl and Python which I find I cannot live without, while MSYS skimps on these and assumes you are going to install them yourself.
Updated:
If anyone is interested in this answer and is running MS-Windows 10, please note that MS-Windows 10 has a "Windows Subsystem For Linux" feature which - once enabled - allows you to install a user-mode image of Ubuntu and then run Bash on that. This provides 100% compatibility with Ubuntu for debugging and running Bash scripts, but this setup is completely standalone from Windows and you cannot use Bash scripts to interact with Windows features (such as processes and APIs) except for limited access to files through the DrvFS feature.
Best Option I could find is Git Windows Just install it and then right click on and click "Git Bash Here" this will open a bash window
This will open a bash window like this:
and the linux commands work...
I've tried 'sh' , 'vi' , 'ssh' , 'curl' ,etc... commands
If you're looking for something a little more native, you can use getGnuWin32 to install all of the Unix command line tools that have been ported. That plus winBash gives you most of a working Unix environment. Add console2 for a better terminal emulator and you almost can't tell you're on Windows!
Cygwin is a better toolkit overall, but I have found myself running into surprise problems because of the divide between it and Windows. None of these solutions are as good as a native Linux system though.
You may want to look into using virtualbox to create a linux VM with your distro of choice. Set it up to share a folder with the host os, and you can use a true linux development environment, and share with windows. Just watch out for those EOL markers, they get ya every time.
Best option? Windows 10. Native Bash support!
You can always install Cygwin to run a Unix shell under Windows. I used Cygwin extensively with Window XP.
After installing git-extentions (http://gitextensions.github.io/) you can run .sh file from the command prompt. (No ./script.sh required, just run it like a bat/cmd file)
Or you can run them in a "full" bash environment by using the MinGW Git bash shell.
I am not a great fan of Cygwin (yes I am sure it's really powerful), so running bash scripts on windows without having to install it perfect for me.
In order to run natively, you will likely need to use Cygwin (which I cannot live without when using Windows). So right off the bat, +1 for Cygwin. Anything else would be uncivilized.
HOWEVER, that being said, I have recently begun using a combination of utilities to easily PORT Bash scripts to Windows so that my anti-Linux coworkers can easily run complex tasks that are better handled by GNU utilities.
I can usually port a Bash script to Batch in a very short time by opening the original script in one pane and writing a Batch file in the other pane. The tools that I use are as follows:
UnxUtils (http://sourceforge.net/projects/unxutils/)
Bat2Exe (http://bat2exe.net/)
I prefer UnxUtils to GnuWin32 because of the fact that [someone please correct me if I'm wrong] GnuWin utils normally have to be installed, whereas UnxUtils are standalone binaries that just work out-of-the-box.
However, the CoreUtils do not include some familiar *NIX utilities such as cURL, which is also available for Windows (curl.haxx.se/download.html).
I create a folder for the projects, and always SET PATH=. in the .bat file so that no other commands other than the basic CMD shell commands are referenced (as well as the particular UnxUtils required in the project folder for the Batch script to function as expected).
Then I copy the needed CoreUtils .exe files into the project folder and reference them in the .bat file such as ".\curl.exe -s google.com", etc.
The Bat2Exe program is where the magic happens. Once your Batch file is complete and has been tested successfully, launch Bat2Exe.exe, and specify the path to the project folder. Bat2Exe will then create a Windows binary containing all of the files in that specific folder, and will use the first .bat that it comes across to use as the main executable. You can even include a .ico file to use as the icon for the final .exe file that is generated.
I have tried a few of these type of programs, and many of the generated binaries get flagged as malware, but the Bat2Exe version that I referenced works perfectly and the generated .exe files scan completely clean.
The resulting executable can be run interactively by double-clicking, or run from the command line with parameters, etc., just like a regular Batch file, except you will be able to utilize the functionality of many of the tools that you will normally use in Bash.
I realize this is getting quite long, but if I may digress a bit, I have also written a Batch script that I call PortaBashy that my coworkers can launch from a network share that contains a portable Cygwin installation. It then sets the %PATH% variable to the normal *NIX format (/usr/bin:/usr/sbin:/bin:/sbin), etc. and can either launch into the Bash shell itself or launch the more-powerful and pretty MinTTY terminal emulator.
There are always numerous ways to accomplish what you are trying to set out to do; it's just a matter of combining the right tools for the job, and many times it boils down to personal preference.
There's one more theoretical possibility to do it: professional versions of Windows have built-in POSIX support, so bash could have been compiled for Windows natively.
Pity, but I still haven't found a compiled one myself...

Resources