• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

I Like Kill Nerds

The blog of Australian Front End / Aurelia Javascript Developer & brewing aficionado Dwayne Charrington // Aurelia.io Core Team member.

  • Home
  • Aurelia 2
  • Aurelia 1
  • About
  • Aurelia 2 Consulting/Freelance Work

Create an alias to C drive in Ubuntu Bash on Windows

Tips & Tricks · 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.

Dwayne

Leave a Reply Cancel reply

8 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Simon Woodard
Simon Woodard
5 years ago

Thanks mate, clear instructions to get me going!

0
Russell
Russell
5 years ago

Awesome thank you, I knew there had to be a better way.

0
Michael K Pate
Michael K Pate
5 years ago

Exactly what I was looking for. Most of my UNIX command line experience dates back 30 years.

0
Ryan
Ryan
5 years ago

Thanks Buddy!

0
Russ Painter
Russ Painter
5 years ago

Really handy. Thanks. Got my “c” “d” and “e” aliases saving me lots of keystrokes.

0
Shada
Shada
3 years ago

Thank you so much for this! So helpful and clear.

0
ben721
ben721
1 year ago

I had some issues getting it to correctly point to wsl, had to pass in ‘~’ as an argument instead of ‘–login’ and it is working. Thanks!

0
Jacob
Jacob
1 year ago

It should be noted that .bash_aliases is preferred over editing .bashrc, especially because there is a segment included in .bashrc specifically to check for and source the .bash_aliases file should it exist. This makes it actually really convenient to keep all of your personal aliases in one place 🙂

1

Primary Sidebar

Popular

  • Thoughts on the Flipper Zero
  • I Joined Truth Social Using a VPN and Editing Some HTML to Bypass the Phone Verification
  • How To Install Eufy Security Cameras Without Drilling or Using Screws
  • How To Get The Hash of A File In Node.js
  • Wild Natural Deodorant Review
  • The Most Common iPhone Passcodes (and how to guess them)
  • How to Record With the Neural DSP Quad Cortex in Reaper (DI and USB Recording)
  • Neural DSP Reveal Details About the Long-Awaited Quad Cortex Desktop Editor
  • How To Paginate An Array In Javascript
  • NBN Box Installed Inside of Garage, Where Do You Put The Modem?

Recent Comments

  • CJ on Microsoft Modern Wireless Headset Review
  • Dwayne on Microsoft Modern Wireless Headset Review
  • CJ on Microsoft Modern Wireless Headset Review
  • john on Microsoft Modern Wireless Headset Review
  • Dwayne on Why You Should Be Using globalThis Instead of Window In Your Javascript Code

Copyright © 2023 · Dwayne Charrington · Log in

wpDiscuz