It just shows @JamesKo that if you ask the wrong question, you will get the wrong answer :-( Several people give honest answers here based on (a) the lack of exposure to Linux and (b) your use. In the future I will tell you how Linux relates to PowerShell on this topic, but feel free to go to the answer at the end if you are in a hurry. :-)
Background
In PowerShell, verbose has a very specific meaning, which the PowerShell man page is pretty vague:
Displays detailed information about the operation performed by the command. This information resembles information in a trace or in the transaction log. This option only works when the command generates a verbose message.
It even looks like what you want ... but compare this with the Linux documentation for set -x , which, depending on your taste of Linux, might be like this (from a person, a page project ) ...
The shell should write a standard trace error for each command after it expands the command and before it is executed.
or this (from gnu ) ...
Print a trace of simple commands, commands, case commands, select commands and arithmetic for commands and their arguments or related word lists after they are expanded and before they are executed.
The very first line of your question is clearly and concisely consistent with them. But verbosity in PowerShell is different. In a nutshell, turning on verbose mode (whether using the -Verbose command line or the $VerbosePreference variable) simply outputs the output from the verbose stream to the console. (Just as Linux offers two streams: stdout and stderr, PowerShell offers several streams: output stream, error stream, warning stream, detail stream and debug stream. You work with these streams according to Linux, you can even use, for example , commands 4>&1 , for example, to merge a material stream into stdout (you can learn more about several PowerShell output streams in the PowerShell One-Liners Master Records section : Accessing, Processing, and Writing Data and Good Reference - Complete Guide to PowerShell punctuation .)
Answer
The Set-PSDebug command will give you a bash equivalent trace. You can even customize tracking details with the -Trace . Firstly, here is the control before using Set-PSDebug :
PS> Get-PSDepth 0
With a value of 1, you get each line of code as it is executed, for example:
PS> Set-PSDebug -Trace 1 PS> Get-PSDepth DEBUG: 1+ >>>> Get-PSDepth DEBUG: 141+ >>>> { DEBUG: 142+ >>>> $nest = -1 DEBUG: 143+ >>>> $thisId = $pid DEBUG: 144+ while ( >>>> (ps -id $thisId).Name -eq 'powershell') { DEBUG: 145+ >>>> $thisId = (gwmi win32_process -Filter "processid='$thisId'").ParentProcessId DEBUG: 146+ >>>> $nest++ DEBUG: 144+ while ( >>>> (ps -id $thisId).Name -eq 'powershell') { DEBUG: 148+ >>>> $nest 0 DEBUG: 149+ >>>> }
With a value of 2, you also get variable assignments and code codes:
PS> Set-PSDebug -Trace 2 PS> Get-PSDepth DEBUG: 1+ >>>> Get-PSDepth DEBUG: ! CALL function '<ScriptBlock>' DEBUG: 141+ >>>> { DEBUG: ! CALL function 'Get-PSDepth' (defined in file 'C:\Users\msorens\Documents\WindowsPowerShell\profile.ps1') DEBUG: 142+ >>>> $nest = -1 DEBUG: ! SET $nest = '-1'. DEBUG: 143+ >>>> $thisId = $pid DEBUG: ! SET $thisId = '9872'. DEBUG: 144+ while ( >>>> (ps -id $thisId).Name -eq 'powershell') { DEBUG: 145+ >>>> $thisId = (gwmi win32_process -Filter "processid='$thisId'").ParentProcessId DEBUG: ! SET $thisId = '10548'. DEBUG: 146+ >>>> $nest++ DEBUG: ! SET $nest = '0'. DEBUG: 144+ while ( >>>> (ps -id $thisId).Name -eq 'powershell') { DEBUG: 148+ >>>> $nest 0 DEBUG: 149+ >>>> }
These are traces of a simple cmdlet that I wrote called Get-PSDepth . It prints commands, appointments, etc. With the prefix DEBUG mixed with the actual output, which in this case is the only line containing only 0 .