- 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).
- 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.
- 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.
- 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.
- 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.
- Press the Esc key to clear the command line.
- Come back to Linux, and at the PowerShell prompt, type in the following and press the Tab key:
PS> ls -l
- 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.
- At the PowerShell prompt on Windows, run the following command.
PS> Get-Alias ls
- Switch back to Linux and run the same command.
PS> Get-Alias ls
You receive an error stating that there is no such alias.