Powershell

PowerShell’s Equivalent to Linux’s: ls -al

Linux is a free and open-source operating system that is based on a kernel. Linux OS contains a PowerShell command-like program called “Terminal”. The “Terminal” has several cmdlets that have functionality similar to the PowerShell commands but with a different name.

This post will observe the equivalent of the “ls -al” command in PowerShell.

PowerShell’s Equivalent to Linux’s: ls -al

The equivalent to the “ls” cmdlet of Linux in PowerShell is the “Get-ChildItem”. It gets one or more items from a specified location. While the equivalent to the “-al” is the “-Force” parameter. It can be used along with the “Get-Child-Item” cmdlet to get the hidden files also from a specified location.

Example 1: Get the List of Item’s Location Using the “Get-ChildItem” Cmdlet

This example will get the item’s list located in the defined directory:

Get-ChildItem C:\Doc

According to the above code:

First, specify the “Get-ChildItem” cmdlet and define the directory path to get the list of items:

Example 2: Get the List of Items Including the Hidden Ones

In this example, all the files will be displayed in the output including the hidden files also. To do so, simply specify the “-Force” parameter at the end of the command:

Get-ChildItem C:\Doc -Force

Example 3: Get Only the Hidden Items

This instance will only display the list of hidden files. For that reason, simply specify the “-Hidden” parameter after the directory address:

Get-ChildItem C:\Doc -Hidden

That’s how you can utilize the “ls -al” functionality in PowerShell.

Conclusion

The equivalent to the “ls” is the “Get-ChildItem” cmdlet in PowerShell. It is used to get items including files or folders from one or more locations. While the “-al” is equivalent to the “-Force” parameter, utilized along with the “Get-ChildItem” cmdlet to get the hidden items. This post has discussed the equivalents of the “ls -al” cmdlet in PowerShell.

About the author

Muhammad Farhan

I am a Computer Science graduate and now a technical writer who loves to provide the easiest solutions to the most difficult problems related to Windows, Linux, and Web designing. My love for Computer Science emerges every day because of its ease in our everyday life.