Accessing the Command-Line Interface

Getting access to the command-line interface, often called the shell, varies based on your operating system. Usually, you’ll access it through a program called a terminal, short for terminal emulator.

If you’re on a Linux machine with a GUI, you can usually launch its terminal app with Control+Alt+t, or by searching for a Terminal program in your list of programs. When the terminal opens, you’ll see something like this:

 brian@puzzles:~$

This is the prompt, and it’s where you’ll enter commands. We’ll explore its meaning shortly.

To access the command-line interface on a Mac, hold down the Command key on your keyboard and press Space. This brings up the Spotlight window. Type terminal into the box and press Enter. This launches the Terminal program. The prompt you’ll see looks like this:

 puzzles:~ brian$

Windows 10 has a few command-line interfaces. The classic Command Prompt and the PowerShell interfaces aren’t compatible with the command-line interface on Linux, BSD, or macOS systems. They have their own commands and approaches to solving problems. So you won’t be using those interfaces in this book. Instead, you’ll use the Bash on Windows feature for Windows 10.

To do this, you’ll enable the Windows Subsystem for Linux[5] and then download Ubuntu from the Windows Store. It’s a free download that installs a version of Ubuntu on top of your Windows operating system, and it’s fully supported by Microsoft. There are other flavors of Linux available, but you’ll use Ubuntu in this book.

First, open the Control Panel and select Programs. Then, click Turn Windows Features On Or Off. Locate and enable the option for “Windows Subsystem for Linux.” Then reboot your computer.

When the computer reboots, open the Windows Store and search for Ubuntu. Install it and launch it once it installs.

You’ll see a console window open and Ubuntu will install some additional components and configure itself:

 Installing, this may take a few minutes...
 Installation successful!

Once it finishes extracting, you’ll get prompted to create a new user account and password. This new account isn’t connected to your Windows account in any way. To keep things easy to remember, use the same username as your Windows user. For the password, choose anything you like. You won’t see your password as you type it, as it’s hidden for security purposes.

 Please create a default UNIX user account. The username does not need to match
 your Windows username.
 For more information visit: https://aka.ms/wslusers
 Enter new UNIX username: brian
 Enter new UNIX password:
 Retype new UNIX password:
 passwd: password updated successfully
 Default UNIX user set to: brian
 To run a command as administrator (user "root"), use "sudo <command>".
 See "man sudo_root" for details.

You’ll then be placed at a Bash prompt. Type exit to close the window.

To open Bash on Windows in the future, open a new Command Prompt or PowerShell window and type bash again. Alternatively, choose Ubuntu from the Start menu.

Now that you have the CLI open, you can start exploring.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.237.115