# How to get Ubuntu Bash on Windows 10 | Work with files, folders and apps

**URL:** <https://onehack.st/t/how-to-get-ubuntu-bash-on-windows-10-work-with-files-folders-and-apps/65044>\
**Category:** Tutorials & Methods\
**Tags:** tips-tricks, operating-system\
**Created:** [January 5, 2020, 10:55am UTC](https://onehack.st/t/how-to-get-ubuntu-bash-on-windows-10-work-with-files-folders-and-apps/65044 "2020-01-05T10:55:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TheJoker](https://onehack.st/user_avatar/onehack.st/thejoker/32/22660_2.png) [@TheJoker](https://onehack.st/u/TheJoker)\
**Post date:** [January 5, 2020, 10:55am UTC](https://onehack.st/t/how-to-get-ubuntu-bash-on-windows-10-work-with-files-folders-and-apps/65044/1 "2020-01-05T10:55:22Z")

</div>

The addition of the Windows Subsystem for Linux in Windows 10 came as a surprise for many, us included. Although it is a tool intended to be used mainly by developers, regular users seem to be interested in this feature too. We thought it would make sense if we show you how to run commands in Bash on Ubuntu on Windows 10 to work with files, folders, and apps. There is plenty of ground to cover, so let’s get started:

**NOTE:** This tutorial is based on Windows 10 with November 10 Update. If you have an older version of Windows 10, some commands might not work, or things might look differently.

## How to get Ubuntu on Windows

For this tutorial, you should have the Linux Ubuntu on Windows installed on your Windows 10 computer or device.

 ![image](https://onehack.st/uploads/default/original/3X/6/8/68ad81c1e5652ed440f27227a972707a96f6fb0f.png)  
Ubuntu on Windows, installed from the Microsoft Store

Secondly, we assume that you have never ever worked with Linux, and that “you know nothing” about it, just like Jon Snow. 🙂

## What is Bash on Ubuntu on Windows

As a complete beginner, you might wonder what you’re getting from Bash on Ubuntu on Windows. You get the entire [Bash shell](https://en.wikipedia.org/wiki/Bash_(Unix_shell)) environment on your Windows 10 computer. If you used Windows before, be it Windows 10, Windows XP, or anything between those two, you are probably acquainted with the _Command Prompt_ and the PowerShell environments. Bash is a similar shell, but created for Linux operating systems.

 ![image](https://onehack.st/uploads/default/original/3X/8/8/88b196dc07c50483903a47d3d4e8998ccc3229ff.png)  
Command Prompt vs. PowerShell vs. Bash on Ubuntu on Windows

Just like _Command Prompt_ , Bash is a command-line environment. It runs on top of a Linux kernel and offers you a whole range of command-line utilities to run. You can use it to download, install, and use Linux applications, if that’s what you want. And all the utilities you run inside Bash get access to your Windows 10 file system. That means you can access, create, and delete files and folders on any of your drives. It is also important to note that, even though it’s possible, running graphical applications in Ubuntu on Windows is both a fairly complex thing to do and prone to errors. That’s because Ubuntu on Windows was created to provide a Linux subsystem and access to its utilities for developers, not for regular users.

## How to start Ubuntu on Windows 10

The first thing you have to do after you’ve installed Ubuntu on Windows is to launch it, and a quick way to do that is to click or tap on its shortcut from the _Start Menu_ .

 ![image](https://onehack.st/uploads/default/original/3X/1/a/1afe5d0fc9bc52ba344f56eef67437b676d01353.jpeg)  
Ubuntu has a shortcut in Windows 10’s Start Menu

This is what Ubuntu’s interface looks like in Windows 10:

 ![image](https://onehack.st/uploads/default/original/3X/3/2/32dd669b5defbf29eed82956afc9f119f67ef03e.png)  
The Ubuntu terminal in Windows 10

Being a command-line environment, you need to write the text commands that you want to run in it. If you’ve worked with _Command Prompt_ before, then you’re probably accustomed to writing the whole path of a command to be able to run it. Forget about that while you’re using the Bash shell. Here, any command, tool, or app you install can be run from anywhere just by typing its name. There’s no need to add its path before its name. Now let’s see the basic commands that you need to learn to get started:

## 1. How to change the directory on your Windows 10 PC, with Bash on Ubuntu, using the CD command

One of the essential commands in Bash is the one that lets you change the folder in which you’re working. To navigate to another folder from your Windows 10 PC, all you have to do is run the command **cd [path]** where _[path]_ is the location of that folder.

Note that all the drives on your Windows 10 PC are mounted in _/mnt/[the letter of the drive]_ . For example, the _C_ drive where Windows 10 is usually installed is found at this location: _/mnt/c_ . The _D_ drive, if you have one, is found at _/mnt/d_ and so on. Let’s take an example: if you’d want to navigate to the _Digital Citizen_ folder found on your _D_ drive, you’d have to run this Bash command: _cd “/mnt/d/Digital Citizen”_ .

 ![image](https://onehack.st/uploads/default/original/3X/4/8/48becb9ff1a64188557c849134ff373f520f9ce7.png)  
Using the CD command to change the working folder

**IMPORTANT:** If the folder you want to work in has spaces in its name, such as is the case for the _Digital Citizen_ , make sure to put the path between quotation marks. Also, use only straight marks, not curly or smart quotation marks, as they don’t work.

## 2. How to see the contents of a folder on your Windows 10 PC, with Bash on Ubuntu, using the LS command

In Bash, another vital command, that shows you the contents of a folder, is **ls**. Type it in, press _Enter_ on your keyboard, and you should get a list of every folder and file found inside the current directory.

 ![image](https://onehack.st/uploads/default/original/3X/c/6/c65a51ca1ab695e06fe442f571c0de5be071ce84.png)  
Using the LS command to display the contents of a folder

As you can see in the previous screenshot, the folders are highlighted so that you can differentiate them from files.

## 3. How to copy files on your Windows 10 PC, with Bash on Ubuntu, using the CP command

Bash also includes all the commands required for basic file management, such as copy, move, rename, delete. The command that lets you copy a file from one place to another is **cp [source] [destination]** , where _[source]_ is the path to the file that’s copied and _[destination]_ is the path to the place where it’s going to be copied.

For example, let’s say that we want to copy the file called _incognito.xlsx,_ found in our _Digital Citizen_ folder, to the _Security for Everyone_ subfolder. To do so, the command we’d have to run is _cp “/mnt/d/Digital Citizen/incognito.xlsx” “/mnt/d/Digital Citizen/Security for Everyone”_ .

 ![image](https://onehack.st/uploads/default/original/3X/e/3/e3d29f8f4a0e0a6f355be3b98751c89a352b4f0f.png)  
Using the CP command to copy a file

The file is then copied to the specified folder.

## 4. How to move or rename files on your Windows 10 PC, with Bash on Ubuntu, using the MV command

Moving or renaming files with Bash is similar to copying files. The command you need to run for this purpose has the following syntax: **mv [source] [destination]** , where _[source]_ is the path to the file that’s moved or renamed and _[destination]_ is the path to the place where it’s going to be moved. If the _[destination]_ is the same as the _[source],_ but the file name you specify is different from the original, the file is renamed instead of moved.

Using the same example as before, let’s move the _incognito.xlsx_ file from our _Digital Citizen_ folder to the _Security for Everyone_ subfolder, and then rename it to _web\_incognito.xlsx_ . To do so, we have to run these commands: _mv “/mnt/d/Digital Citizen/incognito.xlsx” “/mnt/d/Digital Citizen/Security for Everyone”_ and then _mv “/mnt/d/Digital Citizen/Security for Everyone/incognito.xlsx” “/mnt/d/Digital Citizen/Security for Everyone/web\_incognito.xlsx”_ .

 ![image](https://onehack.st/uploads/default/original/3X/5/5/55ddc1e1f43e936b2992c2ec1788a25e44fbf5a4.png)  
Using the MV command to move and rename a file

## 5. How to delete files from your Windows 10 PC, with Bash on Ubuntu, using the RM command

Removing or deleting files in Bash is done with the help of the **rm [file]** command. To remove the _web\_incognito.xlsx_ file that we created earlier, we first navigate to our _Security for Everyone_ folder that holds it, using the command _cd “/mnt/d/Digital Citizen/Security for Everyone”_ . Then, we run the command _rm web\_incognito.xlsx_ .

 ![image](https://onehack.st/uploads/default/original/3X/a/9/a932d2eec8770ce0ef03b2ceca4062023a1e4a99.png)  
Using the RM command to delete a file

## 6. How to create folders on your Windows 10 PC, with Bash on Ubuntu, using the MKDIR command

Creating a folder with Bash is done using the **mkdir [folder]** command, where _[folder]_ is the name of the folder you want to create. To exemplify, let’s say that we want to create a folder called _Tests_ inside our _Digital Citizen_ directory. To do so, we first navigate to the _Digital Citizen_ folder _(cd “/mnt/d/Digital Citizen”)_ and then run the command _mkdir Tests_ . It’s as simple as that.

 ![image](https://onehack.st/uploads/default/original/3X/6/4/64eac08037f14b6c90dec52671e72f487d9d25cb.png)  
Using the MKDIR command to create a new folder

## 7. How to delete folders from your Windows 10 PC, with Bash on Ubuntu, using the RM -R command

Similarly, removing or deleting a folder using Bash is just as easy. Navigate to the parent directory of the folder that you want to remove and run the command **rm -r [folder]** , where _[folder]_ is the name of the folder to delete. You might have noticed that this command also includes the _-r_ argument: you need to add it so that everything inside that folder is also deleted, recursively.

To exemplify, let’s delete the _Tests_ folder that we previously created inside our _Digital Citizen_ folder. For that, we first have to navigate to the parent folder, which is _Digital Citizen_ , using the command: _cd “/mnt/d/Digital Citizen”_ . Then, we must run the command _rm -r Tests_ .

 ![image](https://onehack.st/uploads/default/original/3X/4/1/41ce77d480a59bc718a66d5b8b88f40cde9c1572.png)  
Using the RM -R command to delete a folder

## 8. How to download and install Linux apps on Windows 10, with Bash on Ubuntu, using the SUDO APT-GET INSTALL command

Linux also lets you run commands as a superuser using the SUDO command, which gives you administrative privileges. The syntax is simple: **sudo [application]** , where _[application]_ can be any program installed on the operating system. Because the _sudo_ command gives you administrative powers over everything in Linux, it is very similar to what an administrator user account can do in Windows. If you want to download, install, and run Linux applications, you can use the following commands:

First, run **sudo apt-get update**. This command downloads the latest software lists from Ubuntu.

 ![image](https://onehack.st/uploads/default/original/3X/5/4/54f74a8b3d1f6d34877d9930308368307c1a1840.png)  
Using the SUDO APT-GET UPDATE command to retrieve up-to-date package lists

Then, to download and install the Linux app that you want, run **sudo apt-get install [application name]**. For example, if we’d want to install [w3m](http://w3m.sourceforge.net/), which is a text-based web browser, we’d have to run _sudo apt-get install w3m_ . If the app requires additional packages, you might have to confirm that you want to continue, in which case press the _Y_ key on your keyboard.

 ![image](https://onehack.st/uploads/default/original/3X/c/6/c6f6b74583f21a0510fdc81b31a6f4a6d7ddff10.png)  
Using the SUDO APT-GET INSTALL command to install a new app

Once the app is installed, you can run it by typing its name in Bash, followed by any parameters necessary. For example, if we wanted to visit our website, we’d have to type _w3m [1Hack.us](http://1Hack.us)_ .

 ![image](https://onehack.st/uploads/default/original/3X/1/9/1917af7ac332678f4376af38ce24fc11ac1b1cbc.png)  
Running an app in Bash on Ubuntu on Windows

## 9. How to get help in Bash on Ubuntu on Windows, using the HELP argument

If you want to find out more about what a certain command does, write it in Bash and add the parameter _“–help”_ . The information displayed should shed more light on the structure and usage of that command. Take, for instance, the command _ls,_ which lists the contents of a folder. It might seem like a simple command, but it offers quite a lot of options for how it displays the information. Here’s a part of the help you get for it:

 ![image](https://onehack.st/uploads/default/original/3X/d/9/d97c0b9c01d9f5633fe69adb561f79af106d9473.png)  
Getting help for a command in Bash on Ubuntu on Windows

## Did you try Bash on Ubuntu on Windows?

We hope that we’ve managed to introduce you to the very interesting world of the Linux Bash and the basics of using it in Windows 10. Try the commands that we showcased, and find out more about each command using the HELP argument. If you have any questions or tips to share, don’t hesitate to comment below.
