How to do it...

  1. At the PowerShell prompt, type in the following command to list the contents of the directory.
PS> ls -l

You see the familiar output (albeit without any of the colours, if your terminal emulator uses colours for file names).

  1. Let us now look at the .NET Type Name of the output. For this, we would need to use the Get-Member cmdlet.
PS> ls -l | Get-Member

PowerShell displays, TypeName: System.String, which is consistent with what we saw in the aforementioned recipe.

  1. If you have a Windows PC with PowerShell (or Windows PowerShell), run the same command on it.
PS> ls -l | Get-Member

Notice the .NET Type Name here; it is System.IO.DirectoryInfo, and if you scroll down the console a little, you would also see System.IO.FileInfo.

  1. Next, at the PowerShell on Windows (or Windows PowerShell) prompt, type:
PS> ls -l

You would receive an error, stating that there was no value given to the parameter, LiteralPath.

  1. At the PowerShell prompt on the Windows PC, enter the following and press the Tab key on your keyboard, instead of Enter.
PS> ls -l

You would see that the parameter name was completed to LiteralPath.

  1. Press the Esc key to clear the command line.
  2. Come back to Linux, and at the PowerShell prompt, type in the following and press the Tab key:
PS> ls -l
  1. Nothing happens. Now, enter the following and press the Tab key:
PS> Get-ChildItem -l

The parameter name was completed to -LiteralPath. Let us take one more step and conclude this recipe.

  1. At the PowerShell prompt on Windows, run the following command.
PS> Get-Alias ls
  1. Switch back to Linux and run the same command.
PS> Get-Alias ls

You receive an error stating that there is no such alias.

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

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