Create an alias to C drive in Ubuntu Bash on Windows

Last updated: August 2, 2017

If you’re using the fantastic Ubuntu Bash terminal in Windows 10 which gives you a proper Ubuntu Linux terminal window and subsystem, you’re probably wanting to access files on your main drive.

To get to your C drive which has your files, you can just type:

cd /mnt/c

I don’t know about you, but typing that is painful. By creating an alias in your .bashrc file which is a configuration file for the Ubuntu terminal instance, you can create a shortcut to the C drive (and other mounted drives as well).

Go into your home directory by typing:

cd ~

Then open up your .bashrc file in the Nano text editor by typing:

nano .bashrc

Go all of the way to the bottom and add in an alias. I called mine cdrive but you can call yours whatever you want:

alias cdrive='cd /mnt/c'

Then press ctrl+x to exit the text editor. You’ll be asked if you want to save your changes, type Y and hit enter. Lastly, we need to tell the current terminal window about our changes by typing:

source ~/.bashrc

Now test your alias by typing cdrive (or whatever you called it). You should be taken to your main drive. That’s it.




5 thoughts on “Create an alias to C drive in Ubuntu Bash on Windows

Leave a Reply

Your email address will not be published. Required fields are marked *