What's the difference between Git bash and WSL - bash

I just installed Git SCM on my Windows machine. My machine had Node installed earlier. I am able to use node -v in git bash. But, Why I am able to use windows applications inside Git Bash and not in WSL Bash.
Inside WSL Bash-
hello#comp:~$ node -v
Command 'node' not found, but can be installed with:
sudo apt install nodejs
Inside Git Bash-
hello#comp MINGW64
$ node -v
v12.10.0

WSL is an a Linux like compatibility layer. You run Linux applications on top of WSL and they think they are running natively on Linux while the system calls are being translated to Windows OS system calls (WSL2 -- not yet released -- is a full Linux kernel running inside Windows). You do get to access Windows files through /mnt/c/... but that's about all you can expect in terms of Windows-Linux interoperability.
Git-bash, on the other hand, is a Windows app -- a shell running windows applications. Some of these may be compiled with a Linux compatibility library (Cygwin). But they don't have to be. This provides a less "Linux-like" experience but may be a good compromise if all you want are some Linux command line tools and don't need to install full-blown Linux executables.

Definition of PATH for both "environments" is different. Check that node's dir shows up on Git bash's and not in WSL Bash. Run this on both environments:
echo $PATH

Related

how can i install heroku in my kali linux operating system?

I cant install heroku in my kali linux operating system. how can i resolve this issue?
isn't it not possible to run heroku in kali linux?
when I have try to install, it show snap command not found.
Heroku no longer supports Snap installs:
Snap installs are no longer supported. Please use another install method below.
Since Kali is derived from Debian, you should be able to use the Debian / Ubuntu method (which doesn't auto-update) or the standalone tarball method (which does). You can also use the NPM / Yarn package if you prefer, though Heroku recommends against it.
All of these options require some amount of trust in Heroku. The first two pull a script down from the Internet and pipe it into sh, which always makes me a bit uneasy. I suspect they both request elevated privileges during the install process. Instead of piping the file directly in to sh as Heroku recommends, I suggest you download it and at least give it a quick read through the first time.
In any case, here is the command that Heroku recommends to install the standalone version:
curl https://cli-assets.heroku.com/install.sh | sh

What is the easiest way to run bash dependent dockerfiles on windows?

I need to setup docker on my windows 10 OS. I've previously been a linux guy where everything just works so this is a pain for me. It works as expected but within the dockerfile there are calls that uses /bin/bash which makes the build fail.
I've tried to setup a VM with hyper-v but then i stopped because i figured there must be an easier way. I found the bash.exe in windows. i can't run as sudo but i guess that doesn't matter here as long as i run bash as administrator. wget works here but the docker program cant be found when i run docker --version.
Is the easiest way to run bash scripts on win10 with the bash.exe? And why can't docker run in the bash terminal (there is no .bashrc)?
I would use Linux on the Windows box. The two systems can access each other's file systems (\\wsl$, /mnt/c). I use Ubuntu, and it's as if I was using a "normal" Ubuntu box in all aspects, so far. I'd be surprised if your process didn't work here.
Alternatively, there's Cygwin. When running Cygwin, you're kinda in a VM, kinda not. It's a bit blurry. As such, it's not as robust as WSL. But it might do the trick, and it's a lot less "heavy" than installing a full Linux distro.

FreeSurfer installed on Ubuntu

I am trying to install FreeSurfer on Ubutun. I follow an installation instruction online. When I walk through this step, I have a question:
Here is your FreeSurfer license. Place the four lines between theCUT HERE markers in a file named "license.txt" in the directory pointed toby the $FREESURFER_HOME environment variable (see the FreeSurfer documentation).
#---------------CUT HERE---------------
xxxxxx
xxxxx
xxxxx
xxxxx
#---------------CUT HERE---------------
Does that mean I have to paste the four lines into a file called "license.txt"? I actually did in this way. I paste the four lines at the end of a file called "license.txt". But when I finish all the steps and check the installation. There is an error popping up:
ERROR: FreeSurfer license file /home/urser/Downloads/freesurfer/license.txt not found.
But the license.txt is really in that fold called "freesurfer". Do I misunderstand the instruction?
Please follow the instructions:
Requirements
sudo apt-get install tcsh
Download and installation
cd ~
# this is the 64 bit version
wget ftp://surfer.nmr.mgh.harvard.edu/pub/dist/freesurfer/5.3.0/freesurfer-Linux-centos6_x86_64-stable-pub-v5.3.0.tar.gz
cd /usr/local/
sudo tar -xzvf ~/freesurfer-*.tar.gz
Setting the environment
echo "FREESURFER_HOME=/usr/local/freesurfer" >> ~/.bashrc
echo 'source $FREESURFER_HOME/SetUpFreeSurfer.sh' >> ~/.bashrc
Cleaning up -> this is optional
rm ~/freesurfer-*.tar.gz
Registering your software
Now register at https://surfer.nmr.mgh.harvard.edu/registration.html and paste the license code emailed to you here, PLEASE BE EXTRA CAREFUL WITH THIS STEP:
sudo gedit /usr/local/freesurfer/license.txt
I am not sure whether this next step is essential, but I usually run it.
sudo ln -s /usr/lib/libtiff.so.{4,3}
Conclusions
All in all, installing Freesurfer is not that hard, but installing it in a new linux system is surely a better option than messing with VirtualMachines in Windows. The VM that they offer in their website does not allow to run the commands in files residing in the host machine, which is the point of running a VM in the end.
Source
The current freesurfer 7.2 version has some semblance of a binary installer (.deb package) that worked for me on Ubuntu 18
(https://surfer.nmr.mgh.harvard.edu/fswiki/rel7downloads). On Windows, in lieu of running Ubuntu in a VirtualBox VM (which includes an X-server), you can use the windows subsystem for linux (WSL) to download and run the default Ubuntu image. Then try to download and run the freesurfer .deb binary installer in Ubuntu. With WSL 1 or 2 you can access the path to your windows home directory mounted in linux (https://surfer.nmr.mgh.harvard.edu/fswiki//FS7_wsl). You still need to setup an X server on Windows 10 to work with freeview running in Ubuntu under WSL, but I read that should no longer be necessary with WSL in Windows 11. Once you obtain a freesurfer license (https://surfer.nmr.mgh.harvard.edu/registration.html) then just set the environment variable FS_LICENSE to the absolute path for the license file, e.g., in your shell init file in Ubuntu (in order for freeview to run).

osx terminal syntax emulation on windows for node scripts

So I have a package json file that was built with osx in mind and it contains scripts for installs and builds. A lot of the scripts in that file have osx terminal specific syntax. Is there a way to emulate that terminal in windows so that syntax is read properly?
P.S. I've tried cygwin mintty (now called cygwin64 terminal), but still have the same issues.
EDIT My intention is not to maintain two files that essentially do the same thing and because we started off only using npm package manager I really don't want to introduce a task runner at this point.
EDIT 9/15/15
Here's an example of cygwin not emulating syntax:
NODE_ENV=production bin/build.sh in linux (ubuntu) will assign "production" to the node_env var and then execute the shell file build.sh, but in windows this syntax will cause errors with the var assignment and with the execution of the shell script file unless I use this syntax: setx NODE_ENV production&&bash bin/build.sh
OS X is based on BSD, so the closest approximation would be using a BSD VM.

Why Rethinkdb don't have binary for windows?

I am interested in Rethinkdb and would like to develop/test on it, but main problem is: it don't have package for windows operating system. I tried to compile from source code, that was also not possible as there was no any instruction.
What makes it so difficult to make executable for windows? Is there any alternative way to install Rethinkdb in windows OS? even very small and not that famous application has windows binary but not Rethinkdb. It is quite surprise for me. Another surprising is there are many community executable for other OS but not windows.
Thank you for understanding and waiting for good answer.
Rethinkdb just announced that it started development for Windows. Please follow
[1] https://github.com/rethinkdb/rethinkdb/issues/1100
[2] https://twitter.com/segphault/status/590633792781611009
Update:
RethinkDB announced in Windows :
[3] https://rethinkdb.com/docs/install/windows/
Cross-platform development isn't that easy. RethinkDB uses some features under the covers which makes porting it to Windows a difficult job, f.e. a Unix toolchain for the builds and Unix syscalls. For more information on that have a look at this GitHub issue. It states that Windows support is planned, but with low priority.
As a quick fix, you could RethinkDB run in a virtual machine or in Microsoft Azure. For the second one, I wrote a blog post a few weeks ago.
RethinkDB has already started development for Windows. While it's not released yet, this is how you can run it through Vagrant. See: https://github.com/gearz-lab/rethinkdb-vagrant
I'm using Chocolatey, feel free to skip steps if they don't apply.
Installing Chocolatey
Open Powershell as an administrator and run this command:
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
... now you should have Chocolatey installed. We're gonna use to install the others.
Installing Vagrant
Run this as an administrator:
choco install vagrant -y
Installing VirtualBox
Vagrant relies on a virtualization application that it calls a "provider". The default one is VirtualBox so let's install it. Run cmd as administrator and run this:
choco install virtualbox -y
Now you should be able to run the vboxmanage command. If it doesn't work, make sure C:\Program Files\Oracle\VirtualBox is in your PATH.
Installing Cygwin
We're gonna log on a virtual machine using SSH, so we need a SSH enabled terminal. For that, let's use Cygwin.
choco install cyg-get -y
Installing Cygwin packages
There'are two Cygwin packages we need to install, openssh, because Cygwin doesn't have SSH support by default, and rsync so Vagrant can use it to synchronize files between the host and the guest machines.
On PowerShell, running as an administrator, let's run these commands:
cyg-get openssh
cyg-get rsync
Cloning rethinkdb-vagrant
Open the Cygwin64 Terminal. You should now be in your Cygwin home folder, which should look like C:\tools\cygwin\home\[YOUR_USER].
Make sure you have git installed. If you don't just choco install git -y. Now, clone rethyinkdb-vagrant:
git clone https://github.com/gearz-lab/rethinkdb-vagrant.git
Now you should have a directory like this: C:\tools\cygwin\home\[YOUR_USER]\rethinkdb-vagrant.
Starting Vagrant and useful commands
From inside the Cygwin64 Terminal home directory (described in the last step), type cd rethinkdb-vagrant, now, any Vagrant commands will target cd rethinkdb-vagrant.
To setup and boot the machine: vagrant up (After this, RethinkDB is available, see next step).
To access the machine's terminal: vagrant ssh.
To destroy the machine (every RethinkDB data will be lost): vagrant destroy.
To suspend the machine: vagrant suspend.
To resume a suspended machine: vagrant resume.
Accessing RethinkDB.
Make sure you have vagrant up from the last step. Now:
For accessing the web administration tool: http://localhost:8080.
For accessing RethinkDB from a client app, the port is 28015.

Resources