How to Install Linux Software in Windows 10’s Ubuntu Bash Shell

Install Windows 10’s Ubuntu-based Bash shell and you’ll have a complete Ubuntu environment that lets you install and run the same applications you could run on an Ubuntu-based Linux system. Just like on Ubuntu, though, you’ll need the apt-get command to install and update software.

Note that Windows 10’s Linux subsystem doesn’t officially support graphical applications or server software (though it is possible to run some graphical applications, unofficially). Officially, it’s intended for Linux terminal applications and other command-line utilities developers might want.

Windows 10’s Bash shell only supports 64-bit binaries, so you can’t install and run 32-bit Linux programs.

Apt-get Explained

On Ubuntu and other Debian-based Linux distributions, you use the apt-get command to install software. “Apt” stands for “Advanced Package Tool”. This command downloads software packages from Ubuntu’s centralized software repositories and installs them on your system. If the packages you try to install require–or “depend on”–other packages, apt-get will automatically download and install those packages (known as dependencies) as well. Apt-get works with “.deb” packages, named for Debian, the Linux distribution Ubuntu is based on.

You’ll need to run apt-get along with the “sudo” command, which gives it superuser, or root, permissions. This allows the command to modify and install system files in the Linux environment. You’ll have to enter your current user account’s password when you use sudo.

How to Download Updated Package Lists

First, you’ll want to run the following command to download up-to-date package lists from the software repositories:

sudo apt-get update

You’ll want to do this before you install any package.

How to Install a Package

If you know the name of a package you want to install, you can download and install it with the following command, replacing “packagename” with the name of the package you want to install:

sudo apt-get install packagename

For example, if you wanted to install Ruby, you’d run the following command:

sudo apt-get install ruby

You can press the Tab key while typing the name of a package (or any command) to use Bash’s autocomplete feature, which will help you automatically finish typing things and suggest available options, if multiple options are available.

After running this and other apt-get commands, you’ll be presented with the changes that will be made and you’ll have to type “y” and press Enter to continue.

How to Search for a Package

You may not always know the name of the package you want to install. In this case, you can use the apt-cache command to search your downloaded package cache (the lists that were download with apt-get update) for a program. This command searches package names and descriptions for the text you specify.

This command doesn’t require sudo, as it’s just a simple search. However, you can run it with sudo if you like, and it will still work.

apt-cache search sometext

For example, if you wanted to search for packages related to w3m, a text-based web browser for the terminal, you’d run:

apt-cache search w3m

How to Update All Your Installed Packages

To update your installed software packages to the latest available versions in the repository–which gives you any security updates available for your current packages–run the following command:

sudo apt-get upgrade

Remember to run the “sudo apt-get update” command before you run this command, as you need to update your package lists before apt-get will see the latest available versions.

How to Uninstall a Package

To uninstall a package when you’re done with it, run the following command:

sudo apt-get remove packagename

The above command just removes the package’s binary files, but not any associated configuration files. If you’d like to remove everything associated with the software package, run the following command instead:

sudo apt-get purge packagename

Neither of the above commands will remove any “dependencies,” which are packages that were installed because they were required for a package. If you uninstall a package and then remove it later, your system may still have a number of additional dependencies that are no longer necessary. To remove any packages that were installed as dependencies and are no longer required, run the following command:

sudo apt-get autoremove

How to Install Other Software

The above commands will help you install and update most common software you’ll require. However, some software will be installed through other commands and tools.

For example, Ruby gems are installed with the “gem install” command once you’ve installed Ruby via apt-get. Ruby has its own software installation system that’s separate from apt-get.

Some software packages are available in PPAs, or “personal package archives,” that are hosted by third parties. To install these, you’ll need to add the PPA to your system and then use the normal apt-get commands.

Newer software may need to be compiled and installed from source. All the packages you install with apt-get were compiled from source by Ubuntu’s build system and conveniently packaged into .deb packages you can install. You should avoid this if possible, but it may be unavoidable in some cases.

Whatever the case, if you’re trying to install another Linux application, you should be able to find instructions that tell you how you should install it. The same instructions that work on Ubuntu 14.04 LTS will work in Windows 10’s Bash shell. When it’s updated to the next major version of Ubuntu, the same instructions that work on Ubuntu 16.04 LTS will work on Windows 10.

Chris Hoffman is a technology writer and all-around computer geek. He's as at home using the Linux terminal as he is digging into the Windows registry. Connect with him on Google+.