134

This will be the toughest question of the day. How do I navigate through my Windows folder structure within the MSYS shell? When I start the shell, all I see is a '~'. I type 'ls' and the folder is empty. I just want to know how to get to my c drive.

rubenvb
  • 74,642
  • 33
  • 187
  • 332
AndroidDev
  • 20,466
  • 42
  • 148
  • 239
  • Just a small note: the `~` indicates that you are in the current user's (i.e. your) home directory. – eriktous Jul 07 '12 at 20:45

3 Answers3

211

cd /c/ to access C:

cd /d/ for D:

etc.

Lernkurve
  • 20,203
  • 28
  • 86
  • 118
GL770
  • 2,910
  • 1
  • 14
  • 9
22

Your C: drive is mounted on /c automatically by MinGW, just type cd /c to get in.

strnk
  • 2,013
  • 18
  • 21
21

use df to see all mount point so you can navigate to them. my df output shows below:

    Filesystem           1K-blocks      Used Available Use% Mounted on
C:\Users\Sam\AppData\Local\Temp
                      76694276  46239412  30454864  61% /tmp
C:\MinGW\msys\1.0     76694276  46239412  30454864  61% /usr
C:\MinGW\msys\1.0     76694276  46239412  30454864  61% /
C:\MinGW\build32      76694276  46239412  30454864  61% /build32
C:\MinGW\build64      76694276  46239412  30454864  61% /build64
C:\MinGW\local32      76694276  46239412  30454864  61% /local32
C:\MinGW\local64      76694276  46239412  30454864  61% /local64
C:\MinGW\mingw32      76694276  46239412  30454864  61% /mingw32
C:\MinGW\mingw64      76694276  46239412  30454864  61% /mingw64
C:\MinGW\opt          76694276  46239412  30454864  61% /opt
C:\MinGW\src          76694276  46239412  30454864  61% /src
c:                    76694276  46239412  30454864  61% /c
d:                    62471380  33791832  28679548  55% /d
e:                   163839996 129349800  34490196  79% /e
f:                   266237948 222816904  43421044  84% /f
g:                   407410152 346169248  61240904  85% /g
h:                    65328288  22612768  42715520  35% /h
i:                   122881152  54066728  68814424  44% /i
j:                   409601240 176372780 233228460  44% /j
k:                   378949628  56153980 322795648  15% /k
babyromeo
  • 465
  • 5
  • 12
  • 6
    In my case (MSYS2) `df` shows `C:\msys64 <--> /` and `E: <--> /e` but doesn't show `C: <--> /c` Despite this, I can still navigate to that folder via `cd /c` – MatrixManAtYrService Mar 16 '17 at 16:14
  • Yeah, I don't see all my drive mounts either. This should be filed as a bug. – Adrian Nov 20 '17 at 20:22
  • I can only get `C:/msys64 <--> /` when executing `df` . If I add the `-a` or `--all` parameter, then two mount points `C:/msys64/usr/bin <--> /bin` and `C: <--> /c` will appear. I'm using "msys2-runtime 3.2.0-3". – li ki May 30 '21 at 03:57