Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WSL hide /mnt/c/Users/

It is possible to view shorter path in my terminal (VS Code & Hyper) with WSL (Ubuntu). On top of the Ubuntu, I have installed zsh. Currently, I am using a git bash and path looks Lukas@Y50-70 ~/Coding but with the Ubuntu, I have something like this lukas@Y50-70 /mnt/c/Users/Lukas/Coding. When I have a project in another 2 folders or so and I have a long branch name it is annoying to have a full row unnecessary info (for me). Here is a comparison of Ubuntu and git bash: comparison of Ubuntu and git bash Thanks

like image 494
Lukas Avatar asked Apr 29 '18 07:04

Lukas


People also ask

How do I fix error 0x80370102?

"Error: 0x80370102 The virtual machine could not be started because a required feature is not installed." Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS. Please follow guidelines from your PC's manufacturer on how to enable virtualization.

Does WSL2 require admin rights?

Administrator privileges in Windows are required to run OpenSSH in WSL. To run an OpenSSH server, run your WSL distribution (ie Ubuntu) or Windows Terminal as an administrator.

Does WSL have access to hardware?

You can track the updates of WSL by following the WSL blog. You can also check this community maintained list of programs that work (and those that don't) under the WSL. Not all hardware resources are available in WSL. For instance, you cannot access GPUs in WSL.


1 Answers

I was able to solve this using Named Directories - by adding this line to your ~/.zshrc file

hash -d c=/mnt/c

you will see '~c/' in your prompt rather than '/mnt/c/' which I think is a lot nicer.

This has a similar effect to setting an alias for the directory but the name is reflected in how your path is displayed.

As an added bonus you can then switch to that directory at any time by typing ~c

like image 184
LeaveTheCapital Avatar answered Sep 28 '22 05:09

LeaveTheCapital