# Commands Summary

| Unix                             | Powershell                                                                                |
| -------------------------------- | ----------------------------------------------------------------------------------------- |
| alias (set aliases)              | set-alias                                                                                 |
| alias (show aliases)             | get-alias                                                                                 |
| apropos                          | get-help                                                                                  |
| basename                         | dir \| select name                                                                        |
| cal                              | See commands detail                                                                       |
| cd                               | cd                                                                                        |
| clear                            | clear-host                                                                                |
| date                             | get-date                                                                                  |
| date -s                          | set-date                                                                                  |
| df -k                            | Get-WMIObject Win32\_LogicalDisk \| ft -a                                                 |
| diff                             | Compare-Object -ReferenceObject (Get-Content file1) -DifferenceObject (Get-Content file2) |
| dirname                          | dir \| select directory                                                                   |
| du                               | See commands detail                                                                       |
| echo                             | write-output                                                                              |
| echo -n                          | write-host -nonewline                                                                     |
| \| egrep -i sql                  | \| where {\[Regex]::Ismatch($\_.name.tolower(), "sql") }                                  |
| egrep -i                         | select-string                                                                             |
| egrep                            | select-string  -casesensitive                                                             |
| egrep -v                         | select-string -notmatch                                                                   |
| env                              | Get-ChildItem Env: \| fl  or  get-variable                                                |
| errpt                            | get-eventlog                                                                              |
| export PS1="$ "                  | function prompt {"$ " }                                                                   |
| find                             | dir  *whatever* -recurse                                                                  |
| for (start, stop, step)          | for ($i = 1; $i -le 5; $i++) {whatever}                                                   |
| head                             | gc file.txt \| select-object -first 10                                                    |
| history                          | get-history                                                                               |
| history \| egrep -i ls           | history \| select commandline \| where commandline -like '*ls*' \| fl                     |
| hostname                         | hostname                                                                                  |
| if-then-else                     | if  ( condition ) { do-this } elseif { do-that } else {do-theother}                       |
| if \[ -f "$FileName" ]           | if (test-path $FileName)                                                                  |
| kill                             | stop-process                                                                              |
| less                             | more                                                                                      |
| locate                           | no equivalent but see link                                                                |
| ls                               | get-childitem OR gci OR dir OR ls                                                         |
| ls -a                            | ls -force                                                                                 |
| lsusb                            | gwmi Win32\_USBControllerDevice                                                           |
| mailx                            | send-mailmessage                                                                          |
| man                              | get-help                                                                                  |
| more                             | more                                                                                      |
| mv                               | rename-item                                                                               |
| pg                               | more                                                                                      |
| ps -ef                           | get-process                                                                               |
| ps -ef \| grep oracle            | get-process oracle                                                                        |
| pwd                              | get-location                                                                              |
| read                             | read-host                                                                                 |
| rm                               | remove-item                                                                               |
| script                           | start-transcript                                                                          |
| sleep                            | start-sleep                                                                               |
| sort                             | sort-object                                                                               |
| sort -uniq                       | get-unique                                                                                |
| tail                             | gc file.txt \| select-object -last 10                                                     |
| tail -f                          | gc -tail 10 -wait file.txt                                                                |
| time                             | measure-command                                                                           |
| touch - create an empty file     | set-content -Path ./file.txt -Value $null                                                 |
| touch - update the modified date | set-itemproperty -path ./file.txt -name LastWriteTime -value $(get-date)                  |
| wc -l                            | gc ./file.txt \| measure-object \| select count                                           |
| whoami                           | \[Security.Principal.WindowsIdentity]::GetCurrent() \| select name                        |
| whence or type                   | No direct equivalent, but see link                                                        |
| unalias                          | remove-item -path alias:aliasname                                                         |
| uname -m                         | Get-WmiObject -Class Win32\_ComputerSystem \| select manufacturer, model                  |
| uptime                           | get-wmiobject -class win32\_operatingsystem \| select LastBootUpTime                      |
| (line continuation)              | \` (a backtick)                                                                           |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devops-collective-inc.gitbook.io/a-unix-person-s-guide-to-powershell/commands-summary.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
