I use phpstorm and it's terminal facility.
In terminal section I typed F:\Projects\cygwin64\bin\mintty.exe -i /Cygwin-Terminal.ico - so it uses Cygwin as terminal. But it opens it in home folder. Is it possible to open it in different folder? By typing a command or by doing something else.
Because I have a folder called F:\Projects\Local in this folder I have vagrant and I want to open phpstorm, open terminal within php storm and just type vagran up. I don't want to open cgywin again.
thanks
If you just want to open Cygwin with Mintty in the project directory then you can execute the command:
F:\Projects\cygwin64\bin\mintty.exe /bin/env CHERE_INVOKING=1 /bin/bash -l
This will avoid automatically changing to the home directory. See https://code.google.com/p/mintty/wiki/Tips#Starting_in_a_particular_directory for more information on this command.
If you want to use the embedded PhpStorm terminal, then you can modify the Shell path in the terminal settings. Open File > Settings... > Tools > Terminal. Replace the shell path with F:\Projects\cygwin64\bin\env.exe CHERE_INVOKING=1 /bin/bash -l. You may need to restart PhpStorm after this change.
Note: this is assuming that your Cygwin Root Directory is F:\Projects\cygwin64\.
For whome the above way ain't work anymore, like in PhpStorm v. 2016.3. The shell path have to be enclosed in quotes
"C:\Users\MyUser\.babun\cygwin\bin\env.exe" CHERE_INVOKING=1 /bin/zsh.exe
For the PhpStorm that I'am using (v10.0.4) in Windows 10 I use this command works:
D:\tools\.babun\cygwin\bin\env.exe CHERE_INVOKING=1 /bin/bash.exe
I'm using Babun which installs the Cygwin in D:\tools\.babun\cygwin.
Related
I add the bin of git bash into my path in windows7 for the purpose of using linux command in windows. Other commands like ls, mkdir work fine but when I run "pwd" windows can't execute it. I found there is no pwd.exe in the bin directory. So I want to ask where I could download this file or if there is any better way to fix it? Thanks.
in windows de equivalent command for pwd is path. Change pwd with path
A better way of using linux commands on windows is using Cygwin. It will not only allow you to run pwd and other linux commands but it will also make your windows command line as powerful as the linux terminal.
Check out the link below:
https://www.cygwin.com
For Command Prompt in windows which is equivalent of Terminal, you can use cd , instead of pwd... and dir instead of ls.
I'm trying to run code on Linux environment
Here's the code (saved as hello.pl):
#!/usr/bin/perl
use strict;
use warnings;
print "Hello You\n";
Here's what I tried on my linux environment:
%perl hello.pl
I tried listing out the path starting from C:\Users\... and so on
I keep getting error that says:
Can't open perl script "hello.pl": No such file or directory
You have to be located in the same folder with the hello.pl in the "window" (aka terminal, or console) that you try to execute perl hello.pl.
On linux, you can determine the folder that you're in by issuing pwd.
If you're not in the same folder (the most probable cause of your error), you have 2 options:
Navigate to that folder with cd /path/to/your/script/location you have to replace the /path/to/your/script/location in the example, with your actual path
Execute the file with perl /path/to/hello.pl - of course, you have to replace the /path/to/ in the example, with your ac
Also, you can try and view the file from the console running a less hello.pl
In cygwin you might try: /cygdrive/c/Users/bonan/Desktop/perl/hello.pl.
Alternatively at your prompt try tying in just perl without hitting enter, and then drag the hello.pl file from its file explorer location into the terminal window. That should paste the full file path to the file as text into the command prompt. If you're using cygwin I forget it if properly pastes the path with forward-slashes, like /cygdrive/c/Users/bonan/Desktop/perl/hello.pl, or if it pastes what it would in cmd with backslashes as you've indicated you typed yourself.
The other thing to do that's relatively easy is right click the file and choose to open a terminal or shell here, which for cygwin you can get in your context menu by running chere -i once (it actually says "Bash prompt here" I think). And there's similar context menu options for cmd, powershell, an actual linux bash, or mac os x's terminal ... once you're in the same path as the file, you can just type perl heltab and autocomplete the filename assuming no other files in the same folder start with "hel".
I don't know what happened.
But suddenly, when I open cygwin terminal, I now see :
PF#PF-PC /cygdrive/c/Windows/system32
$
Instead of something like
PF#PF-PC /cygdrive/bin/
$
And now all my commands are not working (like 'ls', 'grep', ...).
What could have happened ? System variables?
Thanks for any help!
EDIT : If I open cygwin by using "bash prompt here" from a windows directory, then all my cygwin works fine.
What's wrong with the normal cygwin ?
EDIT 2 :
See my new comment. The dash (-) at the end of the shortcut is important.
you surely don't have /usr/bin in your path anymore. Please do echo $PATH to see the content of path.
If you do not find /usr/bin go in your .bashrc and add export PATH=/usr/bin:$PATH.
PS : Cygwin always go at first in /cygdrive/c/Windows/system32, you can see it normally by doing cd - after the start of Cygwin to see the last path used.
whenever I run eclipse from the shortcut I am unable to correctly build some of my projects because the PATH variable that I configured in .bashrc doesn't get used.
When I run eclipse from my terminal, I can build all my projects perfectly fine because it's running through the correct shell.
The problem is that I want to use the PATH variable from my .bashrc without permanently having a terminal open. I tried this before, but every day I accidentally close the terminal that's running eclipse by accident and lose all my unsaved code.
Can anyone help me?
Your tooling probably utilizes the embedded eclipse terminal. This terminal does not start providing your login/user shell. So you need to set the eclipse terminal in your Eclipse preferences to start as --login shell:
Go to:
Preferences -> Terminal -> Local Terminal
and set
"Arguments" to "--login"
restart Eclipse and your users $PATH should be used from now on.
Edit /usr/share/applications/eclipse.desktop with write privileges, i.e. sudo gedit /usr/share/applications/eclipse.desktop
Change the setting Exec=/usr/bin/eclipse to Exec=bash -ic "/usr/bin/eclipse" and save
The underlying issue is that .bashrc is not loaded in a non-interactive shell. When you start Eclipse normally clicking on its symbol, .bashrc quits early. This solution applies to all programs that are defined by a .desktop file.
In contrast, bash -i opens an interactive shell, -c "" runs a command in that shell.
I can think of two options for this problem:
write a small script, export those vars or source your .bashrc before you start your eclipse.
define those variables in /etc/environment. then they are not user-scope any more.
I prefer the 1st option.
Create simple script
#!/bin/bash
source /home/user/.environment_variables
/home/user/eclipse_cpp/eclipse -Duser.name="My Name"
2.
Next put your all system variables in file /home/user/.environment_variables (any file you want)
My looks like:
export COCOS_ROOT=/home/user/Projects/edukoala
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/
3.
Now you can delete your variables in .bashrc and put line
source /home/user/.environment_variables
Everything works fine :)
Well, this is already answered and the answer has been accepted. But this will also work for running your code using Eclipse. You can edit the Run Configurations and set the environment variable there. Then, Eclipse will pick up the variable from this setting while building.
I just installed cygwin and zsh from the cygwin installer.
I launch C:\cygwin\bin\zsh.exe from the file explorer.
When zsh is launch for the first time, a small configutation is prompted.
I choose the minimal config by choosing : "Exit, creating the file ~/.zshrc containing just a comment. That will prevent this function being run again."
Now trying to use zsh, but I always have the "command not found" error
$ ls
zsh: command not found: ls
I don't understand why zsh can't do anything directly after the first launch.
How configure zsh to use all the cygwin bin commands located in the same folder C:\cygwin\bin ?
You need to invoke zsh as a login shell, by passing the --login or -l option. This tells it to source /etc/zprofile, which is where the search PATH is configured. You can do that by creating an Explorer shortcut to zsh.exe and adding the option to the target field.