The current directory on cygwin is home/myuser. I navigated to cygwin and found it has a directory called home/myuser and could not figure out how I would navigate to the desktop. I did not want to add a desktop directory there and I could not navigate above the root folder (cygwin). Any idea on how I could do this?
This is essentially covered in the Cygwin FAQ under "How can I access other drives?". No, you're not trying to access another drive, but you are trying to access a folder outside of the Cygwin tree. As the FAQ item says, Cygwin maps your Windows drives as /cygdrive/<drive-letter>, so your desktop is likely something like /cygdrive/c/Users/<username>/Desktop. Note that the path has changed over the years with various versions of Windows and you didn't specify what version you're running, so it may not be exactly that.
Anyway, what I would do, would be to create a symbolic link to that from my Cygwin home folder. Something like this:
ln -s "/cygdrive/c/Users/<username>/Desktop" Desktop
I put the quotes in because depending on what version of windows you have, this path may include spaces.
You'll probably notice from the FAQ that the Cygwin version of bash accepts DOS-style pathnames, so you can actually do the following:
cd "C:/Users/<username>/Desktop"
But I recommend avoiding such syntax. Not all Cygwin apps understand DOS-style paths, and you'll only end up confusing yourself if you have to try to figure out whether what you're doing will work with a DOS-style path or not. It's best to just use the Unix-style paths for everything when in the Cygwin environment, unless you have a very good reason not to.
Add
cd "/cygdrive/c/Users/<username>/Desktop"
to .bashrc file located in <cygwin install directory>/home/<username>. This will change working directory to desktop every time you open Cygwin terminal.
Related
Problem: I'm writing some code that is portable to Linux and Cygwin (compiled on msys), and the handling of symlinks is different. On Cygwin, if I create a symlink in the normal way, with a default Cygwin shell (ie. the CYGWIN envvar not set):
$ ln -s foo bar
then fopen(bar) doesn't follow the symlink. The first line of text appears to be !<symlink>. and my code reports that the opened file isn't UTF-8.
I can fix this by running Cygwin as admin, setting CYGWIN to winsymlinks:nativestrict, deleting the symlink, and re-creating it. However, this isn't ideal: in my case, the symlinks are created by Subversion from the Linux codebase, so I now need to script the link delete and remake after every update.
Is there a better way to do this, or do I have to ask Cygwin users
to run as admin, and set CYGWIN?
How do I write code to follow a native Cygwin symlink?
How do I write code to find out what type of symlink I'm dealing
with? This is also asked here, but the answer there is scripted
Thanks.
Edit
Ok, I think the answer is basically here, on the MinGW mailing list, from 2007. If you compile with MinGW you can't use Cygwin native symlinks. Maybe the situation has changed since 2007?
I am running a Windows Powershell provided through the git for windows installation. This shell provides many unix style commands (i.e. "ls", "mv", etc.).
My question is: How do I access Unix style paths from the powershell cmd line on Windows?
Consider this example: the "ls" program is installed and works in the powershell. The path is shown as "/usr/bin/ls" if I type "which ls" as the cmd prompt. But if I try to change my current directory using "cd /usr/bin/", the shell complains that the path is not found.
I can't see any mounted volumes or anything like that using "mount" (perhaps in PowerShell it is a different command?).
I'm asking this question because I have other files that I need to get to which are listed under unix-style paths, and right now I can't get to anything. I figure if I can get to /usr/bin, then I can figure out how to get where I really need to go.
Powershell is not Unix. It may have a few familiar commands like "ls" and "ps", but that's where the similarity ends.
When you installed Git For Windows, you likely installed the Git Bash shell as well. Run that instead to get a more Unix like atmosphere. (Re-install Git For Windows if you didn't select this option on install).
But even with Git Bash, there's still no such folder as /usr/bin. That folder doesn't exist on Windows. If you want a Unix emulation on Windows that includes the traditional folder structure, use Cygwin. And you can run Git on that environment too and access an emulated /usr/bin folder.
I have recently installed a webframework play (http://www.playframework.com/) and want to have the play executable in the system path ie $PATH. But ubuntu already defines a command called play. How do I overwrite the system defined command with my framework binary path so that command play on commandline calls my framework rather than the old application.
Installation: I downloaded zipped file of the framework and upzipped in one of my personal folder which contains the docs and the executable.
Never alter the contents of installed packages. Such changes can provoke hard to find problems in the system and anyway, they will most likely be overwritten again in subsequent updates. There are other alternatives:
obviously you can chose another name for your executable
place the executable in another part of your $PATH if its a "personal installation", typically ~/bin is used for such approach. Remember that the order of entries in the $PATH variable is important, first come first serve.
use the traditional /usr/local/bin location for locally added "wild" installations, this way there is some form of clean separation between clean packages and wild installed files inside the system
store your software in some other location and prepend that to your personal or system wide $PATH variable
store your executable under another name and create an alias (see man alias for an explanation) for it which allows to call it by some name that "hides" the original command this way. For this the executable can be addressed with an absolute path, so it dies not have to be found inside the $PATH variable.
In my personal opinion options 2. and 5. and the best if it comes to "personal installations".
If you are sure you'll never use the original play command, you could just remove the binary. But in general, this isn't a good idea, since some system component you don't think of might need it, and the next update will probably restore it.
The best thing to do is to prepend the directory of your play command to the PATH, for example, using PATH=/opt/framework/bin:$PATH in your .profile (assuming your play command installs to /opt/framework/bin/play), or the script that starts your web server, or wherever you need your play command.
Remember that does not make your play command global. A common mistake is to add the path in their .profile file, then call the program from crontab - crontab scripts will not execute .profile or .bashrc.
I've just been setting up a Ubuntu workstation and wanted to add some settings to eclipse.ini. When I searched for the file I found:
/etc/eclipse.ini
/usr/lib/eclipse.ini
My questions are:
Does Eclipse actually use both files?
If so, in what order does it read them?
How does it merge them?
Both of the files I found are system wide, is there a location in my home directory I could put one that would effect only my instances?
Here's how to determine which eclipse.ini file you should use (joomla.org):
If you downloaded Eclipse IDE manually from internet the "eclipse.ini" file is just inside the unpacked folder
If you installed Eclipse via terminal or software center the location of the file is "/etc/eclipse.ini"
In some Linux versions the file can be found at "/usr/share/eclipse/eclipse.ini". Do not use this file if you found a config file at "/etc/eclipse.ini".
To be sure where your Eclipse folder is, check $ECLIPSE_HOME, and if not specified (these directions at least work for Juno):
Open Eclipse as you normally do.
Click Help -> About Eclipse SDK
Click Installation Details
Go to the Configuration tab
Find "eclipse.home.location=file:PATH". PATH is where eclipse is installed.
sources:
http://docs.joomla.org/Configuring_Eclipse_IDE_for_PHP_development/Linux:
There is only one file.
lrwxrwxrwx 1 root root 16 Aug 8 2012 /usr/lib/eclipse/eclipse.ini -> /etc/eclipse.ini
You probably have already found this out, chances are when you installed Eclipse the installation created (or you did manually) a file /usr/bin/eclipse which if you check it probably looks like the following:
#!/bin/sh
export ECLIPSE_HOME="/opt/eclipse"
$ECLIPSE_HOME/eclipse $*
especially if you followed instructions similar to the ones like these on If-not-true-then-false
On the other hand if you have installed from a package, I suspect you will find that eclipse ends up in /usr/bin, most likely a symbolic link to /usr/lib/eclipse/eclipse (or at least I found it on my Fedora system after using yum to install eclipse).
I have Ubuntu 18 and eclipse installation is squashed in a file
/var/lib/snapd/snaps/eclipse_40.snap
which is mount on /snap/eclipse/40 as read only. Just run
mount | grep eclipse*.snap
This eclipse.ini file is really read only, that means, you cannot modify it, even with sudo. However, I also have a eclipse.ini.ignored file in HOME/.eclipse/some number/configuration. This is being by default ignored, but you can change the "launcher.ini" in the eclipse launcher command.
According to https://wiki.eclipse.org/Eclipse.ini
Eclipse startup is controlled by the options in
$ECLIPSE_HOME/eclipse.ini. If $ECLIPSE_HOME is not defined, the
default eclipse.ini in your Eclipse installation directory (or in the
case of Mac, the Eclipse.app/Contents/MacOS directory) is used.
The certain way to make sure is to run strace on eclipse. In the output you'll see where is eclipse actually trying to pull the file from.
I am quite new to cygwin. I created a symlink as follows
$ ln -s /var/www /cygdrive/d/foo
and when I check the D drive via windows, I see a system file called foo. Is there a way to make foo act as a folder for Windows instead of a system file?
Windows won't be able to read Cygwin-created symlinks, but you can create Windows symlinks using Windows commands, and Cygwin will treat those as symlinks.
On Vista and 7, this can be done with 'mklink'. This is a cmd.exe builtin rather than a standalone utility, so if you want to invoke it from a bash shell you have to do 'cmd /c mklink', and of course it will only understand Windows paths.
For XP, the 'Windows Resource Kit Tools' contain a utility called linkd that can be used to create directory links.
Not that I know of. Cygwin doesn't update the OS to have symlinks, rather, it allows you to 'fake' symlinks from within the Cygwin shell. You can set up the shell to use Windows LNK files, which may do what you want, but ...
From the Cygwin Documentation:
Creating shortcuts with cygutils
Another problem area is between
Unix-style links, which link one file
to another, and Microsoft .lnk files,
which provide a shortcut to a file.
They seem similar at first glance but,
in reality, are fairly different. By
default, Cygwin does not create
symlinks as .lnk files, but there's an
option to do that, see the section
called “The CYGWIN environment
variable”. These symlink .lnk files
are compatible with Windows-created
.lnk files, but they are still
different. They do not include much of
the information that is available in a
standard Microsoft shortcut, such as
the working directory, an icon, etc.
The cygutils package includes a
mkshortcut utility for creating
standard native Microsoft .lnk files.
But here's the problem. If Cygwin
handled these native shortcuts like
any other symlink, you could not
archive Microsoft .lnk files into tar
archives and keep all the information
in them. After unpacking, these
shortcuts would have lost all the
extra information and would be no
different than standard Cygwin
symlinks. Therefore these two types of
links are treated differently.
Unfortunately, this means that the
usual Unix way of creating and using
symlinks does not work with native
Windows shortcuts.
One alternative way to call mklink (/d creates directory link) without function:
link_name="/cygdrive/c/TestLink"
target_dir="/cygwin/c/Windows"
cmd /c mklink /d "`cygpath -w \"$link_name\"`" "`cygpath -w \"$target_dir\"`"
This example uses backticks (`command`) for command substitution.