0%

Become an efficient command-line expert by harnessing the power of the new Microsoft Windows Terminal, and learn time-saving tricks for PowerShell, WSL2, and more

Key Features

  • Customize and optimize your Windows Terminal and its shells
  • Work effectively on the command line with split panes, hotkeys, and automation
  • Use PowerShell and WSL2 efficiently to build, test, and deploy applications

Book Description

Windows Terminal is a new and open-source command-line application for Windows 10, built for the Command Prompt, PowerShell, Windows Subsystem for Linux, and more. It's fast, modern, and configurable thanks to its GPU-accelerated rendering, excellent UTF-8 support, and JSON-based configurability, and this book can help you learn how to leverage these features.

You'll start by learning the benefits of Windows Terminal and its open-source development, as well as how to use the built-in tabs, panes, and key bindings to build your own efficient terminal workflows. After you've mastered Windows Terminal, this book shows how to use and configure PowerShell Core and the Windows Subsystem for Linux within Windows Terminal. You'll maximize your productivity using powerful tools such as PSReadLine for PowerShell and ZSH on Linux, and discover useful tips and tricks for common developer tools like Git and SSH. Finally, you'll see how Windows Terminal can be used in common development and DevOps tasks, such as developing frontend JavaScript applications and backend REST APIs, and managing cloud-based systems like Amazon Web Services (AWS), Microsoft Azure, and Google Cloud.

By the end of this book, you'll not only be well-versed with Windows Terminal, but also have learned how to effectively use shells like PowerShell Core and ZSH to become proficient at the command line.

What you will learn

  • Install, update, and use Windows Terminal and its preview version
  • Customize your Windows Terminal to be both visually appealing and functional
  • Enable and effectively use the latest versions of PowerShell Core and Windows Subsystem for Linux
  • Install and configure time-saving tools for the command line
  • Work efficiently with common developer tools such as Git and SSH
  • Build, deploy, and manage apps in the cloud using Windows Terminal
  • Use Linux tools from Windows with ease

Who this book is for

This book is for developers, DevOps engineers, and sysadmins who want to become advanced command-line power users. Whether you're new to the command line or you already use Windows PowerShell every day, this book will have something for you.

Table of Contents

  1. Windows Terminal Tips, Tricks, and Productivity Hacks
  2. Foreword
  3. Contributors
  4. About the author
  5. About the reviewers
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. Section 1 – Introducing the New Windows Terminal
    4. Section 2 – Configuring your Windows Terminal and its shells
    5. Section 3 – Using your Windows Terminal for development
    6. To get the most out of this book
    7. Download the example configuration and code files
    8. Download the color images
    9. Conventions used
    10. Get in touch
    11. Reviews
  7. Section 1: Introducing the New Windows Terminal
  8. Chapter 1: Getting started with the new Windows Terminal
    1. Technical requirements
    2. Why a new terminal?
    3. The modern foundations of Windows Terminal
    4. A Modern UI
    5. Flexible JSON-based customization
    6. Open source development
    7. Installing Windows Terminal
    8. Launching Windows Terminal
    9. Summary
    10. Further reading
  9. Chapter 2: Learning the Windows Terminal UI
    1. Technical requirements
    2. Using the terminal tabs
    3. Editing tab title appearance
    4. Using terminal panes
    5. Managing terminal output
    6. Using the command palette
    7. Keyboard shortcuts review
    8. Summary
    9. Further reading
  10. Chapter 3: Configuring an Ubuntu Linux profile
    1. Technical requirements
    2. Why use the Windows Subsystem for Linux?
    3. Installing Ubuntu Linux
    4. Step 1: Install WSL2
    5. Step 2: Install Ubuntu
    6. Launching Linux
    7. Installing Linux applications: nginx
    8. Starting nginx
    9. Bidirectional access in Windows and Ubuntu
    10. Summary
  11. Section 2: Configuring your Windows Terminal and its shells
  12. Chapter 4: Customizing your Windows Terminal settings
    1. Technical requirements
    2. Introducing the settings.json file
    3. Recovering from bad settings
    4. The settings file structure
    5. Useful Global Settings
    6. Useful profile settings
    7. Custom command-line profiles
    8. Git Bash shell
    9. SSH shell
    10. C# interactive shell
    11. Node.js interactive shell
    12. Vim terminal shell
    13. Summary
  13. Chapter 5: Changing your Windows Terminal appearance
    1. Technical requirements
    2. Terminal color schemes
    3. Built-in color schemes
    4. Community-driven color schemes
    5. Writing your own theme
    6. Background images and translucency
    7. Customizing PowerShell with posh-git, oh-my-posh, and PSReadLine
    8. Oh-my-posh version 2
    9. Oh-my-posh version 3
    10. Changing the prompt without oh-my-posh
    11. Changing command colors with PSReadline
    12. WSL2 customization with oh-my-zsh
    13. Command Prompt customization
    14. Summary
  14. Chapter 6: Setting up keyboard shortcuts
    1. Technical requirements
    2. Overview of the keyboard shortcut system
    3. Building custom commands with "sendInput"
    4. Configuring custom terminal layouts with "wt"
    5. Additional uses of 'wt'
    6. Summary
  15. Chapter 7: Hidden Windows Terminal Actions
    1. Technical requirements
    2. Discovering unbound actions
    3. Using actions for focus management
    4. togglePaneZoom
    5. toggleAlwaysOnTop
    6. toggleFocusMode
    7. Using actions for visual effects
    8. setColorScheme
    9. toggleShaderEffects
    10. Using actions for tab manipulation
    11. Closing multiple tabs at once
    12. Changing tab colors
    13. Summary
  16. Chapter 8: Tips for using PowerShell like a Pro
    1. Technical requirements
    2. Installing PowerShell Core
    3. Using built-in commands and aliases
    4. Automatic Variable: $^ and $$
    5. cd - and cd +
    6. The ii command
    7. History navigation with h and r
    8. Pipelines and $_
    9. Custom Profile Aliases and Functions
    10. Configuring PSReadLine in PowerShell Core
    11. EditMode
    12. History Search
    13. Better autocompletion
    14. Command predictions
    15. Programmable shortcuts
    16. Adding the GNU coreutils to the path
    17. Installing the z utility
    18. Addendum – the full PowerShell $profile file
    19. Summary
  17. Chapter 9: Tips for Using Ubuntu like an Expert
    1. Technical requirements
    2. Using Ubuntu with Windows
    3. Accessing Linux directories from Windows
    4. Accessing Windows directories from Linux
    5. Running Linux programs from inside Windows
    6. Running Windows programs from inside Linux
    7. Installing and configuring software
    8. Choosing your shell
    9. Using ZSH
    10. Rerunning earlier commands
    11. Using ZSH substitutions
    12. Configuring aliases and functions
    13. Quickly navigating to directories
    14. Installing and using oh-my-zsh plugins
    15. Enabling the z plugin
    16. Enabling vi-mode
    17. Installing zsh-autosuggestions
    18. zsh-syntax-highlighting
    19. Summary
  18. Section 3: Using your Windows Terminal for development
  19. Chapter 10: Using Git and GitHub with Windows Terminal
    1. Technical requirements
    2. Creating a modern Git installation
    3. Installing Git
    4. Installing OpenSSH
    5. Starting our OpenSSH Agent
    6. Setting up a private/public key pair
    7. Testing our SSH authentication
    8. Authenticating with Git on Linux
    9. Tips for using Git effectively
    10. Switching Git branches with git checkout -
    11. Fixing typos with Git's autocorrect
    12. Pushing to HEAD
    13. Git aliases and command aliases
    14. Tig
    15. Viewing files on different branches
    16. git reflog
    17. Using GitHub from Windows Terminal
    18. Creating repositories
    19. Viewing pull requests
    20. Checking out Pull Requests
    21. Summary
  20. Chapter 11: Building web applications with React
    1. Technical requirements
    2. Installing Node.js in WSL2
    3. Adding a Node.js profile to Windows Terminal
    4. Creating a React app
    5. Developing in WSL2
    6. Developing with a modern workflow
    7. Summary
  21. Chapter 12: Building REST APIs with C# and Windows Terminal
    1. Technical requirements
    2. Installing .NET and C#
    3. Using dotnet script from Windows Terminal
    4. Generating our REST API
    5. Testing our REST API
    6. Making changes to our REST API
    7. Running unit tests with Windows Terminal
    8. Summary
  22. Chapter 13: Connecting to remote systems
    1. Technical requirements
    2. Connecting to Windows computers with WinRM and SSH
    3. Connecting with WinRM
    4. Connecting to Windows computers with SSH
    5. Copying files with SCP
    6. Connecting to Linux machines
    7. Saving routinely accessed hosts and commands
    8. Starting remote connections in Windows Terminal
    9. Summary
  23. Chapter 14: Managing systems in the cloud
    1. Technical requirements
    2. Using Microsoft Azure's Cloud Shell and az interactive
    3. Using az interactive
    4. Using Google Cloud Shell and gcloud interactive
    5. Using gcloud beta interactive
    6. Using AWS from Windows Terminal
    7. Using aws-shell
    8. Using the AWS Tools for PowerShell
    9. Summary
  24. Appendix Windows Terminal Actions
    1. List of Windows Terminal actions
    2. Why subscribe?
  25. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Leave a review - let other readers know what you think
18.118.12.101