Call Us: US - +1 845 478 5244 | UK - +44 20 7193 7850 | AUS - +61 2 8005 4826

Learning command names in traditional shells

Cmdlets use verb-noun names to reduce command memorization
PowerShell uses a “verb-noun” naming system. Each cmdlet name consists of a standard verb hyphenated with a specific noun. PowerShell verbs are not always English verbs, but they express specific actions in PowerShell. Nouns are very much like nouns in any language. They describe specific types of objects that are important in system administration. It’s easy to demonstrate how these two-part names reduce learning effort by looking at a few examples.

PowerShell has a recommended set of standard verbs. Nouns are less restricted, but always describe what the verb acts upon. PowerShell has commands such as Get-Process, Stop-Process, Get-Service, and Stop-Service.

For this example of two nouns and verbs, consistency does not simplify learning that much. Extend that list to a standardized set of 10 verbs and 10 nouns. Now you only have 20 words to understand. But those words can be combined to form 100 distinct command names.

It’s easy to understand what a PowerShell command does by reading its name. The command to shut down a computer is Stop-Computer. The command to list all computers on a network is Get-Computer. The command to get the system date is Get-Date.

You can list all commands that include a particular verb with the Verb parameter for Get-Command. For example, to see all cmdlets that use the verb Get, type:

PS> Get-Command -Verb Get

CommandType Name Definition
———– —- ———-
Cmdlet Get-Acl Get-Acl [[-Path] ]…
Cmdlet Get-Alias Get-Alias [[-Name] <String[]…
Cmdlet Get-AuthenticodeSignature Get-AuthenticodeSignature [-…
Cmdlet Get-ChildItem Get-ChildItem [[-Path] <Stri…

Use the Noun parameter to see a family of commands that affect the same type of object. For example, run following command to see the commands available for managing services:

PS> Get-Command -Noun Service

CommandType Name Definition
———– —- ———-
Cmdlet Get-Service Get-Service [[-Name] …
Cmdlet Restart-Service Restart-Service [-Name] …
Cmdlet Start-Service Start-Service [-Name] <Strin…
Cmdlet Stop-Service Stop-Service [-Name] <String…
Cmdlet Suspend-Service Suspend-Service [-Name] <Str…

Cmdlets use standard parameters
As noted earlier, commands used in traditional command-line interfaces don’t always have consistent parameter names. Parameters are often single-character or abbreviated words that are easy to type but aren’t easily understood by new users.

Unlike most other traditional command-line interfaces, PowerShell processes parameters directly, and it uses this direct access to the parameters along with developer guidance to standardize parameter names. This guidance encourages but does not guarantee that every cmdlet conforms to the standard.

PowerShell also standardizes the parameter separator. Parameter names always have a ‘-‘ prepended to them with a PowerShell command. Consider the following example: