how to access different directories outside cygwin home dir

29

14

I have installed dropbox in my computer, but it is located outside my cygwin directory. The probably easiest way would be to just move the dropbox directory to cygwin's home dir. Anyway I wonder if it is possible to browse to my dropbox directory from cygwin instead?

starcorn

Posted 2011-01-06T16:12:26.577

Reputation: 2 136

Answers

44

You can access the root of your C: drive, for example, from cygwin by specifying the directory /cygdrive/c, e.g.,

$ cd /cygdrive/c

Similarly, the path to any file on your C: drive can be constructed by prefixing the Windows path (without the "C:" and with \s changed to /s) with /cygdrive/c, so C:\Dropbox\myfile would be accessed from within Cygwin as /cygdrive/c/Dropbox/myfile.

garyjohn

Posted 2011-01-06T16:12:26.577

Reputation: 29 085

i remember that you can make shortcuts in terminal much similar to alias. Is it possible to make shortcut to my dropbox location instead for having to type /cygdrive/c/Document/.../Dropbox ? – starcorn – 2011-01-07T09:21:18.097

nvm I found out how to do it, ln is the answer – starcorn – 2011-01-07T09:28:12.900

6

If you really wanted it available in Cygwin, besides getting it directly (as @garyjohn's correct answer) you can also try to use the mount command to map the path to your home dir. Something like this may work.

mount C:\dropbox\cygwin /home/me/dropbox

I say may, because though I'm pretty sure it will work, I have no Cygwin install to test it, and I'm not sure if Cygwin will refuse to create it because of filesystem loops (it should allow it)

Rich Homolka

Posted 2011-01-06T16:12:26.577

Reputation: 27 121

4

As @starcorn mentions above, ln works great for this.

$ ln -sv /cygdrive/c/Users/JohnWagg/Dropbox/ ~/dropbox
`/home/JohnWagg/dropbox' -> `/cygdrive/c/Users/JohnWagg/Dropbox/'

John G. Waggenspack

Posted 2011-01-06T16:12:26.577

Reputation: 41

1

cd "C:\users" works too. But, I think the method $ cd /cygdrive/c is much better and you can also put export C=/cygdrive/c in .bashrc file and use the command cd $C/ directly.

Pawan Kumar

Posted 2011-01-06T16:12:26.577

Reputation: 111

0

look for available drives by running: df -h
On Mounted On column you can see your already mounted drives. Go to them by using those path. Like in my case to go to F: drive, run cd /cygdrive/f.

Shams

Posted 2011-01-06T16:12:26.577

Reputation: 101

1mount is better - it will show existing mount points that are not shown by df -h – DavidPostill – 2015-10-25T11:07:11.127

-1

Drag and drop the file you wish to run and there's no need to change working directory.

The way I change directory is by going one folder at a time. e.g:
cd C:
cd Users
cd Name
cd Documents

Then type
pwd
And it will show the directory you have entered.
/cygdrive/c/users/name/documents

You can also directly copy and paste the directory and just add cd before you hit Enter.

As I am using cygwin simple to run a linux batch processing file, I just drag the file into the terminal and it finds the directory and runs when you hit Enter.

Wizzard

Posted 2011-01-06T16:12:26.577

Reputation: 1