Convenience aliases

One important point to note is that commands like ls and mkdir are aliases in Windows PowerShell, which means, running ls on Windows PowerShell would run Get-ChildItem in the background (this is also true for PowerShell on Windows). In Linux, however, running ls from within PowerShell would run the actual ls command; ls is not an alias in PowerShell on Linux, it is the command itself, whose output would be plain text. You can validate this by running ls | Get-Member on PowerShell on Linux, and compare it with PowerShell on Windows as well as Windows PowerShell. (It is, therefore, good to stick to the best practice of not using aliases in scripts.)

PowerShell knows whether it is running on Linux, Windows or Mac OS by means of the values of the automatic variables, IsLinux, IsWindows and IsMacOS. On any system, only one of these variables has the value, True. When PowerShell sees that IsLinux is True, it would run Linux commands instead of the convenience aliases that were initially created to facilitate Linux administrators. For more information on these automatic variables, read the recipe, Configure built-in variables.
..................Content has been hidden....................

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