Let's Use BASH on Windows 10!
()
About this ebook
Let's use BASH on Windows 10! This book introduces Microsoft users to a brave new world, well, actually a world that has existed for decades, the command line of UNIX. This book addresses the newly included developer tool called BASH, for Bourne-Again SHell by providing simple (hopefully) explanations and examples. The book is organized in a logical approach to the commands and functions and includes many working scripts. BASH is available now in the current 64 bit versions of Microsoft Windows 10. This developer feature in Microsoft Windows 10 makes interoperability a reality! System Administrators, web designers, software developers, engineers, and power users from all platforms will find tools that will make their tasks more enjoyable. Examples of real world use of various scripts are included in the Appendix. This book provides step by step details, screen shots and practical examples of Ubuntu's BASH on Win10 (Windows 10). These examples will also work on any Linux, Mac OS X or other UNIX-like system. BASH is a powerful enhancement to Microsoft's Windows 10 operating system and while intended for developers, it provides a rich set of tools for any power user. The incorporation of Canonical's Ubuntu BASH shell into recent editions of Microsoft Win10 is amazing news for anyone familiar with the power of the command line in Unix-like systems.
John E. Meister, Jr
John Meister is a retired technical specialist and instructor, a Jack of all Trades, master of some.Interests include Biblical prophecy, photography, kayaking (flat water), Linux, and road trips, preferably in a Diesel Jeep.Over his career John has taught: electronics theory, design, troubleshooting and repair; microprocessors and assembly language programming; computer programming and science; systems analysis and design; operating systems (UNIX, Linux, Microsoft, etc.); shell scripting and the vi editor ; web design and HTML; technical writing and career planning; automotive maintenance and repair; and an overview of the Bible.John has held positions in a variety of corporations and industries as a System Administrator, systems analyst, circuit designer, equipment engineer, technical instructor, computer lab manager, adjunct faculty, electronics technician, mechanic, salesman, photographer and technical lead. Some of those companies were: Intel, O'Reilly Media, Boeing Electronics, Boeing Computer Services, Boeing Commercial Airplanes, ITT Tech, AT&T, Western Wireless, T-Mobile, Cingular, Merck, Intermec, City University of Seattle, Georgia Military College, Everett Community College, Prosoft, Develop Intelligence, New Horizons and other training companies nationwide. John served in the US Army Signal Corps attaining the rank of E-6, Staff Sergeant, specialized in the repair, installation and service of secure voice and data encrypted communication systems, served 5 years in Germany, an then as a TSEC/KG-13A instructor at the Signal School at Fort Gordon.As an O'Reilly Media author John created the LPIC-2 Certification exam study video series, released July 2016 - http://shop.oreilly.com/product/0636920050209.doEducation includes:- MSTM - Embry Riddle Aeronautical University- BSc, AA - University of Maryland- AA - Central Texas College- US Army Signal School - 32F/32G/31S/31T- Western Seminary (MDiv CEd - no degree)- Cogswell College North (BSEE - no degree)- Cleveland Institute of Electronics (Advanced Electronics & Troubleshooting)Listed in: Who's Who in Science and Engineering; Who's Who in American Education; Who's Who in America; Who's Who of Emerging Leaders in America; Who's Who Among Young American Professionals; and, Who's Who in the West (since 1987).
Read more from John E. Meister, Jr
Simply Linux: Basics Rating: 5 out of 5 stars5/5Full Size Jeep Buyer's Guide Rating: 4 out of 5 stars4/5Practical Suggestions For Microsoft Windows Rating: 4 out of 5 stars4/5Let's Use Bash on Windows 10! The Lite version Rating: 0 out of 5 stars0 ratingsBible Basics Rating: 0 out of 5 stars0 ratingsMac and Jack: The Tails of Two Kitties, as Told by Snapshots Rating: 0 out of 5 stars0 ratingsLinux Tackles Microsoft: Discover The Superior Performance And Power Savings of Linux Vs. Microsoft Rating: 0 out of 5 stars0 ratings
Related to Let's Use BASH on Windows 10!
Related ebooks
Going Text: Mastering the Command Line Rating: 4 out of 5 stars4/5Ubuntu: 101 Tips & Tricks Rating: 0 out of 5 stars0 ratingsThe Windows Command Line Beginner's Guide: Second Edition Rating: 4 out of 5 stars4/5The Linux Command Line Beginner's Guide Rating: 4 out of 5 stars4/5Working with Linux – Quick Hacks for the Command Line Rating: 5 out of 5 stars5/5Mastering Linux Shell Scripting Rating: 4 out of 5 stars4/5Linux Essentials - A Beginner's Guide To Linux Operating System Rating: 0 out of 5 stars0 ratingsThe Linux Mint Beginner's Guide Rating: 5 out of 5 stars5/5Linux for Beginners: Linux Command Line, Linux Programming and Linux Operating System Rating: 4 out of 5 stars4/5Linux Command-Line Tips & Tricks Rating: 0 out of 5 stars0 ratingsBash for Fun: Bash Programming: Principles and Examples Rating: 0 out of 5 stars0 ratings20 Windows Tools Every SysAdmin Should Know Rating: 5 out of 5 stars5/5Work with the Command-line: To Manage Files and Directories in Ubuntu Rating: 5 out of 5 stars5/5Arch Linux: Fast and Light! Rating: 3 out of 5 stars3/5PowerShell: A Beginner's Guide to Windows PowerShell Rating: 4 out of 5 stars4/5PowerShell: A Comprehensive Guide to Windows PowerShell Rating: 4 out of 5 stars4/5A Beginners Guide to Linux Rating: 0 out of 5 stars0 ratingsLPI Linux Certification Questions: LPI Linux Interview Questions, Answers, and Explanations Rating: 4 out of 5 stars4/5Easy Linux For Beginners Rating: 2 out of 5 stars2/5Linux Install or Dual Boot Rating: 0 out of 5 stars0 ratingsThe Mac Terminal Reference and Scripting Primer Rating: 4 out of 5 stars4/5Linux: A Comprehensive Guide to Linux Operating System and Command Line Rating: 0 out of 5 stars0 ratingsThe Complete Powershell Training for Beginners Rating: 0 out of 5 stars0 ratingsUNIX Shell Scripting Interview Questions, Answers, and Explanations: UNIX Shell Certification Review Rating: 5 out of 5 stars5/5Ubuntu Linux Toolbox: 1000+ Commands for Power Users Rating: 4 out of 5 stars4/5SSH Mastery: OpenSSH, PuTTY, Tunnels and Keys - 2nd edition: IT Mastery, #12 Rating: 0 out of 5 stars0 ratings
Computers For You
The Invisible Rainbow: A History of Electricity and Life Rating: 4 out of 5 stars4/5Elon Musk Rating: 4 out of 5 stars4/5Slenderman: Online Obsession, Mental Illness, and the Violent Crime of Two Midwestern Girls Rating: 4 out of 5 stars4/5Standard Deviations: Flawed Assumptions, Tortured Data, and Other Ways to Lie with Statistics Rating: 4 out of 5 stars4/5The ChatGPT Millionaire Handbook: Make Money Online With the Power of AI Technology Rating: 0 out of 5 stars0 ratingsSQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5101 Awesome Builds: Minecraft® Secrets from the World's Greatest Crafters Rating: 4 out of 5 stars4/5Mastering ChatGPT: 21 Prompts Templates for Effortless Writing Rating: 5 out of 5 stars5/5Everybody Lies: Big Data, New Data, and What the Internet Can Tell Us About Who We Really Are Rating: 4 out of 5 stars4/5Practical Lock Picking: A Physical Penetration Tester's Training Guide Rating: 5 out of 5 stars5/5Dark Aeon: Transhumanism and the War Against Humanity Rating: 5 out of 5 stars5/5The Hacker Crackdown: Law and Disorder on the Electronic Frontier Rating: 4 out of 5 stars4/5How to Create Cpn Numbers the Right way: A Step by Step Guide to Creating cpn Numbers Legally Rating: 4 out of 5 stars4/5CompTIA IT Fundamentals (ITF+) Study Guide: Exam FC0-U61 Rating: 0 out of 5 stars0 ratingsThe Professional Voiceover Handbook: Voiceover training, #1 Rating: 5 out of 5 stars5/5Procreate for Beginners: Introduction to Procreate for Drawing and Illustrating on the iPad Rating: 0 out of 5 stars0 ratingsGrokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5CompTIA Security+ Practice Questions Rating: 2 out of 5 stars2/5Alan Turing: The Enigma: The Book That Inspired the Film The Imitation Game - Updated Edition Rating: 4 out of 5 stars4/5Deep Search: How to Explore the Internet More Effectively Rating: 5 out of 5 stars5/5Ultimate Guide to Mastering Command Blocks!: Minecraft Keys to Unlocking Secret Commands Rating: 5 out of 5 stars5/5Computer Science: A Concise Introduction Rating: 4 out of 5 stars4/5Master Builder Roblox: The Essential Guide Rating: 4 out of 5 stars4/5Creating Online Courses with ChatGPT | A Step-by-Step Guide with Prompt Templates Rating: 4 out of 5 stars4/5
Reviews for Let's Use BASH on Windows 10!
0 ratings0 reviews
Book preview
Let's Use BASH on Windows 10! - John E. Meister, Jr
Let’s BASH Windows 10!
John Meister
Let’s BASH Windows 10!
Copyright 2017 John Meister
ISBN: 9781370013111
Published by John Meister at Smashwords
Smashwords Edition License Notes
This ebook is licensed for your personal enjoyment only. This ebook may not be re-sold or given away to other people. If you would like to share this book with another person, please purchase an additional copy for each recipient. If you’re reading this book and did not purchase it, or it was not purchased for your enjoyment only, then please return to Smashwords.com or your favorite retailer and purchase your own copy. Thank you for respecting the hard work of this author.
Table of Contents
Introduction to BASH on Windows 10
How to INSTALL BASH on WIN10
How to Configure the BASH window
Chapter 1_Linux_Overview
Chapter 2_the_5_essential_commands
Chapter 3_the_vi_Editor
Chapter 4_shell_config_History_script
Chapter 5_File_Management:_cp_mv_rm
Chapter 6_Files, Processes and Special Characters
Chapter 7_Regular_Expressions_and_Filters
Chapter 8_ssh_setup_and_use
Chapter 9_Network_Basics
Chapter 10_Files_Systems:_df_du
Chapter 11_Managing Users
Chapter 12_apt-get installs and updates
Appendix: How to INSTALL_BASH_WIN10
Appendix: The LINUX Philosophy
Appendix: Exercise #1 - the 5 basic commands
Appendix: Exercise #2 - chmod, chown, file permissions
Appendix: Additional info on BASH
Appendix: Additional info from Chapter 2
Appendix: SCRIPT: fix filenames
Appendix: SCRIPT: use wget, date, and a while loop
Appendix: REAL WORLD LINUX COMMANDS
Other Books by this Author
Connect with John Meister
Introduction to BASH on Windows 10
Let's use BASH on Windows 10! This book introduces Microsoft users to a brave new world, well, actually a world that has existed for decades, the command line of UNIX. This book addresses the newly included developer tool called BASH, for Bourne-Again SHell by providing simple (hopefully) explanations and examples. The book is organized in a logical approach to the commands and functions, but FEEL FREE TO JUMP AROUND IN THIS BOOK. After installing BASH on Win10, I recommend that you configure ".bashrc and
.History" and then just have fun trying commands, scripts and examples.
BASH has a rich set of command line tools that provide a wide array of powerful commands and features found in Ubuntu BASH, and other UNIX-like systems. What is learned related to BASH may be applied to other UNIX-like systems, so this is a set of tools that provides interoperability and is transferable; it is NOT proprietary or limited in scope.
BASH is available now in the current 64 bit versions of Microsoft Windows 10. This developer feature in Microsoft Windows 10 makes interoperability a reality! System Administrators, web designers, software developers, engineers, and power users from all platforms will find tools that will make their tasks more enjoyable. Examples of real world use of various scripts are included in the Appendix. Jump back to the Table of Contents
BASH is COMMAND LINE only and not a GUI (Graphical User Interface). Brian Kernighan, one of the developers of UNIX, said it best about GUI: What You See Is All You Get
(WYSIAYG), a sarcastic variant of the original "What You See Is What You Get" (WYSIWYG). The truth is that CLI (command line interface) provides far more options than can be presented visually through pictures, ribbons or menus. The CLI provides a rich set of features that allows someone to solve unique problems in creative ways.
GUI interfaces simply can not provide all of the options for commands, which is what Kernighan was pointing out. Brian Wilson Kernighan (born 1942) contributed to UNIX along with Ken Thompson and Dennis Ritchie, he is the K
in K&R C and AWK. There is more information in the wiki about him linked here.
This book provides step by step details, screen shots and practical examples of Ubuntu's BASH on Win10 (Windows 10). These examples will also work on any Linux, Mac OS X or other UNIX-like system. BASH is a powerful enhancement to Microsoft's Windows 10 operating system and while intended for developers, it provides a rich set of tools for any power user. The incorporation of Canonical's Ubuntu BASH shell into recent editions of Microsoft Win10 is amazing news for anyone familiar with the power of the command line in Unix-like systems.
https://insights.ubuntu.com/2016/03/30/ubuntu-on-windows-the-ubuntu-userspace-for-windows-developers/ states: Let's break this down slowly:
1) Windows 10 users
2) Can open the Windows Start menu
3) And type bash
[enter]
4) Which opens a cmd.exe console
5) Running Ubuntu’s /bin/bash
6) With full access to all of Ubuntu user space
7) Yes, that means apt, ssh, rsync, find, grep, awk, sed, sort, xargs, md5sum, gpg, curl, wget, apache, mysql, python, perl, ruby, php, gcc, tar, vim, emacs, diff, patch…
8) And most of the tens of thousands binary packages available in the Ubuntu archives!
There are a few limitations of BASH within the Microsoft Win10 (Windows 10) environment related to networking and Microsoft executables. The limitations aren't show stoppers. To date I've not been able to ssh
into the BASH shell from another system, ping
, ifconfig
and other networking related tools do not work, but as these commands are usually tied directly to a UNIX-like system kernel it is not unexpected. However, I am able to nslookup
and ssh
to various systems. I've seen some variations working with this, one some systems I needed to use the sudo
command to connect with ssh
, but this hasn't been consistent and may have been fixed with more recent updates from Microsoft. The rule of thumb for the advanced features might be to use sudo
to give the BASH kernel authority to work, or even launch the BASH tool as an administrator from Win10, however, this book is written and tested as a normal user as many in corporate environments are not permitted admin rights. Because this is such a powerful tool that could benefit engineers, analysts and even bean counters
I wanted to make sure that these things would work for everyone. Within BASH using sudo
will not require elevated rights in any enterprise domain.
The jobs control feature doesn't work completely either, but because this is CLI only that is not unexpected. Overall most features of BASH work as one would expect from any Linux, Mac OS X or other UNIX-like system. The scripts provided in the Appendix have been tested in BASH on Win10 running in VMs on a Mac OS X and Linux, that they work there, as well as on native Win10 systems in the free world
and within a Domain Controlled enterprise environment is proof enough of a successful implementation of what is labeled as beta
. Congrats to all involved in implementing and deploying this fantastic feature! I am personally excited about this new feature because it reduces complexity in corporate settings for DBAs, Sys Admins, engineers, researchers, web developers, testers and others crunching a lot of data or information.
The Ubuntu BASH feature is not a full implementation of Linux, it is COMMAND LINE ONLY. It is not a virtual machine or a container, neither is it a compiled application like cygwin
, it is native Ubuntu Linux BASH binaries running in Windows. Simply put, you can do things in Microsoft you could never do before. This means you no longer need to use putty.exe
to ssh to a Linux system to work on your shell scripts, SQL statements or to edit web pages with the vi editor. You can do it all on a Microsoft desktop! This means you can sort large files and search (grep) for words quickly and even redirect the results into a completely new file any where on your computer, or even across the network. You can develop a web page in the vi editor quickly, then scp the file to your Linux Apache server with great ease!
BASH provides a very powerful set of tools that significantly enhances your Win10 system. GUI (graphical user interface) applications in Linux will not work as there are no windowing capabilities provided. However, many Linux users rarely use the GUI, except for the tools available on other systems, like Firefox, Thunderbird and an office suite, like OpenOffice or LibreOffice. Most real work takes place at the command line in the BASH shell. So, using BASH on Win10 means you may use the common applications on the Microsoft desktop and can still edit files in BASH as you would on a UNIX-like system. This is a wonderful capability and provides true interoperability, allowing power users to move across platforms without a loss of tools.
Once you become familiar with the tools in BASH you will be able to move across platforms and manage files faster and with fewer distractions. In time you will want to avoid the "clicking and drooling" associated with the GUI and will seek out the shell! You will also be able to amaze and impress friends as you demonstrate your new founds skills that also work on Linux and Mac!
The author has developed and released other material on Linux that may be found through O'Reilly Media and Smashwords.com, available on line and also on DVD, at the following links: http://shop.oreilly.com/product/0636920050209.do and also on Amazon.com,
ASIN: B01I25VO9A. The author has e-books on Linux, Windows and other topics available through a variety of sources see e-books by John Meister.
The Appendix has TLDR
(too long, didn't read) sections where expanded information is provided to cure your insomnia or satisfy your curiosity. I wanted to share the details.
Details about the history of UNIX, Linux and the BASH shell and others have been moved to the Appendix for your future reading pleasure, see Additional Background_on_UNIX_and_BASH
To install BASH step by step on Window10, see the Appendix. The appendix will provide current setup steps as of January 2017. As the tool matures the steps may change. In some corporate environments the steps may be different. If the instructions provided in the appendix don't work, use a search engine to find a method that works. Once you've got it installed the Appendix also shows how to set the colors and features. Chapter 4 discusses the configuration of your .bashrc
file. I'd recommend that you create your .bashrc file immediately along with the .History
directory. These two features will make navigation in BASH more practical.
Step by step examples are provided to show how the commands work, or what their limitations are in this environment, if any. The learning curve on some of these tools can be very steep, but seeing examples will open up a new world to you, and save you many hours of working with information in text files.
You do not need to master every aspect of BASH to use it. In fact, feel free to jump around in this book. If you see something being described and couldn't care less about it, skim on and look for something you like. If you find out later it was interesting, go back and dig in further. I'm following an approach to this material that has been developed over many years of teaching UNIX and Linux classes. People learn in different ways, and none of us needs to know everything about this subject, so if you don't get it, don't worry, move on and if you find later you need it, then learn it. Hack away and remember that this is a protected environment, meaning that you will not be able to damage your Win10 system unless you really work hard at it. I haven't tried to break Windows 10 from within BASH yet, but while it's possible, it would require advanced knowledge of both systems and is not likely to happen accidentally.
Much of this material has been used to teach UNIX and Linux courses for many years and you should be able to use much of this material to study for the LPIC exams (LPIC - Linux Professional Institute Certification).
The author has created a 12 hour video series on Linux for preparation of taking the LPIC-2 exams. That series covers Linux System Administration and is subtitled The Art of Linux System Administration
. Some of that material will be included in this book to demonstrate pragmatic uses of the BASH tool.
Jump