Is there a way to enable auto-complete for files in user PATH under Windows cmd? - linux

The tab-autocomplete feature in Windows is mostly like what is under Linux, but as far as I tried, it will not search my user PATH, so the files can be auto-completed has to be in the current directory.
Is there a way to enable Windows cmd to search not just the current directory but all user or system PATH?
Thanks!

Related

How do I open GitKraken after installation on Windows 10?

It seems that this is a real issue. In How to Install GitKraken, they point to a %APPDATA%/.gitkraken folder. Once there, you have "profiles" and "service" folders and "config", "log" and "secFile" files. Inside those folders, there are no signs of an executable. It's not under Program Files, nor in the PATH environment variable, it's nowhere to be found. If you install it again, it opens normally and logged in your profile, but after closing it, there's no way to open it again. There are no shortcuts.
What am I missing?
By default GitKraken is installed to your local app data folder. You can find the executable file inside %LOCALAPPDATA%\gitkraken\app-<app-version>
As of this writing, the latest version is 2.0.1 so the exe will be %LOCALAPPDATA%\gitkraken\app-2.0.1\gitkraken.exe
And easier way to open the software would be using the shortcut in the start menu:

I am unable to find the etc/passwd file in cygwin

I recently installed cygwin, and have been unable to find my passwd/etc file in order set to HOME. Is there any way to force cygwin to generate the file?
The /etc/passwd and group files are no longer generated by default, starting with Cygwin 1.7.34.
You can still generate them. Cygwin will use these files preferentially if present, by default, but only to cater to existing installs and special situations.
When these files are not present, Cygwin now uses the native Windows user management mechanisms: Active Directory where present, or SAM where not.
It is therefore recommended that you use this new mechanism to change your home directory. The easiest way I know of to do this is to add a line like this to your /etc/nsswitch.conf file:
db_home: /%H
That will change your Cygwin home directory to be equal to your Windows user profile directory. There are many other legal % tokens you can use here to achieve different results. See the previous link for details.
In my case, I set db_home: /%H in /etc/nsswitch.conf file, and change permission of my .ssh dirctory to "full control".

Setting Working Directory to Desktop in Cygwin

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.

.bashrc in Cygwin 1.7

I'm running Cygwin 1.7.17 on Windows Server 2012. My user account is "Administrator". Where should I put a .bashrc file for the Cygwin bash to pick it up?
I've tried the "c:\users\Administrator" folder, which seems to be the HOME in Cygwin 1.7. Tryed c:\cygwin\home\Administrator also.
Start a shell instance and run the command echo $HOME to see what your home path is set to. That's where all your user config files will be read from. It might not be one of the paths you tried.
Once you know where it is, just copy the template .bash_profile and .bashrc files from the /etc/skel folder to get you started.
If you don't like the path that's currently being used as your home, you can change it by editing /etc/passwd. Here's more info on that... Safely change home directory

Accessing a cygwin symlink from windows

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.

Resources