PowerShell Core Cmdlets in Linux

45 minutes
  • 2 Learning Objectives

About this Hands-on Lab

There are a few commands every PowerShell user should know. These commands help make everyday tasks easier and are some of the key building blocks in learning PowerShell.

While we will cover other cmdlets in this lab, the three most important cmdlets every PowerShell user should master are `Get-Help`, `Get-Command`, and `Get-Service`.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Perform a system update, register the MS RedHat repository, and install PowerShell
  1. Use the yum command to sync the package index files from their sources via the Internet:
    sudo yum check-update
  2. Use the yum command to install the newest versions of all installed packages on CentOS:
    sudo yum update
  3. Register the Microsoft RedHat Repository
    curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
  4. Install PowerShell:
    sudo yum install -y powershell
  5. Start PowerShell:
    pwsh
Work with the Get-Command, Get-Help, and Get-Process Cmdlets
  1. Get all of the commands in the current session:
    Get-Command
  2. Get a list of all aliases in the current session using Get-Command:
    Get-Command -CommandType Alias
  3. Get a list of all functions in the current session using Get-Command:
    Get-Command -CommandType Function
  4. Access the help documentation for the Get-Command cmdlet:
    Get-Help Get-Command
  5. Update the help documentation:
    Update-Help
  6. Get a list of examples for using the Get-Command cmdlet:
    Get-Help Get-Command -Examples
  7. Gets a list of all cmdlets, sorts them alphabetically by the noun in the cmdlet name, and then display them in noun-based groups. Use the pipeline with the cmdlets:
    Get-Command -Type Cmdlet | Sort-Object -Property Noun | Format-Table -GroupBy Noun
  8. Get a list of all currently running process on the CentOS system:
    Get-Process
  9. List processes on the CentOS system in groups based on priority:
    $A = Get-Process
    $A | Get-Process | Format-Table -View priority
  10. Exit PowerShell:
    exit

Additional Resources

In order to get used to using PowerShell cmdlets, you decide to open up a terminal session, practice using Get-Command, Get-Help, Get-Process, and pipelines.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!