Learn

When working in the PowerShell terminal, a few practical actions can make running commands easier.

Command Completion

If you type in only a few letters of a command and then hit the Tab key, the terminal will attempt to autocomplete the command.

If there is only one command that the partial command can be, such as Get-D, hitting Tab will autofill the rest of the command with Get-date.

If more than one command matches the partial command, such as Get-H, Tab will list the potential commands.

Get-Help Get-History Get-Host

This can help us identify what command we want to use.

Command History

As with most modern terminals, a command history is stored in a file and can be accessed using:

Get-History

This command is helpful if you forget how you previously accomplished a task and want to look back.

History with Up/Down Keys

If there are commands that you plan on using a lot or ones that are long that you have to run again, the Up, and Down keys on the keyboard can be used to cycle through your command history. Start this process using the up arrow key to scroll from newer to older commands. You can scroll back with the down arrow key toward more recent commands.

Using quick shortcuts like these allows us to navigate the text-based world of PowerShell a little bit easier, so we can focus on our primary task.

Instructions

1.

Let’s look at all the Get- commands.

Type Get- into the terminal and then hit the Tab.

Click Check Work when complete.

2.

Look at all the Get commands available!

Type Get-Ti and hit the Tab key.

Once Get-Timezone auto-completes, hit Enter

Click Check Work when complete.

3.

Now run the command Get-Host and hit Enter.

Click Check Work when complete.

4.

Use the up and down arrow keys to look at your command history. Choose one of the two commands you’ve already run and hit Enter.

Click Check Work when complete.

5.

Lastly, type Get-Hi and hit the Tab key. Hit Enter to review your command history.

Click Check Work when complete.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?