The Home directory for Cygwin shell is probably not where you might think it should be. It is actually located within the Cygwin install directory (i.e.
C:\Program Files\cygwin\home\User
):
cd ~
pwd
/home/User
Since this isn't technically your Windows user's home directory, it will be empty, aside from config files that are used to emulate the Unix environment. As an example, you would navigate to
C:\Users\User\My Documents
like below (note how spaces need to be escaped by using backslashes):cd /cygdrive/c/Users/User/My\ Documents/
Packages and programs are also not installed via command line. Instead, as explained in an earlier post, you would need to re-run the Cygwin
setup.exe
, which doesn't actually reinstall Cygwin from scratch, but just rebuilds it from existing packages, as well as any new ones you add during this subsequent install.Aliases are a neat way to improve your workflow, and setting some up in Cygwin is really no different than Unix. Let's add some aliases (all config files are in the Cygwin home directory):
vi ~/.bashrc
I usually uncomment the
ll
, ls
, la
aliases, and add a few, like this function to use Notepad++ as a GUI text editor instead of using Vim in the terminal. Vim isn't great in Cygwin (feels more buggy than its Unix counterparts), so a solid GUI alternative before resorting to vanilla Notepad, is the nicer Notepad++. Anyways, you can also set up simple navigational aliases if symbolic links aren't your thing:alias pro='cd /cygdrive/d/Projects'
You can also turn off the annoying bell beep sound the shell makes when you enter something incorrect, or try to autocomplete something that doesn't exist. In your
~/.inputrc
file, uncomment or add:set bell-style none
Reload the shell, no need to close and reopen to pull in the changes:
// These two commands are identical:
source ~/.bashrc
. ~/.bashrc
And now you can enjoy your newly added shortcuts!
No comments :
Post a Comment