How to access my D:\ drive from the Ubuntu command line on Windows 10
Asked Answered
B

2

10

When I open the Ubuntu windows store app and the bash command line (if I am not wrong?) comes up it's working directory is /home/username . I want to run a script which on my Windows is located in D:\University... . Can I do this and if so how?

I have only tried cd D:\ but I get " -bash: cd: D:: No such file or directory". I don't have any experience so far with Linux so I don't know if Ubuntu on Windows can only run in its own location or it can access all the files on my PC.

Bollix answered 12/5, 2019 at 14:6 Comment(0)
L
18

you can use mnt to access your drives.

root@user-pc: cd /mnt/d/your_destination_directory;

Lactam answered 12/5, 2019 at 14:9 Comment(0)
M
0

You can access your Windows files from the Ubuntu WSL 2 terminal by navigating to the corresponding mount points. Windows drives are typically mounted under the /mnt directory in WSL. For example, your D: drive would be accessible at /mnt/d.

Here's how you can navigate to and run a script located in D:\University from your WSL 2 terminal:

  1. Open your WSL 2 terminal (Ubuntu).

  2. Navigate to the D: drive:

    cd /mnt/d

  3. Navigate to your script location:

    cd /mnt/d/University

  4. Run your script: Assuming your script is named script.sh and is executable, you can run it as follows:

    ./script.sh

If the script is not executable, you may need to run it with bash:

bash script.sh
Mature answered 16/7 at 9:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.