Enable Linux Bash command in Windows 10 preview 14316

Source: Internet
Author: User
Tags symlink touch command

Enable Linux Bash command in Windows 10 preview 14316

The bash component is provided in Windows 10 preview version 14316, Which is disabled by default, to enable this function, first Select Start> Settings> Update and Security> for developers> developer mode, and then press Win + X, F Open "programs and functions", click "enable or disable Windows functions" on the left side, find and check Windows Subsystem for Linux (Beta), and then prompt to restart the system.

After the system is restarted, press Win + X and A to open the command prompt (or press Win + R to open the run dialog box) and enter bash and press Enter. The first run will download the Ubuntu linux component from the Internet, enter y as prompted.

-- Beta feature --This will install Ubuntu on Windows, distributed by Canonicaland licensed under its terms available here:https://aka.ms/uowtermsType "y" to continue: yDownloading from the Windows Store... 100%Extracting filesystem, this will take a few minutes...????! ???????...root@localhost:~#

View version information and partition ing:

root@localhost:~# uname -aLinux localhost 3.4.0+ #1 PREEMPT Thu Aug 1 17:06:05 CST 2013 x86_64 x86_64 x86_64 GNU/Linuxroot@localhost:~# cat /etc/issueUbuntu 14.04.4 LTS \n \lroot@localhost:~# ls -al /mnttotal 24drwxrwxr-x 2 root 1000 0 Apr  7 07:22 .drwxrwxr-x 2 root root 0 Apr  7 07:22 ..drwxrwxrwx 2 root root 0 Apr  7 06:58 cdrwxrwxrwx 2 root root 0 Apr  7 04:59 droot@localhost:~# sudo ls /devadss   fb0    kmsg  ptmx  random  tty   urandomblock  input  null  pts   shm     tty0  zeroroot@localhost:~#

Note that the root user does not have many devices in/dev. Enter exit to exit bash.

The/root directory corresponds to the % localappdata % \ lxss \ root folder in Windows (Note: Do not delete the lxss directory, bash will fail ).

If lxss is unfortunately deleted or bash startup fails for other reasons. You can run the following two commands in CMD to uninstall and reinstall it:

echo y|lxrun /uninstallecho y|lxrun /install

Update the linux subsystem and run the following command in CMD:

Lxrun/update // update the linux subsystem //-or-lxrun/update/critical // update only key updates. After the update is complete, the linux Process is forcibly disabled.

Before using the command apt-get to install software, it is recommended to first add a domestic mirror server in the/etc/apt/sources. list file front-end, the http://mirrors.163.com/ubuntu is the mirror source of 163:

deb http://mirrors.163.com/ubuntu trusty main restricted universe multiversedeb http://mirrors.163.com/ubuntu trusty-upadates main restricted universe multiversedeb http://mirrors.163.com/ubuntu trusty-security main restricted universe multiverse

Available vi Editing:

vi /etc/apt/sources.list

Copy the original three rows by 3yy, press Shift + G to the end, and press p to paste. Input: 1, 3 s/\ w * \. ubuntu/mirrors.163/Replace the image with the first 3 Actions 163, Shift + ZZ save and exit.

Use the apt-get update command to update the source (some verification warnings will appear at the end of the 163 update source, which can be ignored ).

Install git:

apt-get --assume-yes install git

-- Assume-yes (optional): All installation interactions are yes.

Delete and replace install with remove.

Automatic removal:

apt-get autoremove

Query 7z software:

apt-cache search 7z

----

The following is an example of installing the swift compiling environment (unsuccessful ):

1. Install CLang and libicu-dev

apt-get install clang libicu-dev

2. Download the swift release package (go to swift.org to find the version of ubuntu14.04. The current DEV snapshot is the Swift 3.0 preview version)

curl -O https://swift.org/builds/development/ubuntu1404/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04.tar.gz

Note: you can download the file by using the download tool in the Windows system, and then use the touch command to create a file with the same name in the linux File System.

root@localhost:~# touch swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04.tar.gz

Then, copy the file in Windows to overwrite the % localappdata % \ lxss \ root folder.

3. decompress the tar.gz package.

tar xzf swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04.tar.gz

If the following error occurs:

root@localhost:~# tar zxf swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04.tar.gztar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/bin/swift-autolink-extract: Cannot create symlink to ‘swift’: Invalid argumenttar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/bin/swiftc: Cannot create symlink to ‘swift’: Invalid argumenttar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/bin/lldb-server: Cannot create symlink to ‘lldb-server-3.9.0’: Invalid argumenttar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/bin/lldb: Cannot create symlink to ‘lldb-3.9.0’: Invalid argumenttar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/bin/lldb-mi: Cannot create symlink to ‘lldb-mi-3.9.0’: Invalid argumenttar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/lib/liblldb.so: Cannot create symlink to ‘liblldb.so.3.9.0’: Invalid argumenttar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/lib/python2.7/site-packages/lldb/_lldb.so: Cannot create symlink to ‘../../../../lib/liblldb.so’: Invalid argumenttar: swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/lib/python2.7/site-packages/lldb/lldb-argdumper: Cannot create symlink to ‘../../../../bin/lldb-argdumper’: Invalid argumenttar: Exiting with failure status due to previous errors

Use 7z to decompress and set executable permissions.

rm -rf swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04apt-get install p7zip-full7z x swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04.tar.gz7z x swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04.tarrm swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04.tarchmod +x /root/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/bin/*

4. Configure environment variables, edit ~ /. Add the bashrc file to the end

export PATH=/root/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu14.04/usr/bin:"${PATH}"

5. Reload the configuration and view the result:

root@localhost:~# source ~/.bashrcroot@localhost:~# swift --versionSwift version 3.0-dev (LLVM b010debd0e, Clang 3e4d01d89b, Swift 7182c58cb2)Target: x86_64-unknown-linux-gnuroot@localhost:~#

6. Currently, you cannot enter the REPL environment or compile swift files.

Compilation error:

<unknown>:0: error: could not load the swift standard library

Run the Ubuntu application with a graphical user interface on Windows 10 using Bash

Use Bash on Ubuntu on Windows 10

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.