• 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
4 years ago

Thanks mate, clear instructions to get me going!

0
Russell
Russell
4 years ago

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

0
Michael K Pate
Michael K Pate
4 years ago

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

0
Ryan
Ryan
4 years ago

Thanks Buddy!

0
Russ Painter
Russ Painter
4 years ago

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

0
Shada
Shada
2 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
8 months 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 🙂

0

Primary Sidebar

Popular

  • Testing Event Listeners In Jest (Without Using A Library)
  • How To Get The Hash of A File In Node.js
  • How To Mock uuid In Jest
  • How to Copy Files Using the Copy Webpack Plugin (without copying the entire folder structure)
  • Which Neural DSP Archetype Plugins Should You Buy?
  • Removing A Character From The Start/End of a String In Javascript
  • Smoke Detector Randomly Goes Off Early Hours of The Morning
  • How To Install Eufy Security Cameras Without Drilling or Using Screws
  • How to Use Neural DSP Archetype Plugins With the Quad Cortex
  • NBN Box Installed Inside of Garage, Where Do You Put The Modem?

Recent Comments

  • Thebe on How to Remove the My Sites Menu From the WordPress Admin Bar
  • Maccas worker jn the 2000s on Dear McDonald’s: bring back the Warm Cookie Sundae, you cowards
  • Anamika Singh on Testing Event Listeners In Jest (Without Using A Library)
  • Stefan on A List of WordPress Gutenberg Core Blocks
  • pandammonium on A List of WordPress Gutenberg Core Blocks

Copyright © 2022 · Dwayne Charrington · Log in

wpDiscuz