Complete the code to display the current directory in PowerShell on Linux.
Get-Location | Select-Object -ExpandProperty [1]The Path property shows the full current directory path in PowerShell.
Complete the code to list all files in the current directory on Linux using PowerShell.
Get-ChildItem -File | Where-Object [1] { $_.Length -gt 0 }
The -FilterScript parameter is used with Where-Object to filter files by a script block.
Fix the error in the code to create a new directory named 'TestDir' on Linux using PowerShell.
New-Item -ItemType Directory -Name [1]On Linux PowerShell, the -Name parameter expects the directory name without quotes.
Fill both blanks to read the content of a file named 'log.txt' and display only lines containing 'error'.
Get-Content [1] | Where-Object { $_ [2] 'error' }
Get-Content reads the file 'log.txt'. The -match operator filters lines containing 'error'.
Fill all three blanks to create a hashtable with file names as keys and their sizes as values for files larger than 1KB.
$files = Get-ChildItem -File | Where-Object { $_.Length [1] 1024 }
$sizes = @{}
foreach ($file in $files) { $sizes[[2]] = [3] }The code filters files larger than 1024 bytes using >. The hashtable uses file.Name as keys and file.Length as values.