Change home directory (~) on Ubuntu? (Or home directory on windows)

I followed the steps here: https://www.dataquest.io/blog/tutorial-install-linux-on-windows-wsl/ to setup Ubuntu on my new windows computer. One of the steps is to edit .bashrc so opening a new ubuntu terminal will automatically cd to my windows home directory. Doing so does not change what my linux home directory is, however (the one I go to if I cd ~). That means I in some sense am going to have two home/home directories - one for my windows environment and one for my linux environment. I am a recent transfer for the Mac world, where I had one single home environment for everything, which I rather liked.

  • Is it possible to remap on of these home directories to the other one?
  • If so - is it a good idea?

Thanks

I’m confused about what you mean with “home directory”. To me, “home directory” is a user-dependent UNIX concept. If a user is named $USER, this user’s home directory is /home/$USER.

Running commands in .bashrc (including changing directories) is different from the above concept.

Regarding your actual questions, I don’t know what you mean with “remap”.

Thanks for replying Bruno. I am new to Windows (at least new to having a windows machine that isn’t locked down incredibly tightly by an employer)so my misunderstanding may be coming from that world. I’ll try to explain my perception of what’s going on.

  • My windows username is “juneb”
  • My WSL Ubuntu username is “rototiller”
  • In general, my Windows files are stored in /Users/juneb/ and subdirectories thereof. (e.g. videos of my kid are at /Users/juneb/Videos/home_movies. My computer Desktop is at /users/juneb/Desktop) This is from the point of view of Windows, of course.
  • As you note, my linux home directory is at /home/rototiller.
  • From within an Ubuntu launched shell, Issuing cd ~ takes me to /home/rototiller
  • From Powershell, issuing cd ~ takes me to /Users/juneb
  • If I am in Ubuntu and I want to get at the kid videos, I have to refer to the path as /mnt/c/Users/juneb/Videos/home_movies
  • If I am in Windows Explorer and I want to get at my Ubuntu home directory, I have to go to \\wsl$\Ubuntu\home\rototiller

So it seems like I have two different home directories, and I have to refer to them in four different ways depending on where I am trying to access them from. What I am wondering is whether there is a way to collapse these into one - I don’t know if the word would be remap, or combine or merge, but somehow have a single home filesystem for both windows and linux environments. The way there is a single “home” in MacOSX whether one is in the Mac GUI environment or tinkering in the POSIX subsystem.

I suspect what you want isn’t possible. If it were, Windows would have already absorbed nix-like command lines and many infrastructure engineers/system administrators wouldn’t have to worry about Windows and operating systems compatibilities.

2 Likes

You’re probably right. Maybe Windows 12…

1 Like
# Change directory to your home directory 
$ cd 

# Edit your .bashrc file
$ vim .bashrc

Or you can edit your .bashrc file via ~/.bashrc.

$ vim ~/.bashrc

WSL enables you to install any Linux Distribution. The WSL terminal and powershell are different systems.

If you want to stick to one system,

  • Install Ubuntu as a dual boot to your Window OS

  • Return back to MacOS

In either Ubuntu or MacOS, you can access the terminal and edit your ~/.bashrc.