Work with files, folders and apps using Bash on Ubuntu, in Windows 10

The addition of the Linux Bash command line environment to Windows 10 came as a surprise for many, us included. Although it’s a tool intended to be used mainly by developers, regular users seem to be interested in this feature too, so we thought it would make sense if we show you how Bash on Ubuntu on Windows works, and what you can do with it. This article is the first of what we hope will be an interesting series of tutorials and it covers working with files, folders and apps. If we managed to make you curious, read on:

NOTE: The features shared in this article are available only in Windows 10 with Anniversary Update and in Windows 10 Insider Preview Build 14367 or newer. Windows 10 Anniversary Update will be available for free, to all Windows 10 users, as of August 2, 2016.

How to get Bash on Ubuntu on Windows

First of all, we will assume that you already have installed the Linux Bash on Ubuntu on Windows on your Windows 10 computer or device. If you haven’t done it already, or if you need some guidance on this matter, we described the whole installation process in detail, here: How to get the Linux Bash in Windows 10, in 3 steps.

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’ll get from Bash on Ubuntu on Windows. You will get the entire Bash shell environment, on your Windows 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, only it was created for Linux systems.

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 and commands to run. You will be able to download, install and use Linux applications, if that’s what you want. And all the utilities you will run inside Bash , will get access to your Windows 10 file system. That means that you can access, create and delete files and folders on any of your disks, if you want.

It’s also important to note that, although it appears that some users managed to run graphical applications using Bash on Ubuntu on Windows, at least for now, you won’t be able to run graphical programs in normal conditions, and without errors.

That’s because Bash on Ubuntu on Windows was not created to run Linux on top of Windows, but rather to provide a Linux subsystem and access to Bash utilities for developers, not for regular users. That’s what Microsoft together with Canonical have in mind for now, although this could be just a first step in melding Windows and Linux apps and giving rise to a new species of computer applications. The future could be quite interesting in this area.

How to start Bash on Ubuntu on Windows

The first thing you’ll have to do after you’ve installed Bash on 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.

This is what Bash looks like in Windows 10:

Basic Bash commands for working with files, folders and apps

Being a command line environment and all, it’s obvious that you’ll 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 in order 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 for you to add its path before its name.

Although we’ll talk more about these Bash commands in future tutorials, here are a few commands to get you started:

  • Browse through your computer:
    • Change the folder in which you’re working: cd [path]
    • Display the contents of the folder: ls

  • Working with files found on your computer:
    • Copy a file: cp [source] [ destination ]
    • Move/Rename a file: mv [source] [destination]
    • Remove/Delete a file: rm [file]
  • Working with folders:
    • Create a folder: mkdir [folder]
    • Remove/Delete a folder and everything inside it: rm -r [folder]
  • Run a command as a superuser, which gives you administrative privileges: sudo command . Using the sudo command gives you an administrative power over anything in Linux and, in a way, is very similar to what an administrator user account can do in Windows.
  • Downloading, installing and running Linux applications:
    • Search for an application: sudo apt-cache search [application name]
    • Download and install a specific application: sudo apt-get install [application name]
    • To run an application that you’ve installed, simply write its name in Bash and press Enter on your keyboard.

How to get quick help in Bash on Ubuntu on Windows

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 will get for it:

Conclusion

We are ending this tutorial with the hope that we’ve managed to introduce you to the very interesting world of the Linux Bash from Windows 10. If you have any questions or tips to share, don’t hesitate to comment below.