How to launch .exe files from windows 10 (ubuntu) bash? - windows-10

I've installed sublime text from bash but it doesn't work it just return the bash prompt again .
then
I installed sublime natively on windows , problem is I can't run it from bash .

It is already supported in Windows 10 latest build (build 14951), used like this:
$ export PATH=$PATH:/mnt/c/Windows/System32
$ notepad.exe
$ ipconfig.exe | grep IPv4 | cut -d: -f2
$ ls -la | findstr.exe foo.txt
$ cmd.exe /c dir
more information here.
There is a ticket about it in their Github page with some hacks you can use meanwhile.

It appears at this time, the cbwin project is our best bet. I just started running into these same issues with trying to use vagrant from Bash on Windows, and my vagrant install ran into issues that required kernel support (currently lacking in Bash on Windows).

Related

Opening files from Centos command line in Sublime Text on Windows

I am puttying into my Centos 7 terminal on Windows 10. I would like to be able to open and edit the Linux files using sublime text rather than having to edit right in the terminal. Any thoughts on how to do this?
Get a copy of the Windows apps -- "WinSCP" (for SFTP and use as a remote filemanager, etc. and includes putty), and "Notepad Plus Plus" (Notepad++) ... easy way to edit files on remote server. All are free downloads.
I personally like nano, its really easy to use
nano /path/to/file.c
ctrl + x to exit, ctrl+o to output the file with a y/n save prompt
If you want to use sublime, do the following
$> wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
$> echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
$> sudo apt-get update
$> sudo apt-get install sublime-text
Then this line will show you the sublime help options
$> subl -h
Assuming this:
$> subl /path/to/file.txt

Windows Linux Bash bad variable name when running /bin/sh -c "$(curl -fsS https://install.airshipcms.io)"

everything was working until I changed my mobo/cpu and I'm not sure what the error message means.
After running the install command
/bin/sh -c "$(curl -fsS https://install.airshipcms.io)"
my windows ubuntu bash shell returns
Starting Airship Launcher installation for ubuntu Linux64
Will install version 2.1.1
Downloading https://install.airshipcms.io/Linux64/airship-2.1.1.tar.bz2
To /tmp/AirshipLauncher.65/airship-2.1.1.tar.bz2
Added ~/.airship-bin to $PATH in ~/.profile
/bin/sh: 504: export: (x86)/Intel/iCLS: bad variable name
My guess was that because I already had it installed pre-upgrade of the mobo/cpu the variable name is already taken in the ~/.profile ? I'm not sure how to edit it, when I ran cat ~/.profile it rendered a bunch of unreadable characters.
thank you.
edit: I've tried reinstalling my linux shell, to no avail.
Okay so the fix is to replace sh with bash so the working command was
/bin/bash -c "$(curl -fsS https://install.airshipcms.io)"
credit goes to this guy https://github.com/probonopd/PowerShell/commit/2441d99a7405b488dc9289789edb636dc2cdcdfc

Node command not working in git bash terminal on windows

I'm trying to run the node command in my git bash terminal. When I run the node command, nothing happens when I press enter. The $ goes away and it just leaves a blinking cursor on the next line without the >.
My-PC MINGW32 /
$ node -v
v4.5.0
My-PC MINGW32 /
$ where node
C:\Program Files\nodejs\node.exe
My-PC MINGW32 /
$ node
_
Could someone tell me what the issue could be?
Thanks!!
If you're not getting a new line with a > after entering "node" - this is probably because newer versions of Git Bash don't run in the TTY mode they used to. Discussion here. You can verify by entering:
node -p -e "Boolean(process.stdout.isTTY)"
If that returns false - then the Node REPL (and some other console tools) won't work correctly.
There are a couple workarounds:
Workaround A
winpty node
Or you can add an alias in your .bash_profile:
alias node="winpty node"
# and for npm CLI/scripts:
alias npm="winpty npm.cmd"
Workaround B
Create a new shortcut to Git Bash with the following Target:
"C:\Program Files\Git\git-cmd.exe" --no-cd --command=usr/bin/bash.exe -l -i
and use that instead of the default Git Bash.

How to change the command used to install node dependencies on Azure?

Is there any way to change command used to build a Node.js project after deploying code to Azure?
I can't use
node install
to install (download dependencies of) my project, because of some issue [described here] (too long paths of some modules).
I wanted to use dedupe command or some bash script that I found here:
npm ls | grep "^│ .* [^ ]#[^ ]$" | rev | cut -d " " -f1 | rev | sort -u -t "#" -k1,1 |xargs -L 1 npm install --no-registry --loglevel error
to solve this problem, but I don't know how to run those commands on Azure. Is it possible?
You can try running the command from the diagnostic console via KUDU services.
To access KUDU simply add ".scm" before .azurewebsites.net.
For example, if your website is mywebsite.azurewebsites.net, you would browse to mywebsite.scm.azurewebsites.net
Once there click on Debug Console and then CMD
More information can be found here:
http://blogs.msdn.com/b/benjaminperkins/archive/2014/03/24/using-kudu-with-windows-azure-web-sites.aspx

Windows equivalent of this gitk Linux command

From this SO: How to recover a dropped stash in Git?
I would like to convert this Linux command to the Windows equivalent or maybe this is command is syntacially correct for Windows, not sure about the $ and the | :
gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
I have tried running this cmd on my Windows Git Shell, Powershell and Cmd.exe, with my cd being a git directory, with Cmd.exe:
On Git Shell:
Which gives me the following error:
I have installed gawk: http://gnuwin32.sourceforge.net/packages/gawk.htm
And added C:\Program Files (x86)\GnuWin32\bin to my Path Environment Variables
Here is the Windows PowerShell equivalent:
gitk --all $(git fsck --no-reflog | Select-String "(dangling commit )(.*)" | %{ $_.Line.Split(' ')[2] })
Ok so I had to install gawk/awk: http://gnuwin32.sourceforge.net/packages/gawk.htm
Then I updated my Path Environment Variable: C:\Program Files (x86)\GnuWin32\bin\
Then I had to restart my computer to refresh Environment Variables.
Then I could run the gitk cmd, without any changes, works fine on a Windows machine:
gitk --all $( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )
But it has to be in Windows Git Shell, the cmd did not work from Windows cmd.exe.

Resources