- Lab
- A Cloud Guru
PowerShell Core Cmdlets in Linux
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`.
Path Info
Table of Contents
-
Challenge
Perform a system update, register the MS RedHat repository, and install PowerShell
- Use the
yum
command to sync the package index files from their sources via the Internet:
sudo yum check-update
- Use the
yum
command to install the newest versions of all installed packages on CentOS:
sudo yum update
- Register the Microsoft RedHat Repository
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo
- Install PowerShell:
sudo yum install -y powershell
- Start PowerShell:
pwsh
- Use the
-
Challenge
Work with the Get-Command, Get-Help, and Get-Process Cmdlets
- Get all of the commands in the current session:
Get-Command
- Get a list of all aliases in the current session using Get-Command:
Get-Command -CommandType Alias
- Get a list of all functions in the current session using Get-Command:
Get-Command -CommandType Function
- Access the help documentation for the Get-Command cmdlet:
Get-Help Get-Command
- Update the help documentation:
Update-Help
- Get a list of examples for using the Get-Command cmdlet:
Get-Help Get-Command -Examples
- 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
- Get a list of all currently running process on the CentOS system:
Get-Process
- List processes on the CentOS system in groups based on priority:
$A = Get-Process $A | Get-Process | Format-Table -View priority
- Exit PowerShell:
exit
What's a lab?
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.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.