8

I'm starting to learn how to use the terminal with Ubuntu on WSL (Windows).

Just from the very beginning of the course it says that if you use the ls command it should show you your "home" directories, but mine is something like this:

(base) paloma@DESKTOP-ISCC0ON:~$ ls
Anaconda3-2021.11-Linux-x86_64.sh  anaconda3

(base) paloma@DESKTOP-ISCC0ON:~$

And if I try to change directory something like this happens:

(base) paloma@DESKTOP-ISCC0ON:~$ ls
Anaconda3-2021.11-Linux-x86_64.sh  anaconda3

(base) paloma@DESKTOP-ISCC0ON:~$ cd Documents -bash: cd: Documents: No such file or directory

(base) paloma@DESKTOP-ISCC0ON:~$

Can somebody tell me why is this happening and what can I do, please? I'm a complete newbie.

NotTheDr01ds
  • 17,888
Paloma
  • 81

3 Answers3

8

Everything in @Tooster's answer is corrected, but let me address your main question a bit more directly:

(base) paloma@DESKTOP-ISCC0ON:~$ cd Documents
-bash: cd: Documents: No such file or directory

Can somebody tell me why is this happening and what can I do, please?

You appear to be wondering why this isn't taking you to the Documents folder in your Windows home directory.

It's important to understand that the home directory in Ubuntu/WSL is not the same as your Windows home directory, nor should it be. Your Ubuntu home directory is in a virtual SSD provided by WSL. This virtual SSD provides the Linux compatible filesystem that Ubuntu needs, whereas your Windows drive is formatted as NTFS and won't have 100% compatibility.

WSL does provide a way to get to the Windows files (including your home directory), as mentioned by @Tooster.

From inside Ubuntu:

cd /mnt/c/Users/<your_Windows_username>
ls

That should show you all the files and directories in your Windows profile (a.k.a. home) folder.

Also perhaps reading as additional background -- My answer to Where is WSL located on my computer?.

NotTheDr01ds
  • 17,888
2

First of all try to format code and output from terminals using the fenced code block format.

And now to the meritum.

  • current working directory is the directory you are in. Your home directory (often denoted with ~) is usually located in the /home/<username>/
  • ls - command listing files in the current directory
  • ls [arguments...] - this command lists the files inside directories provided as arguments
  • cd [argument] - change directory command. using it without argument takes you to your home directory
  • / is root directory in linux and an absolute paths start with it
  • . is a current directory and if path starts with ./something or without it something, then current directory is assumed (path is relative to current location)
  • .. is parent directory.

Based on the (base) in thee prompt and on the names of the files above, I'm gonna say that you are using conda environment on your WSL (Windows subsystem for linux). Why are you using it is not my business, but you seem to have skipped a few steps when learning linux and WSL first. Try starting with https://linuxjourney.com/ (especially command line section and filesystem section). Then learn about differences in linux and windows structure.


@EDIT because I only noticed you are using Linux on Windows

Because linux' and windows' filesystems are a bit different, when you start linux on windows a virtual filesystem is created for you. To access your windows files from linux you would have to access /mnt/<drive>/<...windows files> (note the / at the beginning - that's an absolute path)

Linux is structured as a single tree rooted at / and external filesystems are usually mounted at /mnt (read hier(7) for more info). Windows' filesystem is composed of "drives" - single trees rooted at C:/, D:/ etc., so it's only natural for both of those systems to have different mechanism for accessing each other's files.

Read more at https://ling123labs.com/posts/WSL-files-in-Windows-and-vice-versa/

Tooster
  • 467
0

If you want to easily access your Windows "Documents" folder from WSL, you can create a symbolic link from your home directory:

ln -s '/mnt/c/Users/YourUserNameHere/Documents' ./WinDocuments

You can do that for Documents or you could just link your Windows home directory.

sfcfs
  • 1